Skip to content

Commit

Permalink
#29 rename erorr enum variants
Browse files Browse the repository at this point in the history
  • Loading branch information
HusseinAbdelhamid committed Oct 14, 2024
1 parent 783ed8f commit 2f32f5c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ pub enum Error<B, CS> {
InvalidRamAddress(u16),
/// Payload buffer length not a multiple of 4 bytes
InvalidBufferSize(usize),
/// RX Fifo buffer is empty
RxFifoEmpty,
/// TX fifo buffer is full
TxFifoFull,
/// RX fifo empty error
RxFifoEmptyErr,
/// TX fifo buffer full error
TxFifoFullErr,
}

impl<B, CS> From<BusError<B, CS>> for Error<B, CS> {
Expand Down Expand Up @@ -127,7 +127,7 @@ impl<B: Transfer<u8>, CS: OutputPin, CLK: Clock> CanController for MCP2517<B, CS
if blocking {
while !self.fifo_not_full(fifo_status_reg)? {}
} else if !self.fifo_not_full(fifo_status_reg)? {
return Err(Error::TxFifoFull);
return Err(Error::TxFifoFullErr);
}

// make sure length of payload is consistent with CAN operation mode
Expand Down Expand Up @@ -168,7 +168,7 @@ impl<B: Transfer<u8>, CS: OutputPin, CLK: Clock> CanController for MCP2517<B, CS
if blocking {
while !self.fifo_not_empty(fifo_status_reg)? {}
} else if !self.fifo_not_empty(fifo_status_reg)? {
return Err(Error::RxFifoEmpty);
return Err(Error::RxFifoEmptyErr);
}

let user_address = self.read32(Self::fifo_user_address_register(FIFO_RX_INDEX))?;
Expand Down
4 changes: 2 additions & 2 deletions src/tests/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ fn test_receive_fifo_empty() {

let result = mocks.into_controller().receive(&mut message_buff, false);

assert_eq!(result.unwrap_err(), Error::RxFifoEmpty);
assert_eq!(result.unwrap_err(), Error::RxFifoEmptyErr);
}

#[test]
Expand All @@ -624,7 +624,7 @@ fn test_transmit_fifo_full() {

let res = mocks.into_controller().transmit(&tx_message, false);

assert_eq!(res.unwrap_err(), Error::TxFifoFull);
assert_eq!(res.unwrap_err(), Error::TxFifoFullErr);
}

#[test]
Expand Down

0 comments on commit 2f32f5c

Please sign in to comment.