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
e3f26b2c
Commit
e3f26b2c
authored
6 years ago
by
Vincent Dupont
Committed by
Kaspar Schleiser
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tests: add at parser basic test app
parent
0199f36b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/at/Makefile
+6
-0
6 additions, 0 deletions
tests/at/Makefile
tests/at/main.c
+90
-0
90 additions, 0 deletions
tests/at/main.c
with
96 additions
and
0 deletions
tests/at/Makefile
0 → 100644
+
6
−
0
View file @
e3f26b2c
include
../Makefile.tests_common
USEMODULE
+=
shell
USEMODULE
+=
at
include
$(RIOTBASE)/Makefile.include
This diff is collapsed.
Click to expand it.
tests/at/main.c
0 → 100644
+
90
−
0
View file @
e3f26b2c
/*
* Copyright (C) 2018 OTA keys S.A.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief AT module test application
*
* @author Vincent Dupont <vincent@otakeys.com>
*
* @}
*/
#include
"at.h"
#include
"shell.h"
#include
"timex.h"
static
at_dev_t
at_dev
;
static
char
buf
[
256
];
static
char
resp
[
1024
];
#ifndef UART_AT
#define UART_AT UART_DEV(1)
#endif
#ifndef BAUDRATE_AT
#define BAUDRATE_AT 115200
#endif
static
int
init
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
at_dev_init
(
&
at_dev
,
UART_AT
,
BAUDRATE_AT
,
buf
,
sizeof
(
buf
));
return
0
;
}
static
int
send
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
puts
(
"Please enter a command"
);
return
1
;
}
if
(
at_send_cmd_get_resp
(
&
at_dev
,
argv
[
1
],
resp
,
sizeof
(
resp
),
10
*
US_PER_SEC
)
>
0
)
{
puts
(
"Response:"
);
puts
(
resp
);
}
else
{
puts
(
"Error"
);
}
return
0
;
}
static
int
drain
(
int
argc
,
char
**
argv
)
{
(
void
)
argc
;
(
void
)
argv
;
at_drain
(
&
at_dev
);
return
0
;
}
static
const
shell_command_t
shell_commands
[]
=
{
{
"init"
,
"Initialize AT device"
,
init
},
{
"send"
,
"Send a command and wait response"
,
send
},
{
"drain"
,
"Drain AT device"
,
drain
},
{
NULL
,
NULL
,
NULL
},
};
int
main
(
void
)
{
puts
(
"AT command test app"
);
/* run the shell */
char
line_buf
[
SHELL_DEFAULT_BUFSIZE
];
shell_run
(
shell_commands
,
line_buf
,
SHELL_DEFAULT_BUFSIZE
);
return
0
;
}
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