Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
ceb9710b
Commit
ceb9710b
authored
6 years ago
by
Alexandre Abadie
Browse files
Options
Downloads
Patches
Plain Diff
drivers/at: make OK and ERROR replies configurable
parent
d8c3e1da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/at/at.c
+11
-3
11 additions, 3 deletions
drivers/at/at.c
drivers/include/at.h
+10
-0
10 additions, 0 deletions
drivers/include/at.h
with
21 additions
and
3 deletions
drivers/at/at.c
+
11
−
3
View file @
ceb9710b
...
...
@@ -141,11 +141,17 @@ ssize_t at_send_cmd_get_lines(at_dev_t *dev, const char *command,
}
else
if
(
res
>
0
)
{
bytes_left
-=
res
;
if
((
res
==
(
2
+
keep_eol
))
&&
(
strncmp
(
pos
,
"OK"
,
2
)
==
0
))
{
size_t
len_ok
=
sizeof
(
AT_RECV_OK
)
-
1
;
size_t
len_error
=
sizeof
(
AT_RECV_ERROR
)
-
1
;
if
(((
size_t
)
res
==
(
len_ok
+
keep_eol
))
&&
(
len_ok
!=
0
)
&&
(
strncmp
(
pos
,
AT_RECV_OK
,
len_ok
)
==
0
))
{
res
=
len
-
bytes_left
;
break
;
}
else
if
((
res
==
(
5
+
keep_eol
))
&&
(
strncmp
(
pos
,
"ERROR"
,
5
)
==
0
))
{
else
if
(((
size_t
)
res
==
(
len_error
+
keep_eol
))
&&
(
len_error
!=
0
)
&&
(
strncmp
(
pos
,
AT_RECV_ERROR
,
len_error
)
==
0
))
{
return
-
1
;
}
else
if
(
strncmp
(
pos
,
"+CME ERROR:"
,
11
)
==
0
)
{
...
...
@@ -204,8 +210,10 @@ int at_send_cmd_wait_ok(at_dev_t *dev, const char *command, uint32_t timeout)
char
resp_buf
[
64
];
res
=
at_send_cmd_get_resp
(
dev
,
command
,
resp_buf
,
sizeof
(
resp_buf
),
timeout
);
if
(
res
>
0
)
{
if
(
strcmp
(
resp_buf
,
"OK"
)
==
0
)
{
ssize_t
len_ok
=
sizeof
(
AT_RECV_OK
)
-
1
;
if
((
len_ok
!=
0
)
&&
(
strcmp
(
resp_buf
,
AT_RECV_OK
)
==
0
))
{
res
=
0
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
drivers/include/at.h
+
10
−
0
View file @
ceb9710b
...
...
@@ -67,6 +67,16 @@ extern "C" {
#define AT_RECV_EOL_2 "\n"
#endif
#ifndef AT_RECV_OK
/** default OK reply of an AT device */
#define AT_RECV_OK "OK"
#endif
#ifndef AT_RECV_ERROR
/** default ERROR reply of an AT device */
#define AT_RECV_ERROR "ERROR"
#endif
/**
* @brief AT device structure
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment