-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/at: URC handling done, added unit tests, documentation.
- Loading branch information
Showing
8 changed files
with
1,141 additions
and
152 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
handle_urc=0 | ||
echo=0 | ||
rcv_eol_1="" | ||
rcv_eol_2="" | ||
send_eol="" | ||
|
||
run_test() { | ||
echo "Running test with:" | ||
echo " URC handling = $handle_urc" | ||
echo " echo = $echo" | ||
echo " send EOL = $send_eol" | ||
echo " rcv EOL 1 = $rcv_eol_1" | ||
echo " rcv EOL 2 = $rcv_eol_2" | ||
|
||
# make -j BOARD=native "HANDLE_URC=$handle_urc" "ECHO_ON=$echo" "SEND_EOL=\"$send_eol\"" "RECV_EOL_1=\"$rcv_eol_1\"" "RECV_EOL_2=\"$rcv_eol_2\"" compile-commands | ||
make -j BOARD=native "HANDLE_URC=$handle_urc" "ECHO_ON=$echo" "SEND_EOL=\"$send_eol\"" "RECV_EOL_1=\"$rcv_eol_1\"" "RECV_EOL_2=\"$rcv_eol_2\"" tests-at | ||
|
||
# take /dev/ttyS0 as serial interface. It is only required s.t. UART | ||
# initialization succeeds and it gets turned off right away. | ||
set +e | ||
./bin/native/tests_unittests.elf -c /dev/ttyS0 <<< "s\n" | ||
if [ $? -ne 0 ] | ||
then | ||
echo "Test failed!" | ||
exit 1 | ||
fi | ||
set -e | ||
} | ||
|
||
# set -x | ||
set -e | ||
|
||
SCRIPT=$(readlink -f "$0") | ||
BASEDIR=$(dirname "$SCRIPT")/../../../unittests | ||
|
||
cd "$BASEDIR" | ||
|
||
for urc_i in 0 1; do | ||
handle_urc=$urc_i | ||
for echo_i in 0 1; do | ||
echo=$echo_i | ||
# 0xd == \r, 0xa == \n - I'm using this notation because I can't wrap my head around | ||
# how many parsers along the way try to interpret \r and \n. Worse, every time the | ||
# string is entering a new parser, one `\` is shaved off. So it looks like four | ||
# times is the right amount so that the final C string will be something like "\xd". | ||
for send_i in "\\\\xd" "\\\\xa" "\\\\xd\\\\xa"; do | ||
send_eol=$send_i | ||
|
||
rcv_eol_1="\\\\xd" | ||
rcv_eol_2="\\\\xa" | ||
run_test | ||
|
||
rcv_eol_1="\\\\xd" | ||
rcv_eol_2="" | ||
run_test | ||
|
||
rcv_eol_1="\\\\xa" | ||
rcv_eol_2="" | ||
run_test | ||
done | ||
|
||
done | ||
done | ||
|
||
echo "All tests passed!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HANDLE_URC ?= 1 | ||
ECHO_ON ?= 1 | ||
SEND_EOL ?= "\\xd" | ||
RECV_EOL_1 ?= "\\xd" | ||
RECV_EOL_2 ?= "\\xa" | ||
|
||
ifeq ($(HANDLE_URC), 1) | ||
USEMODULE += at_urc | ||
endif | ||
|
||
ifeq ($(ECHO_ON), 0) | ||
CFLAGS += -DCONFIG_AT_SEND_SKIP_ECHO=1 | ||
endif | ||
|
||
CFLAGS += -DAT_RECV_EOL_1="\"$(RECV_EOL_1)\"" | ||
CFLAGS += -DAT_RECV_EOL_2="\"$(RECV_EOL_2)\"" | ||
CFLAGS += -DCONFIG_AT_SEND_EOL="\"$(SEND_EOL)\"" | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USEMODULE += at |
Oops, something went wrong.