mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
tests/candev: update test application
This commit is contained in:
parent
bc0d3f9de3
commit
2543b3d2b6
@ -223,14 +223,28 @@ if (IS_ACTIVE(CONFIG_USE_LOOPBACK_MODE)) {
|
||||
|
||||
if (IS_ACTIVE(MCP2515_RECV_FILTER_EN)) {
|
||||
/* CAN filters examples */
|
||||
struct can_filter filter[3];
|
||||
struct can_filter filter[4];
|
||||
filter[0].can_mask = 0x7FF;
|
||||
filter[0].can_id = 0x001; /* messages with CAN ID 0x001 will be received in mailbox 0 */
|
||||
filter[0].can_id = 0x001;
|
||||
#if defined(MODULE_MCP2515)
|
||||
filter[0].target_mailbox = 0; /* messages with CAN ID 0x001 will be received in mailbox 0 */
|
||||
#endif
|
||||
filter[1].can_mask = 0x7FF;
|
||||
filter[1].can_id = 0x003; /* messages with CAN ID 0x003 will be received in mailbox 0 */
|
||||
filter[1].can_id = 0x002;
|
||||
#if defined(MODULE_MCP2515)
|
||||
filter[1].target_mailbox = 1; /* messages with CAN ID 0x002 will be received in mailbox 1 */
|
||||
#endif
|
||||
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++) {
|
||||
filter[2].can_id = 0x003;
|
||||
#if defined(MODULE_MCP2515)
|
||||
filter[2].target_mailbox = 0; /* messages with CAN ID 0x003 will be received in mailbox 0 */
|
||||
#endif
|
||||
filter[3].can_mask = 0x7FF;
|
||||
filter[3].can_id = 0x004;
|
||||
#if defined(MODULE_MCP2515)
|
||||
filter[3].target_mailbox = 0; /* this filter won't be applied. Reason is no space found in the first mailbox as it supports only two filters */
|
||||
#endif
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
candev->driver->set_filter(candev, &filter[i]);
|
||||
}
|
||||
/* All other messages won't be received */
|
||||
|
Loading…
Reference in New Issue
Block a user