canfd6 2.0.0.0
|
API for configuring and manipulating CAN FD 6 Click driver. More...
Topics | |
CAN FD 6 Register address sections. | |
List of register address sections of CAN FD 6 Click driver. | |
CAN FD 6 SPI and device ID register addresses. | |
List of SPI registers and device ID register addresses of CAN FD 6 Click driver. | |
CAN FD 6 device configuration register addresses. | |
List of device configuration register addresses of CAN FD 6 Click driver. | |
CAN FD 6 MCAN register addresses. | |
List of MCAN register addresses of CAN FD 6 Click driver. | |
CAN FD 6 DLC value defines. | |
List of DLC value defines of CAN FD 6 Click driver. | |
CAN FD 6 test. | |
List of test cmd of CAN FD 6 Click driver. | |
CAN FD 6 CCCR bit masks. | |
List of CCCR bit masks of CAN FD 6 Click driver. | |
CAN FD 6 IE bits. | |
List of IE bits of CAN FD 6 Click driver. | |
CAN FD 6 IR bits. | |
List of IR bits of CAN FD 6 Click driver. | |
CAN FD 6 ILS bits. | |
List of ILS bits of CAN FD 6 Click driver. | |
CAN FD 6 ILE ( interrupt enable ). | |
List of ILE ( interrupt enable ) of CAN FD 6 Click driver. | |
CAN FD 6 GFC bits. | |
List of GFC bits of CAN FD 6 Click driver. | |
CAN FD 6 RXESC bits. | |
List of RXESC bits of CAN FD 6 Click driver. | |
CAN FD 6 TXESC bits. | |
List of TXESC bits of CAN FD 6 Click driver. | |
CAN FD 6 TSCC bits. | |
List of TSCC bits of CAN FD 6 Click driver. | |
CAN FD 6 TXBAR bits. | |
List of TXBAR bits of CAN FD 6 Click driver. | |
CAN FD 6 TXBCR bits. | |
List of TXBCR bits of CAN FD 6 Click driver. | |
CAN FD 6 TXBTIE bits. | |
List of TXBTIE bits of CAN FD 6 Click driver. | |
CAN FD 6 TXBCIE bits. | |
List of TXBCIE bits of CAN FD 6 Click driver. | |
CAN FD 6 device register bit field defines. | |
List of device register bit field defines of CAN FD 6 Click driver. | |
CAN FD 6 device interrupt register values. | |
List of device interrupt register values of CAN FD 6 Click driver. | |
CAN FD 6 device interrupt enable values. | |
List of device interrupt enable values of CAN FD 6 Click driver. | |
CAN FD 6 MikroBUS Map | |
MikroBUS pin mapping of CAN FD 6 Click driver. | |
Macros | |
#define | CANFD6_MCAN_CACHE_CONFIGURATION |
CAN FD 6 MCAN cache configuration. | |
#define | CANFD6_MCAN_CACHE_SIDFC 0 |
#define | CANFD6_MCAN_CACHE_XIDFC 1 |
#define | CANFD6_MCAN_CACHE_RXF0C 2 |
#define | CANFD6_MCAN_CACHE_RXF1C 3 |
#define | CANFD6_MCAN_CACHE_RXBC 4 |
#define | CANFD6_MCAN_CACHE_TXEFC 5 |
#define | CANFD6_MCAN_CACHE_TXBC 6 |
#define | CANFD6_MCAN_CACHE_RXESC 7 |
#define | CANFD6_MCAN_CACHE_TXESC 8 |
#define | CANFD6_MRAM_SIZE 2048 |
CAN FD 6 MRAM size. | |
#define | CANFD6_REG_BITS_MCAN_DBTP_TDC_EN 0x00800000 |
CAN FD 6 DBTP. | |
#define | CANFD6_REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE 0x80000000 |
CAN FD 6 MCAN RXF0C overwrite bit. | |
#define | CANFD6_REG_BITS_MCAN_TXBC_TFQM 0x40000000 |
CAN FD 6 TXBC bit. | |
Functions | |
void | canfd6_cfg_setup (canfd6_cfg_t *cfg) |
CAN FD 6 configuration object setup function. | |
err_t | canfd6_init (canfd6_t *ctx, canfd6_cfg_t *cfg) |
CAN FD 6 initialization function. | |
void | canfd6_default_cfg (canfd6_t *ctx) |
CAN FD 6 default configuration function. | |
void | canfd6_wkr_pin_state (canfd6_t *ctx, canfd6_pin_state_t state) |
CAN FD 6 wkr pin state function. | |
void | canfd6_rst_pin_state (canfd6_t *ctx, canfd6_pin_state_t state) |
CAN FD 6 rst pin state function. | |
void | canfd6_wkp_pin_state (canfd6_t *ctx, canfd6_pin_state_t state) |
CAN FD 6 wkp pin state function. | |
uint8_t | canfd6_get_int_pin (canfd6_t *ctx) |
CAN FD 6 get int pin function. | |
err_t | canfd6_enable_protected_registers (canfd6_t *ctx) |
CAN FD 6 enable protected registers function. | |
err_t | canfd6_disable_protected_registers (canfd6_t *ctx) |
CAN FD 6 disable protected registers function. | |
void | canfd6_configure_cccr_register (canfd6_t *ctx, canfd6_mcan_cccr_config_t *cccr_config) |
CAN FD 6 configure cccr register function. | |
void | canfd6_read_cccr_register (canfd6_t *ctx, canfd6_mcan_cccr_config_t *cccr_config) |
CAN FD 6 read cccr register function. | |
void | canfd6_mcan_read_datatimingfd_simple (canfd6_t *ctx, canfd6_mcan_data_timing_simple_t *data_timing) |
CAN FD 6 read data timing fd simple function. | |
void | canfd6_mcan_read_datatimingfd_raw (canfd6_t *ctx, canfd6_mcan_data_timing_raw_t *data_timing) |
CAN FD 6 read data timing fd raw function. | |
void | canfd6_mcan_configure_datatiming_simple (canfd6_t *ctx, canfd6_mcan_data_timing_simple_t *data_timing) |
CAN FD 6 configure data timing simple function. | |
void | canfd6_mcan_configure_datatiming_raw (canfd6_t *ctx, canfd6_mcan_data_timing_raw_t *data_timing) |
CAN FD 6 configure data timing raw function. | |
void | canfd6_mcan_read_nominaltiming_simple (canfd6_t *ctx, canfd6_mcan_nominal_timing_simple_t *nom_timing) |
CAN FD 6 read nominal timing simple function. | |
void | canfd6_mcan_read_nominaltiming_raw (canfd6_t *ctx, canfd6_mcan_nominal_timing_raw_t *nom_timing) |
CAN FD 6 read nominal timing raw function. | |
void | canfd6_mcan_configure_nominaltiming_simple (canfd6_t *ctx, canfd6_mcan_nominal_timing_simple_t *nom_timing) |
CAN FD 6 configure nominal timing simple function. | |
void | canfd6_mcan_configure_nominaltiming_raw (canfd6_t *ctx, canfd6_mcan_nominal_timing_raw_t *nom_timing) |
CAN FD 6 configure nominal timing raw function. | |
void | canfd6_mcan_configure_globalfilter (canfd6_t *ctx, canfd6_mcan_global_filter_configuration_t *gfc) |
CAN FD 6 configure global filter function. | |
err_t | canfd6_mram_configure (canfd6_t *ctx, canfd6_mram_config_t *mram_config) |
CAN FD 6 mram configure function. | |
void | canfd6_mram_clear (canfd6_t *ctx) |
CAN FD 6 mram clear function. | |
uint8_t | canfd6_mcan_read_nextfifo (canfd6_t *ctx, canfd6_mcan_fifo_enum_t fifo_def, canfd6_mcan_rx_header_t *header, uint8_t data_payload[]) |
CAN FD 6 read next fifo function. | |
uint8_t | canfd6_mcan_read_rxbuffer (canfd6_t *ctx, uint8_t buf_index, canfd6_mcan_rx_header_t *header, uint8_t data_payload[]) |
CAN FD 6 read rx buffer function. | |
uint32_t | canfd6_mcan_write_txbuffer (canfd6_t *ctx, uint8_t buf_index, canfd6_mcan_tx_header_t *header, uint8_t data_payload[]) |
CAN FD 6 write tx buffer function. | |
err_t | canfd6_mcan_transmit_buffer_contents (canfd6_t *ctx, uint8_t buf_index) |
CAN FD 6 transmit buffer contents function. | |
err_t | canfd6_mcan_write_sid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_sid_filter_t *filter) |
CAN FD 6 write sid filter function. | |
err_t | canfd6_mcan_read_sid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_sid_filter_t *filter) |
CAN FD 6 read sid filter function. | |
err_t | canfd6_mcan_write_xid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_xid_filter_t *filter) |
CAN FD 6 write xid filter function. | |
err_t | canfd6_mcan_read_xid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_xid_filter_t *filter) |
CAN FD 6 read xid filter function. | |
void | canfd6_mcan_read_interrupts (canfd6_t *ctx, canfd6_mcan_interrupts_t *ir) |
CAN FD 6 read interrupts function. | |
void | canfd6_mcan_clear_interrupts (canfd6_t *ctx, canfd6_mcan_interrupts_t *ir) |
CAN FD 6 clear interrupts function. | |
void | canfd6_mcan_clear_interrupts_all (canfd6_t *ctx) |
CAN FD 6 clear interrupts all function. | |
void | canfd6_mcan_read_interrupt_enable (canfd6_t *ctx, canfd6_mcan_interrupt_enable_t *ie) |
CAN FD 6 read interrupt enable function. | |
void | canfd6_mcan_configure_interrupt_enable (canfd6_t *ctx, canfd6_mcan_interrupt_enable_t *ie) |
CAN FD 6 configure interrupt enable function. | |
uint8_t | canfd6_mcan_dlc_to_bytes (uint8_t input_dlc) |
CAN FD 6 dlc to bytes function. | |
uint8_t | canfd6_mcan_txrxesc_data_byte_value (uint8_t input_esc_value) |
CAN FD 6 txrxesc data byte value function. | |
uint16_t | canfd6_device_read_version (canfd6_t *ctx) |
CAN FD 6 device read version function. | |
void | canfd6_device_configure (canfd6_t *ctx, canfd6_dev_config_t *dev_cfg) |
CAN FD 6 device configure function. | |
void | canfd6_device_read_config (canfd6_t *ctx, canfd6_dev_config_t *dev_cfg) |
CAN FD 6 device read config function. | |
void | canfd6_device_read_interrupts (canfd6_t *ctx, canfd6_device_interrupts_t *ir) |
CAN FD 6 device read interrupts function. | |
void | canfd6_device_clear_interrupts (canfd6_t *ctx, canfd6_device_interrupts_t *ir) |
CAN FD 6 device clear interrupts function. | |
void | canfd6_device_clear_interrupts_all (canfd6_t *ctx) |
CAN FD 6 device clear interrupts all function. | |
void | canfd6_device_clear_spierr (canfd6_t *ctx) |
CAN FD 6 device clear spierr function. | |
void | canfd6_device_read_interrupt_enable (canfd6_t *ctx, canfd6_device_interrupt_enable_t *ie) |
CAN FD 6 device read interrupt enable function. | |
void | canfd6_device_configure_ie (canfd6_t *ctx, canfd6_device_interrupt_enable_t *ie) |
CAN FD 6 device configure ie function. | |
err_t | canfd6_device_set_mode (canfd6_t *ctx, canfd6_device_mode_enum_t mode_define) |
CAN FD 6 device set mode function. | |
canfd6_device_mode_enum_t | canfd6_device_read_mode (canfd6_t *ctx) |
CAN FD 6 device read mode function. | |
err_t | canfd6_device_enable_testmode (canfd6_t *ctx, canfd6_device_test_mode_enum_t mode_define) |
CAN FD 6 device enable testmode function. | |
void | canfd6_device_disable_testmode (canfd6_t *ctx) |
CAN FD 6 device disable testmode function. | |
canfd6_device_test_mode_enum_t | canfd6_device_read_testmode (canfd6_t *ctx) |
CAN FD 6 device read testmode function. | |
err_t | canfd6_wdt_configure (canfd6_t *ctx, canfd6_wdt_timer_enum_t wdt_timeout) |
CAN FD 6 wdt configure function. | |
canfd6_wdt_timer_enum_t | canfd6_wdt_read (canfd6_t *ctx) |
CAN FD 6 wdt read function. | |
void | canfd6_wdt_enable (canfd6_t *ctx) |
CAN FD 6 wdt enable function. | |
void | canfd6_wdt_disable (canfd6_t *ctx) |
CAN FD 6 wdt disable function. | |
void | canfd6_wdt_reset (canfd6_t *ctx) |
CAN FD 6 wdt reset function. | |
API for configuring and manipulating CAN FD 6 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
#define CANFD6_MCAN_CACHE_CONFIGURATION |
CAN FD 6 MCAN cache configuration.
Define MCAN cache configuration to reduce the number of SPI reads necessary to send or receive a packet by caching certain values.
#define CANFD6_MCAN_CACHE_RXBC 4 |
#define CANFD6_MCAN_CACHE_RXESC 7 |
#define CANFD6_MCAN_CACHE_RXF0C 2 |
#define CANFD6_MCAN_CACHE_RXF1C 3 |
#define CANFD6_MCAN_CACHE_SIDFC 0 |
#define CANFD6_MCAN_CACHE_TXBC 6 |
#define CANFD6_MCAN_CACHE_TXEFC 5 |
#define CANFD6_MCAN_CACHE_TXESC 8 |
#define CANFD6_MCAN_CACHE_XIDFC 1 |
#define CANFD6_MRAM_SIZE 2048 |
CAN FD 6 MRAM size.
Specified MRAM size.
#define CANFD6_REG_BITS_MCAN_DBTP_TDC_EN 0x00800000 |
CAN FD 6 DBTP.
Data timing fd bit.
#define CANFD6_REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE 0x80000000 |
CAN FD 6 MCAN RXF0C overwrite bit.
Specified MCAN RXF0C overwrite bit.
#define CANFD6_REG_BITS_MCAN_TXBC_TFQM 0x40000000 |
CAN FD 6 TXBC bit.
Specified TXBC bit.
void canfd6_cfg_setup | ( | canfd6_cfg_t * | cfg | ) |
CAN FD 6 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See canfd6_cfg_t object definition for detailed explanation. |
void canfd6_configure_cccr_register | ( | canfd6_t * | ctx, |
canfd6_mcan_cccr_config_t * | cccr_config ) |
CAN FD 6 configure cccr register function.
This function configures the bits of the CCCR register to match the CCCR config struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | cccr_config | : Struct containing the configuration bits. |
void canfd6_default_cfg | ( | canfd6_t * | ctx | ) |
CAN FD 6 default configuration function.
This function executes a default configuration of CAN FD 6 click board.
[in] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_device_clear_interrupts | ( | canfd6_t * | ctx, |
canfd6_device_interrupts_t * | ir ) |
CAN FD 6 device clear interrupts function.
This function will attempt to clear any interrupts that are marked as a '1' in the passed struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | ir | : Struct containing the interrupt bit fields that will be updated. |
void canfd6_device_clear_interrupts_all | ( | canfd6_t * | ctx | ) |
CAN FD 6 device clear interrupts all function.
This function clears all device interrupts.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_device_clear_spierr | ( | canfd6_t * | ctx | ) |
CAN FD 6 device clear spierr function.
This function clears a SPIERR flag that may be set.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_device_configure | ( | canfd6_t * | ctx, |
canfd6_dev_config_t * | dev_cfg ) |
CAN FD 6 device configure function.
This function configures the device mode and pin register based on the dev config struct masking out the reserved bits on a write.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | dev_cfg | : Struct containing the desired device mode and pin register values. |
void canfd6_device_configure_ie | ( | canfd6_t * | ctx, |
canfd6_device_interrupt_enable_t * | ie ) |
CAN FD 6 device configure ie function.
This function configures the device interrupt enable register based on the passed struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | ie | : Struct containing the desired enabled interrupt bits. |
void canfd6_device_disable_testmode | ( | canfd6_t * | ctx | ) |
CAN FD 6 device disable testmode function.
This function disables the TCAN4550 device test mode.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
err_t canfd6_device_enable_testmode | ( | canfd6_t * | ctx, |
canfd6_device_test_mode_enum_t | mode_define ) |
CAN FD 6 device enable testmode function.
This function sets the TCAN4550 device test mode based on the input mode define enum.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | mode_define | : Mode define enum. |
0
- Success, -1
- Error.void canfd6_device_read_config | ( | canfd6_t * | ctx, |
canfd6_dev_config_t * | dev_cfg ) |
CAN FD 6 device read config function.
This function reads the device mode and pin register and updates the passed dev cfg struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | dev_cfg | : Struct containing the desired device mode and pin register values. |
void canfd6_device_read_interrupt_enable | ( | canfd6_t * | ctx, |
canfd6_device_interrupt_enable_t * | ie ) |
CAN FD 6 device read interrupt enable function.
This function reads the device interrupt enable register and updates the passed struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | ie | : Struct containing the interrupt bit fields that will be updated. |
void canfd6_device_read_interrupts | ( | canfd6_t * | ctx, |
canfd6_device_interrupts_t * | ir ) |
CAN FD 6 device read interrupts function.
This function reads the device interrupts and updates the device interrupts struct that is passed to the function.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | ir | : Struct containing the interrupt bit fields that will be updated. |
canfd6_device_mode_enum_t canfd6_device_read_mode | ( | canfd6_t * | ctx | ) |
CAN FD 6 device read mode function.
This function reads the TCAN4550 device mode and returns a mode define enum.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
canfd6_device_test_mode_enum_t canfd6_device_read_testmode | ( | canfd6_t * | ctx | ) |
CAN FD 6 device read testmode function.
This function reads the TCAN4550 device test mode.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
uint16_t canfd6_device_read_version | ( | canfd6_t * | ctx | ) |
CAN FD 6 device read version function.
This function reads the TCAN4550 device version register.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
err_t canfd6_device_set_mode | ( | canfd6_t * | ctx, |
canfd6_device_mode_enum_t | mode_define ) |
CAN FD 6 device set mode function.
This function sets the TCAN4550 device mode based on the input mode define enum.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | mode_define | : Mode define enum. |
0
- Success, -1
- Error.err_t canfd6_disable_protected_registers | ( | canfd6_t * | ctx | ) |
CAN FD 6 disable protected registers function.
This function attempts to disable CCCR.CCE and CCCR.INIT to disallow writes to protected registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t canfd6_enable_protected_registers | ( | canfd6_t * | ctx | ) |
CAN FD 6 enable protected registers function.
This function attempts to enable CCCR.CCE and CCCR.INIT to allow writes to protected registers, needed for MCAN configuration.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
0
- Success, -1
- Error.uint8_t canfd6_get_int_pin | ( | canfd6_t * | ctx | ) |
CAN FD 6 get int pin function.
This function checks the interrupt pin state.
[in] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
err_t canfd6_init | ( | canfd6_t * | ctx, |
canfd6_cfg_t * | cfg ) |
CAN FD 6 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See canfd6_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.void canfd6_mcan_clear_interrupts | ( | canfd6_t * | ctx, |
canfd6_mcan_interrupts_t * | ir ) |
CAN FD 6 clear interrupts function.
This function will attempt to clear any interrupts that are marked as a '1' in the passed mcan interrupt struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | ir | : Struct containing the interrupt bit fields that will be updated. |
void canfd6_mcan_clear_interrupts_all | ( | canfd6_t * | ctx | ) |
CAN FD 6 clear interrupts all function.
This function clears all MCAN interrupts.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_mcan_configure_datatiming_raw | ( | canfd6_t * | ctx, |
canfd6_mcan_data_timing_raw_t * | data_timing ) |
CAN FD 6 configure data timing raw function.
This function writes the data timing information to MCAN using the input from the data timing raw struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | data_timing | : Struct containing the raw data timing information. |
void canfd6_mcan_configure_datatiming_simple | ( | canfd6_t * | ctx, |
canfd6_mcan_data_timing_simple_t * | data_timing ) |
CAN FD 6 configure data timing simple function.
This function writes the data timing information to MCAN using the input from the data timing simple struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | data_timing | : Struct containing the simplified data timing information. |
void canfd6_mcan_configure_globalfilter | ( | canfd6_t * | ctx, |
canfd6_mcan_global_filter_configuration_t * | gfc ) |
CAN FD 6 configure global filter function.
This function configures the default behavior of the MCAN controller when receiving messages. This can include accepting or rejecting CAN messages by default. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | gfc | : Struct containing the global filter register values. |
void canfd6_mcan_configure_interrupt_enable | ( | canfd6_t * | ctx, |
canfd6_mcan_interrupt_enable_t * | ie ) |
CAN FD 6 configure interrupt enable function.
This function configures the MCAN interrupt enable register based on the passed struct. Also enables MCAN interrupts out to the INT1 pin.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | ie | : Struct containing the interrupt bit fields that will be updated. |
void canfd6_mcan_configure_nominaltiming_raw | ( | canfd6_t * | ctx, |
canfd6_mcan_nominal_timing_raw_t * | nom_timing ) |
CAN FD 6 configure nominal timing raw function.
This function writes the data timing information to MCAN using the input from the nominal timing raw struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | nom_timing | : Struct containing the raw nominal timing information. |
void canfd6_mcan_configure_nominaltiming_simple | ( | canfd6_t * | ctx, |
canfd6_mcan_nominal_timing_simple_t * | nom_timing ) |
CAN FD 6 configure nominal timing simple function.
This function writes the data timing information to MCAN using the input from the nominal timing simple struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | nom_timing | : Struct containing the simplified nominal timing information. |
uint8_t canfd6_mcan_dlc_to_bytes | ( | uint8_t | input_dlc | ) |
CAN FD 6 dlc to bytes function.
This function converts the CAN message DLC hex value to the number of bytes it corresponds to.
[in] | input_dlc | : DLC value from/to a CAN message struct. |
void canfd6_mcan_read_datatimingfd_raw | ( | canfd6_t * | ctx, |
canfd6_mcan_data_timing_raw_t * | data_timing ) |
CAN FD 6 read data timing fd raw function.
This function reads the MCAN data timing registers and updates the data timing raw struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | data_timing | : Struct containing the raw data timing information. |
void canfd6_mcan_read_datatimingfd_simple | ( | canfd6_t * | ctx, |
canfd6_mcan_data_timing_simple_t * | data_timing ) |
CAN FD 6 read data timing fd simple function.
This function reads the MCAN data timing registers and updates the data timing simple struct. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | data_timing | : Struct containing the simplified data timing information. |
void canfd6_mcan_read_interrupt_enable | ( | canfd6_t * | ctx, |
canfd6_mcan_interrupt_enable_t * | ie ) |
CAN FD 6 read interrupt enable function.
This function reads the MCAN interrupt enable register and updates the passed mcan interrupt enable struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | ie | : Struct containing the interrupt bit fields that will be updated. |
void canfd6_mcan_read_interrupts | ( | canfd6_t * | ctx, |
canfd6_mcan_interrupts_t * | ir ) |
CAN FD 6 read interrupts function.
Reads and updates the mcan interrupts struct that is passed to the function.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | ir | : Struct containing the interrupt bit fields that will be updated. |
uint8_t canfd6_mcan_read_nextfifo | ( | canfd6_t * | ctx, |
canfd6_mcan_fifo_enum_t | fifo_def, | ||
canfd6_mcan_rx_header_t * | header, | ||
uint8_t | data_payload[] ) |
CAN FD 6 read next fifo function.
This function will read the next MCAN FIFO element specified and return the corresponding header information and data payload. The start address of the elment is automatically calculated by looking at the MCAN's register that says where the next element to read exists.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | fifo_def | : Enum corresponding to either RXFIFO0 or RXFIFO1. |
[out] | header | : Struct containing the CAN-specific header information. |
[out] | data_payload[ | ] : Byte array that will be updated with the read data. |
void canfd6_mcan_read_nominaltiming_raw | ( | canfd6_t * | ctx, |
canfd6_mcan_nominal_timing_raw_t * | nom_timing ) |
CAN FD 6 read nominal timing raw function.
This function reads the MCAN nominal timing registers and updates the nominal timing raw struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | nom_timing | : Struct containing the raw nominal timing information. |
void canfd6_mcan_read_nominaltiming_simple | ( | canfd6_t * | ctx, |
canfd6_mcan_nominal_timing_simple_t * | nom_timing ) |
CAN FD 6 read nominal timing simple function.
This function reads the MCAN nominal timing registers and updates the nominal timing simple struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | nom_timing | : Struct containing the simplified nominal timing information. |
uint8_t canfd6_mcan_read_rxbuffer | ( | canfd6_t * | ctx, |
uint8_t | buf_index, | ||
canfd6_mcan_rx_header_t * | header, | ||
uint8_t | data_payload[] ) |
CAN FD 6 read rx buffer function.
This function will read the specified MCAN buffer element and return the corresponding header information and data payload. The start address of the element is automatically calculated.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | buf_index | : RX buffer index to read from (starts at 0). |
[out] | header | : Struct containing the CAN-specific header information. |
[out] | data_payload[ | ] : Byte array that will be updated with the read data. |
err_t canfd6_mcan_read_sid_filter | ( | canfd6_t * | ctx, |
uint8_t | filter_index, | ||
canfd6_mcan_sid_filter_t * | filter ) |
CAN FD 6 read sid filter function.
This function will read a standard ID MCAN filter from a specified filter element.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | filter_index | : SID filter index in MRAM to read from (starts at 0). |
[out] | filter | : Struct containing the MCAN filter information. |
0
- Success, -1
- Error.err_t canfd6_mcan_read_xid_filter | ( | canfd6_t * | ctx, |
uint8_t | filter_index, | ||
canfd6_mcan_xid_filter_t * | filter ) |
CAN FD 6 read xid filter function.
This function will read an extended ID MCAN filter from a specified filter element.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | filter_index | : XID filter index in MRAM to read from (starts at 0). |
[out] | filter | : Struct containing the MCAN filter information. |
0
- Success, -1
- Error.err_t canfd6_mcan_transmit_buffer_contents | ( | canfd6_t * | ctx, |
uint8_t | buf_index ) |
CAN FD 6 transmit buffer contents function.
This function writes the specified buffer index bit value into the TXBAR register to request a message to send.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | buf_index | : TX buffer index to write to (starts at 0). |
0
- Success, -1
- Error.uint8_t canfd6_mcan_txrxesc_data_byte_value | ( | uint8_t | input_esc_value | ) |
CAN FD 6 txrxesc data byte value function.
This function converts the MCAN ESC (Element Size) value to number of bytes that it corresponds to.
[in] | input_esc_value | : Value from an element size configuration register. |
err_t canfd6_mcan_write_sid_filter | ( | canfd6_t * | ctx, |
uint8_t | filter_index, | ||
canfd6_mcan_sid_filter_t * | filter ) |
CAN FD 6 write sid filter function.
This function will write a standard ID MCAN filter to a specified filter element.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | filter_index | : SID filter index in MRAM to write to (starts at 0). |
[in] | filter | : Struct containing the MCAN filter information. |
0
- Success, -1
- Error.uint32_t canfd6_mcan_write_txbuffer | ( | canfd6_t * | ctx, |
uint8_t | buf_index, | ||
canfd6_mcan_tx_header_t * | header, | ||
uint8_t | data_payload[] ) |
CAN FD 6 write tx buffer function.
This function will write a CAN message to a specified TX buffer that can be transmitted at a later time with the transmit buffer contents function.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | buf_index | : TX buffer index to write to (starts at 0). |
[in] | header | : Struct containing the CAN-specific header information. |
[in] | data_payload[ | ] : Byte array that will be updated with the read data. |
err_t canfd6_mcan_write_xid_filter | ( | canfd6_t * | ctx, |
uint8_t | filter_index, | ||
canfd6_mcan_xid_filter_t * | filter ) |
CAN FD 6 write xid filter function.
This function will write an extended ID MCAN filter to a specified filter element.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | filter_index | : XID filter index in MRAM to write to (starts at 0). |
[in] | filter | : Struct containing the MCAN filter information. |
0
- Success, -1
- Error.void canfd6_mram_clear | ( | canfd6_t * | ctx | ) |
CAN FD 6 mram clear function.
This function clears every address in MRAM. Useful for initializing the MRAM to known values during initial configuration so that accidental ECC errors do not happen.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
err_t canfd6_mram_configure | ( | canfd6_t * | ctx, |
canfd6_mram_config_t * | mram_config ) |
CAN FD 6 mram configure function.
This function uses the mram_config pointer to set up the various sections of the MRAM memory space. There are several different elements that may be configured in the MRAM, including their number of elements, as well as size of elements. This function will automatically generate the start addresses for each of the appropriate MRAM sections, attempting to place them immediately back-to-back. This function will check for over allocated memory conditions, and return error if this is found to be the case. This function writes to protected MCAN registers.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | mram_config | : Struct containing the desired MRAM configuration. |
0
- Success, -1
- Error.void canfd6_read_cccr_register | ( | canfd6_t * | ctx, |
canfd6_mcan_cccr_config_t * | cccr_config ) |
CAN FD 6 read cccr register function.
This function reads the MCAN CCCR configuration register and updates the MCAN CCCR Config struct.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[out] | cccr_config | : Struct containing the configuration bits. |
void canfd6_rst_pin_state | ( | canfd6_t * | ctx, |
canfd6_pin_state_t | state ) |
CAN FD 6 rst pin state function.
This function sets the pin state of the reset pin.
[in] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | state | : Pin state. |
err_t canfd6_wdt_configure | ( | canfd6_t * | ctx, |
canfd6_wdt_timer_enum_t | wdt_timeout ) |
CAN FD 6 wdt configure function.
This function configures the watchdog.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | wdt_timeout | : WDT timer enum of different times for the watch dog window. |
0
- Success, -1
- Error.void canfd6_wdt_disable | ( | canfd6_t * | ctx | ) |
CAN FD 6 wdt disable function.
This function disables the watchdog timer.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_wdt_enable | ( | canfd6_t * | ctx | ) |
CAN FD 6 wdt enable function.
This function enables the watchdog timer.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
canfd6_wdt_timer_enum_t canfd6_wdt_read | ( | canfd6_t * | ctx | ) |
CAN FD 6 wdt read function.
This function reads the watchdog configuration.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_wdt_reset | ( | canfd6_t * | ctx | ) |
CAN FD 6 wdt reset function.
This function resets the watchdog timer.
[out] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
void canfd6_wkp_pin_state | ( | canfd6_t * | ctx, |
canfd6_pin_state_t | state ) |
CAN FD 6 wkp pin state function.
This function sets the pin state of the wake pin.
[in] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | state | : Pin state. |
void canfd6_wkr_pin_state | ( | canfd6_t * | ctx, |
canfd6_pin_state_t | state ) |
CAN FD 6 wkr pin state function.
This function sets the pin state of the wake request pin.
[in] | ctx | : Click context object. See canfd6_t object definition for detailed explanation. |
[in] | state | : Pin state. |