Skip to content

Commit

Permalink
add Twai::enable_rx_interrupt and Twai::disable_rx_interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpolo committed Mar 29, 2023
1 parent a677abd commit 61c83a6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions esp-hal-common/src/twai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,22 @@ where
}
}

/// Use in combination with `interrupt::enable`.
/// The interrupt is cleared when all pending messages are received.
pub fn enable_rx_interrupt(&mut self) {
self.peripheral
.register_block()
.int_ena
.modify(|_, w| w.rx_int_ena().set_bit());
}

pub fn disable_rx_interrupt(&mut self) {
self.peripheral
.register_block()
.int_ena
.modify(|_, w| w.rx_int_ena().clear_bit());
}

/// Release the message in the buffer. This will decrement the received
/// message counter and prepare the next message in the FIFO for
/// reading.
Expand Down

0 comments on commit 61c83a6

Please sign in to comment.