diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-02-08 16:47:00 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-02-09 18:27:29 -0500 |
commit | 5c4cf5455720ee3f0a0c69174d08f7ef2d3f4e83 (patch) | |
tree | aee016cde3c5f46ba23ede7c1bd1ef864a605086 /src/stm32/can.c | |
parent | 5769a9072b0d77a324d132a437a33de8f400fbf0 (diff) | |
download | kutter-5c4cf5455720ee3f0a0c69174d08f7ef2d3f4e83.tar.gz kutter-5c4cf5455720ee3f0a0c69174d08f7ef2d3f4e83.tar.xz kutter-5c4cf5455720ee3f0a0c69174d08f7ef2d3f4e83.zip |
canbus: Rename canbus_set_dataport() to canbus_set_filter() and simplify
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/can.c')
-rw-r--r-- | src/stm32/can.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/stm32/can.c b/src/stm32/can.c index 987a8190..cb5f442b 100644 --- a/src/stm32/can.c +++ b/src/stm32/can.c @@ -157,8 +157,8 @@ canbus_send(uint32_t id, uint32_t len, uint8_t *data) #define CAN_FILTER_NUMBER 0 // Setup the receive packet filter -static void -can_set_filter(uint32_t id1, uint32_t id2) +void +canbus_set_filter(uint32_t id) { uint32_t filternbrbitpos = 1 << CAN_FILTER_NUMBER; @@ -167,8 +167,9 @@ can_set_filter(uint32_t id1, uint32_t id2) /* Initialisation mode for the filter */ SOC_CAN->FA1R = 0; - SOC_CAN->sFilterRegister[CAN_FILTER_NUMBER].FR1 = id1 << (5 + 16); - SOC_CAN->sFilterRegister[CAN_FILTER_NUMBER].FR2 = id2 << (5 + 16); + uint32_t idadmin = CANBUS_ID_UUID; + SOC_CAN->sFilterRegister[CAN_FILTER_NUMBER].FR1 = idadmin << (5 + 16); + SOC_CAN->sFilterRegister[CAN_FILTER_NUMBER].FR2 = id << (5 + 16); /* Identifier list mode for the filter */ SOC_CAN->FM1R = filternbrbitpos; @@ -185,12 +186,6 @@ can_set_filter(uint32_t id1, uint32_t id2) } void -canbus_set_dataport(uint32_t id) -{ - can_set_filter(CANBUS_ID_UUID, id); -} - -void canbus_reboot(void) { NVIC_SystemReset(); @@ -292,7 +287,7 @@ can_init(void) ; /*##-2- Configure the CAN Filter #######################################*/ - can_set_filter(CANBUS_ID_UUID, CANBUS_ID_SET); + canbus_set_filter(CANBUS_ID_SET); /*##-3- Configure Interrupts #################################*/ |