diff options
| author | 2025-12-12 00:10:31 -0500 | |
|---|---|---|
| committer | 2025-12-12 00:12:15 -0500 | |
| commit | 36d5f004515bebaf9d22785aa947a8f0904aa78b (patch) | |
| tree | c9e4d3f4dd2299503b0e84e1b2ea7f049567f53c /main.c | |
| parent | a23a659972f0975eabb3462b9de314c563893a04 (diff) | |
| download | stm32_can_demo-master.tar.gz stm32_can_demo-master.zip | |
should just be a bitmap anyway but it's a bit more legible anyway which is good
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -46,12 +46,13 @@ bool can_recv(CAN_FIFOMailBox_TypeDef *frame) { // This will get called when we get a new frame in FIFO1 void canrx1_handler() { // if the queue is full just drop the frame - if ((can_frame_queue.back + 1) % CAN_FRAME_QUEUE_DEPTH == can_frame_queue.front) { + int next_back = (can_frame_queue.back + 1) % CAN_FRAME_QUEUE_DEPTH; + if (next_back == can_frame_queue.front) { CAN1->RF1R |= CAN_RF1R_RFOM1; return; } can_frame_queue.data[can_frame_queue.back] = CAN1->sFIFOMailBox[1]; - can_frame_queue.back = (can_frame_queue.back + 1) % CAN_FRAME_QUEUE_DEPTH; + can_frame_queue.back = next_back; // tell the FIFO we are done with this frame CAN1->RF1R |= CAN_RF1R_RFOM1; } |
