nrfxlib API 3.3.99
Loading...
Searching...
No Matches
Soft CAN

Soft CAN driver. More...

Data Structures

struct  nrf_scan_context_t
 sCAN context structure. , More...
 
struct  nrf_scan_timing_t
 sCAN timing configuration structure. , More...
 
struct  nrf_scan_frame_t
 sCAN TX/RX frame structure. , More...
 
struct  nrf_scan_rx_filter_t
 sCAN RX filter structure. , More...
 
struct  nrf_scan_rx_mailbox_t
 sCAN RX mailbox structure. , More...
 
struct  nrf_scan_t
 sCAN driver instance structure. , More...
 
struct  nrf_scan_status_t
 sCAN status structure. , More...
 

Typedefs

typedef void(* nrf_scan_event_handler_t) (nrf_scan_event_type_t const *p_event, void *p_context)
 sCAN event handler function pointer
 

Enumerations

enum  nrf_scan_event_type_t { NRF_SCAN_EVT_TX_COMPLETE , NRF_SCAN_EVT_RX_COMPLETE , NRF_SCAN_EVT_ERROR , NRF_SCAN_EVT_STATE_CHANGED }
 sCAN event definitions More...
 
enum  nrf_scan_mode_type_t { NRF_SCAN_MODE_NORMAL = 0 , NRF_SCAN_MODE_LOOPBACK , NRF_SCAN_MODE_LISTENONLY , NRF_SCAN_MODE_ONESHOT }
 sCAN operation mode definitions More...
 
enum  nrf_scan_error_t {
  NRF_SCAN_SUCCESS = 0 , NRF_SCAN_ERROR_PROTOCOL , NRF_SCAN_ERROR_BIT_STUFFING_ERROR , NRF_SCAN_ERROR_BIT0_ERROR ,
  NRF_SCAN_ERROR_BIT1_ERROR , NRF_SCAN_ERROR_FORM_ERROR , NRF_SCAN_ERROR_ACK_ERROR , NRF_SCAN_ERROR_CRC_ERROR ,
  NRF_SCAN_ERROR_BUSY , NRF_SCAN_ERROR_UNSUPPORTED , NRF_SCAN_ERROR_INVALID_PARAM , NRF_SCAN_ERROR_INVALID_STATE
}
 sCAN error code definitions More...
 
enum  nrf_scan_state_t {
  NRF_SCAN_STATE_ERROR_ACTIVE = 0 , NRF_SCAN_STATE_ERROR_WARNING , NRF_SCAN_STATE_ERROR_PASSIVE , NRF_SCAN_STATE_BUS_OFF ,
  NRF_SCAN_STATE_STOPPED
}
 sCAN state definitions More...
 

Functions

nrf_scan_status_t nrf_scan_get_status (nrf_scan_t const *p_scan)
 Get sCAN state and errors.
 
nrf_scan_error_t nrf_scan_init (nrf_scan_t const *p_scan, nrf_scan_event_handler_t handler, void *p_context)
 Initialize the sCAN driver for a given instance.
 
void nrf_scan_uninit (nrf_scan_t const *p_scan)
 Uninitialize the sCAN driver instance.
 
nrf_scan_error_t nrf_scan_enable (nrf_scan_t const *p_scan)
 Explicitly power up and configure the controller.
 
nrf_scan_error_t nrf_scan_disable (nrf_scan_t const *p_scan)
 Explicitly power down the controller.
 
nrf_scan_error_t nrf_scan_timing (nrf_scan_t const *p_scan, nrf_scan_timing_t const *p_timing)
 Configure sCAN timing.
 
nrf_scan_error_t nrf_scan_mode (nrf_scan_t const *p_scan, nrf_scan_mode_type_t *p_mode)
 Configure sCAN mode.
 
nrf_scan_error_t nrf_scan_set_rx_filter (nrf_scan_t const *p_scan, nrf_scan_rx_filter_t const *p_rxfilter, uint8_t index)
 Configure a sCAN RX filter.
 
nrf_scan_error_t nrf_scan_disable_rx_filter (nrf_scan_t const *p_scan, uint8_t index)
 Disable a sCAN RX filter.
 
nrf_scan_error_t nrf_scan_enable_rx_filter (nrf_scan_t const *p_scan, uint8_t index)
 Enable a sCAN RX filter.
 
nrf_scan_error_t nrf_scan_unlock_rx_mailbox (nrf_scan_t const *p_scan, uint8_t index)
 Unlock sCAN RX mailbox[index].
 
nrf_scan_error_t nrf_scan_send (nrf_scan_t const *p_scan, nrf_scan_frame_t *p_tx_frame)
 sCAN send function.
 
nrf_scan_error_t nrf_scan_abort (nrf_scan_t const *p_scan)
 Abort any ongoing sCAN operation.
 
void nrf_scan_irq_handler (void)
 IRQ handler to be called from the sCAN interrupt vector.
 

Variables

nrf_scan_rx_mailbox_t m_scan_rx_mailbox []
 sCAN RX mailbox.
 

Detailed Description

Soft CAN driver.

This API describes the driver operation of a Software CAN emulated in a VPR CPU. Based on CAN2.0A/B standard.

The functions in this driver are not reentrant if they operate on the same sCAN peripheral. It is the responsibility of the API user to ensure the functions are not preempted by each other. An exception is the callback function context. Multiple functions from this API can be called from the callback.

Note
The nrf_scan_irq_handler() function must be called from an external IRQ handler that has been properly registered with the interrupt controller system.
The GPIO pins required for sCAN operation must be properly configured by the user before initializing the driver with nrf_scan_init().