1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/candev: adapt test application

This commit is contained in:
Firas Hamdi 2022-05-05 17:39:19 +02:00 committed by Benjamin Valentin
parent 3f9866e709
commit 285ba27be6
3 changed files with 19 additions and 5 deletions

View File

@ -10969,6 +10969,7 @@ drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_BUKT
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_BUKT1 \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_FILHIT0 \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_MODE_RECV_ALL \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_MODE_RECV_FILTER \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_MODE_RECV_EXT \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_MODE_RECV_STD \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB0CTRL_MODE_RECV_STD_OR_EXT \(macro definition\) of file mcp2515_defines\.h is not documented\.
@ -10993,6 +10994,7 @@ drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_FILH
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_FILHIT1 \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_FILHIT2 \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_MODE_RECV_ALL \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_MODE_RECV_FILTER \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_MODE_RECV_EXT \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_MODE_RECV_STD \(macro definition\) of file mcp2515_defines\.h is not documented\.
drivers/mcp2515/mcp2515_defines\.h:[0-9]+: warning: Member MCP2515_RXB1CTRL_MODE_RECV_STD_OR_EXT \(macro definition\) of file mcp2515_defines\.h is not documented\.

View File

@ -9,6 +9,8 @@ ifeq ($(CAN_DRIVER), PERIPH_CAN)
FEATURES_REQUIRED += periph_can
else ifeq ($(CAN_DRIVER), MCP2515)
USEMODULE += mcp2515
# Uncomment to enable MCP2515 reception filtering
# CFLAGS += "-DMCP2515_RECV_FILTER_EN=1"
else ifeq ($(CAN_DRIVER), CAN_ALT)
# other can modules can be defined here
endif

View File

@ -219,13 +219,23 @@ if (IS_ACTIVE(CONFIG_USE_LOOPBACK_MODE)) {
/* set to loopback test mode */
canopt_state_t mode = CANOPT_STATE_LOOPBACK;
candev->driver->set(candev, CANOPT_STATE, &mode, sizeof(mode));
/* do not care, receive all message id */
struct can_filter filter;
filter.can_mask = 0;
candev->driver->set_filter(candev, &filter);
}
if (IS_ACTIVE(MCP2515_RECV_FILTER_EN)) {
/* CAN filters examples */
struct can_filter filter[3];
filter[0].can_mask = 0x7FF;
filter[0].can_id = 0x001; /* messages with CAN ID 0x001 will be received in mailbox 0 */
filter[1].can_mask = 0x7FF;
filter[1].can_id = 0x003; /* messages with CAN ID 0x003 will be received in mailbox 0 */
filter[2].can_mask = 0x7FF;
filter[2].can_id = 0x002; /* messages with CAN ID 0x002 will be received in mailbox 1 */
for (uint8_t i = 0; i < 3; i++) {
candev->driver->set_filter(candev, &filter[i]);
}
/* All other messages won't be received */
}
char line_buf[SHELL_DEFAULT_BUFSIZE];
shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE);