Struct stm32f4xx::can::Can

source ·
pub struct Can<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Can<'a>

source

pub fn new( clocks: &'a dyn Stm32f4Clocks, registers: StaticRef<Registers>, ) -> Can<'a>

source

pub fn enable(&self) -> Result<(), ErrorCode>

Enable the peripheral with the stored communication parameters: bit timing settings and communication mode

source

pub fn config_filter(&self, filter_info: FilterParameters, enable: bool)

Configure a filter to receive messages

source

pub fn enable_filter_config(&self)

source

pub fn enter_normal_mode(&self) -> Result<(), ErrorCode>

source

pub fn enter_sleep_mode(&self)

source

pub fn send_8byte_message( &self, id: Id, dlc: usize, rtr: u8, ) -> Result<(), ErrorCode>

This function sends an 8-byte message

source

pub fn find_empty_mailbox(&self) -> Option<usize>

source

pub fn is_enabled_clock(&self) -> bool

source

pub fn enable_clock(&self)

source

pub fn disable_clock(&self)

source

pub fn handle_transmit_interrupt(&self)

Handle the transmit interrupt. Check the status register for each transmit mailbox to find out the mailbox that the message was sent from.

source

pub fn process_received_message( &self, rx_mailbox: usize, ) -> (Id, usize, [u8; 8])

source

pub fn handle_fifo0_interrupt(&self)

source

pub fn handle_fifo1_interrupt(&self)

source

pub fn handle_error_status_interrupt(&self)

source

pub fn enable_irq(&self, interrupt: CanInterruptMode)

source

pub fn disable_irq(&self, interrupt: CanInterruptMode)

source

pub fn enable_irqs(&self)

source

pub fn disable_irqs(&self)

Trait Implementations§

source§

impl Configure for Can<'_>

source§

const MIN_BIT_TIMINGS: BitTiming = _

Constants that define the minimum and maximum values that the timing parameters can take. They are used when calculating the optimum timing parameters for a given bitrate.
source§

const MAX_BIT_TIMINGS: BitTiming = _

source§

const SYNC_SEG: u8 = 1u8

This constant represents the synchronization segment. Most CAN devices seems to have define this in hardware to 1 quantum long. 1 quantum long. It is used for the synchronization of the clocks.
source§

fn set_bitrate(&self, bitrate: u32) -> Result<(), ErrorCode>

Configures the CAN peripheral at the given bitrate. This function is supposed to be called before the enable function. This function is synchronous as the driver should only calculate the timing parameters based on the bitrate and the frequency of the board and store them. This function does not configure the hardware. Read more
source§

fn set_bit_timing(&self, bit_timing: BitTiming) -> Result<(), ErrorCode>

Configures the CAN peripheral with the given arguments. This function is supposed to be called before the enable function. This function is synchronous as the driver should only store the arguments, and should not configure the hardware. Read more
source§

fn set_operation_mode(&self, mode: OperationMode) -> Result<(), ErrorCode>

Configures the CAN peripheral with the given arguments. This function is supposed to be called before the enable function. This function is synchronous as the driver should only store the arguments, and should not configure the hardware. Read more
source§

fn get_bit_timing(&self) -> Result<BitTiming, ErrorCode>

Returns the current timing parameters for the CAN peripheral. Read more
source§

fn get_operation_mode(&self) -> Result<OperationMode, ErrorCode>

Returns the current operating mode for the CAN peripheral. Read more
source§

fn set_automatic_retransmission(&self, automatic: bool) -> Result<(), ErrorCode>

Configures the CAN peripheral with the automatic retransmission setting. This function is optional, but if used, must be called before the enable function. This function is synchronous as the driver should only store the arguments, and should not configure the hardware. Read more
source§

fn set_wake_up(&self, wake_up: bool) -> Result<(), ErrorCode>

Configures the CAN peripheral with the automatic wake up setting. This function is optional, but if used, must be called before the enable function. This function is synchronous as the driver should only store the arguments, and should not configure the hardware. Read more
source§

fn get_automatic_retransmission(&self) -> Result<bool, ErrorCode>

Returns the current automatic retransmission setting of the peripheral. Read more
source§

fn get_wake_up(&self) -> Result<bool, ErrorCode>

Returns the current automatic wake up setting of the peripheral. Read more
source§

fn receive_fifo_count(&self) -> usize

Returns the number of receive FIFOs the peripheral provides
source§

impl Controller for Can<'_>

source§

fn set_client(&self, client: Option<&'static dyn ControllerClient>)

Set the client to be used for callbacks of the Controller implementation.
source§

fn enable(&self) -> Result<(), ErrorCode>

This function enables the CAN peripheral with the Timing, Operation and Mode arguments that are provided to the driver before calling the enable function. Read more
source§

fn disable(&self) -> Result<(), ErrorCode>

This function disables the CAN peripheral and puts it in Sleep Mode. The peripheral must be previously enabled. Read more
source§

fn get_state(&self) -> Result<State, ErrorCode>

This function returns the current state of the CAN peripheral. Read more
source§

impl DeferredCallClient for Can<'_>

source§

fn register(&'static self)

source§

fn handle_deferred_call(&self)

Software interrupt function that is called when the deferred call is triggered.
source§

impl Receive<{ can::STANDARD_CAN_PACKET_SIZE }> for Can<'_>

source§

fn set_client( &self, client: Option<&'static dyn ReceiveClient<{ can::STANDARD_CAN_PACKET_SIZE }>>, )

Set the client to be used for callbacks of the Receive implementation.
source§

fn start_receive_process( &self, buffer: &'static mut [u8; 8], ) -> Result<(), (ErrorCode, &'static mut [u8; 8])>

Start receiving messaged on the CAN bus. Read more
source§

fn stop_receive(&self) -> Result<(), ErrorCode>

Asks the driver to stop receiving messages. This function should be called only after a call to the start_receive_process function. Read more
source§

const PACKET_SIZE: usize = PACKET_SIZE

source§

impl Transmit<{ can::STANDARD_CAN_PACKET_SIZE }> for Can<'_>

source§

fn set_client( &self, client: Option<&'static dyn TransmitClient<{ can::STANDARD_CAN_PACKET_SIZE }>>, )

Set the client to be used for callbacks of the Transmit implementation.
source§

fn send( &self, id: Id, buffer: &'static mut [u8; 8], len: usize, ) -> Result<(), (ErrorCode, &'static mut [u8; 8])>

Sends a buffer using the CAN bus. Read more
source§

const PACKET_SIZE: usize = PACKET_SIZE

Auto Trait Implementations§

§

impl<'a> !Freeze for Can<'a>

§

impl<'a> !RefUnwindSafe for Can<'a>

§

impl<'a> !Send for Can<'a>

§

impl<'a> !Sync for Can<'a>

§

impl<'a> Unpin for Can<'a>

§

impl<'a> !UnwindSafe for Can<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StandardBitTiming for T
where T: Configure,

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.