diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-11-07 12:37:47 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-11-07 12:37:47 -0500 |
| commit | 5185feb984da4c7a4537d1bd090f530732c0e071 (patch) | |
| tree | 1950cff3db4cb162be86fb8b41dfcaa5e2e44c4f /fw/can.c | |
| parent | 2f28635ba7d96f5fd5c029ba01e41ceb3ecaebfd (diff) | |
| download | can-gauge-interface-5185feb984da4c7a4537d1bd090f530732c0e071.zip | |
transmit line number on error
Diffstat (limited to 'fw/can.c')
| -rw-r--r-- | fw/can.c | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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 |