aboutsummaryrefslogtreecommitdiffstats
path: root/fw/can.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/can.c')
-rw-r--r--fw/can.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fw/can.c b/fw/can.c
index 8376049..421c69b 100644
--- a/fw/can.c
+++ b/fw/can.c
@@ -261,7 +261,7 @@ readRxbn(U8 n, CanFrame *frame) {
CAN_CS = 0;
// Start reading at RXBnSIDH
- (void)spiTx(CMD_READ_RX | (U8)((n & 1u) << 2u));
+ (void)spiTx(CMD_READ_RX | (U8)((n & 1) << 2u));
// Read ID
sidh = spiTx(0u);
@@ -270,13 +270,9 @@ readRxbn(U8 n, CanFrame *frame) {
eid0 = spiTx(0u);
packId(&frame->id, sidh, sidl, eid8, eid0);
- // Read RTR and DLC
+ // Read DLC and RTR
frame->dlc = spiTx(0u);
- if (frame->id.isExt) {
- frame->rtr = frame->dlc & RTR;
- } else {
- frame->rtr = sidl & SRR;
- }
+ frame->rtr = (sidl & IDE) ? (frame->dlc & RTR) : (sidl & SRR);
frame->dlc &= 0xF;
// Read data