mcp251863 2.0.0.0
MCP251863 Click Driver

API for configuring and manipulating MCP251863 Click driver. More...

Topics

 MCP251863 Registers List
 List of registers of MCP251863 Click driver.
 
 MCP251863 Registers Settings
 MCP251863 description register.
 
 MCP251863 MikroBUS Map
 MikroBUS pin mapping of MCP251863 Click driver.
 

Macros

#define MCP251863
 
#define REV_B
 MCP251863 Revision.
 
#define MCP251863_FIFO_08TO15_IMPLEMENTED
 MCP251863 Number of implemented FIFOs.
 
#define MCP251863_FIFO_16TO31_IMPLEMENTED
 
#define MCP251863_FILT_08TO15_IMPLEMENTED
 MCP251863 Number of implemented Filters.
 
#define MCP251863_FILT_16TO31_IMPLEMENTED
 
#define CAN_RESTRICTED_MODE_PRESENT
 MCP251863 Internal oscillator implemented.
 
#define CAN_TXQUEUE_IMPLEMENTED
 MCP251863 Transmit Queue.
 
#define N_MCP2518_CTRL_REGS   5
 MCP251863 Up to A1 silicon we had to multiply user address by 4.
 
#define MCP251863_MAX_TXQUEUE_ATTEMPTS   50
 
#define MCP251863_TX_REQUEST_ID   0x300
 
#define MCP251863_TX_RESPONSE_ID   0x301
 
#define MCP251863_CRCBASE   0xFFFF
 
#define MCP251863_CRCUPPER   1
 
#define MCP251863_DRV_CANFDSPI_INDEX_0   0
 
#define MCP251863_SPI_DEFAULT_BUFFER_LENGTH   96
 
#define MCP251863_ISO_CRC   1
 
#define MCP251863_MAX_MSG_SIZE   76
 
#define MCP251863_MAX_DATA_BYTES   64
 
#define MCP251863_INS_RESET   0x00
 
#define MCP251863_INS_READ   0x03
 
#define MCP251863_INS_READ_CRC   0x0B
 
#define MCP251863_INS_WRITE   0x02
 
#define MCP251863_INS_WRITE_CRC   0x0A
 
#define MCP251863_INS_WRITE_SAFE   0x0C
 
#define MCP251863_FIFO_OFFSET   ( 3 * 4 )
 
#define MCP251863_FILTER_OFFSET   ( 2 * 4 )
 
#define MCP251863_REG_CITXQCON   0x050
 
#define MCP251863_REG_CITXQSTA   0x054
 
#define MCP251863_REG_CITXQUA   0x058
 
#define MCP251863_REG_CIFLTCON   ( MCP251863_REG_CIFIFOCON + ( MCP251863_FIFO_OFFSET * MCP251863_FIFO_TOTAL_CHANNELS ) )
 
#define MCP251863_REG_CIFLTOBJ   ( MCP251863_REG_CIFLTCON + MCP251863_FIFO_TOTAL_CHANNELS )
 
#define MCP251863_REG_CIMASK   ( MCP251863_REG_CIFLTOBJ + 4 )
 
#define MCP251863_REG_OSC   0xE00
 
#define MCP251863_REG_IOCON   0xE04
 
#define MCP251863_REG_CRC   0xE08
 
#define MCP251863_REG_ECCCON   0xE0C
 
#define MCP251863_REG_ECCSTA   0xE10
 
#define MCP251863_RAM_SIZE   2048
 
#define MCP251863_RAMADDR_START   0x400
 
#define MCP251863_RAMADDR_END   ( MCP251863_RAMADDR_START + MCP251863_RAM_SIZE )
 
#define MCP251863_LOW_POWER_MODE_EN   0x08
 
#define MCP251863_LOW_POWER_MODE_DIS   0x00
 
#define MCP251863_WAKEUP_INTERR_EN   0x40
 
#define MCP251863_REG_CICON   0x000
 
#define MCP251863_REG_CINBTCFG   0x004
 
#define MCP251863_REG_CIDBTCFG   0x008
 
#define MCP251863_REG_CITDC   0x00C
 
#define MCP251863_REG_CITBC   0x010
 
#define MCP251863_REG_CITSCON   0x014
 
#define MCP251863_REG_CIVEC   0x018
 
#define MCP251863_REG_CIINT   0x01C
 
#define MCP251863_REG_CIINTFLAG   MCP251863_REG_CIINT
 
#define MCP251863_REG_CIINTENABLE   ( MCP251863_REG_CIINT + 2 )
 
#define MCP251863_REG_CIRXIF   0x020
 
#define MCP251863_REG_CITXIF   0x024
 
#define MCP251863_REG_CIRXOVIF   0x028
 
#define MCP251863_REG_CITXATIF   0x02C
 
#define MCP251863_REG_CITXREQ   0x030
 
#define MCP251863_REG_CITREC   0x034
 
#define MCP251863_REG_CIBDIAG0   0x038
 
#define MCP251863_REG_CIBDIAG1   0x03C
 
#define MCP251863_REG_CITEFCON   0x040
 
#define MCP251863_REG_CITEFSTA   0x044
 
#define MCP251863_REG_CITEFUA   0x048
 
#define MCP251863_REG_CIFIFOBA   0x04C
 
#define MCP251863_REG_CIFIFOCON   0x050
 
#define MCP251863_REG_CIFIFOSTA   0x054
 
#define MCP251863_REG_CIFIFOUA   0x058
 

Functions

void mcp251863_cfg_setup (mcp251863_cfg_t *cfg)
 MCP251863 configuration object setup function.
 
err_t mcp251863_init (mcp251863_t *ctx, mcp251863_cfg_t *cfg)
 MCP251863 initialization function.
 
err_t mcp251863_default_cfg (mcp251863_t *ctx)
 MCP251863 default configuration function.
 
err_t mcp251863_generic_write (mcp251863_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 MCP251863 data writing function.
 
err_t mcp251863_generic_read (mcp251863_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 MCP251863 data reading function.
 
err_t mcp251863_transmit_message (mcp251863_t *ctx, uint8_t *data_in, uint16_t data_len)
 Message Transmit function.
 
err_t mcp251863_receive_message (mcp251863_t *ctx, uint8_t *data_out, uint16_t *data_len)
 Message Receive function.
 
err_t mcp251863_reset (mcp251863_t *ctx)
 Reset function.
 
err_t mcp251863_read_byte (mcp251863_t *ctx, uint16_t address, uint8_t *data_out)
 SPI Read Byte function.
 
err_t mcp251863_write_byte (mcp251863_t *ctx, uint16_t address, uint8_t data_in)
 SPI Write Byte.
 
err_t mcp251863_read_word (mcp251863_t *ctx, uint16_t address, uint32_t *data_out)
 SPI Read Word.
 
err_t mcp251863_write_word (mcp251863_t *ctx, uint16_t address, uint32_t data_in)
 SPI Write Word.
 
err_t mcp251863_read_half_word (mcp251863_t *ctx, uint16_t address, uint16_t *data_out)
 SPI Read Half Word.
 
err_t mcp251863_write_half_word (mcp251863_t *ctx, uint16_t address, uint16_t data_in)
 SPI Write Half Word.
 
err_t mcp251863_write_byte_safe (mcp251863_t *ctx, uint16_t address, uint8_t data_in)
 SPI SFR Write Byte Safe.
 
err_t mcp251863_write_word_safe (mcp251863_t *ctx, uint16_t address, uint32_t data_in)
 SPI RAM Write Word Safe.
 
err_t mcp251863_read_byte_array (mcp251863_t *ctx, uint16_t address, uint8_t *data_out, uint16_t n_bytes)
 SPI Read Byte Array.
 
err_t mcp251863_read_byte_array_with_crc (mcp251863_t *ctx, bool from_ram, bool *crc_is_correct)
 SPI Read Byte Array with CRC.
 
err_t mcp251863_write_byte_array (mcp251863_t *ctx, uint16_t address, uint8_t *data_in, uint16_t n_bytes)
 SPI Write Byte Array.
 
err_t mcp251863_write_byte_array_with_crc (mcp251863_t *ctx, bool from_ram)
 SPI Write Byte Array with CRC.
 
err_t mcp251863_read_word_array (mcp251863_t *ctx, uint16_t address, uint32_t *data_out, uint16_t n_words)
 SPI Read Word Array.
 
err_t mcp251863_write_word_array (mcp251863_t *ctx, uint16_t address, uint32_t *data_in, uint16_t n_words)
 SPI Write Word Array.
 
err_t mcp251863_configure (mcp251863_t *ctx, mcp251863_can_cfg_t *config)
 CAN Control register configuration.
 
void mcp251863_configure_object_reset (mcp251863_can_cfg_t *config)
 Reset Configure object to reset values.
 
err_t mcp251863_operation_mode_select (mcp251863_t *ctx, uint8_t op_mode)
 Select Operation Mode.
 
err_t mcp251863_operation_mode_get (mcp251863_t *ctx)
 Get Operation Mode.
 
err_t mcp251863_transmit_channel_configure (mcp251863_t *ctx, uint8_t channel, mcp251863_tx_fifo_cfg_t *config)
 Configure Transmit FIFO.
 
void mcp251863_transmit_channel_configure_object_reset (mcp251863_tx_fifo_cfg_t *config)
 Reset Transmit Channel Configure object to reset values.
 
err_t mcp251863_transmit_queue_configure (mcp251863_t *ctx, mcp251863_tx_que_cfg_t *config)
 Configure Transmit Queue.
 
void mcp251863_transmit_queue_configure_object_reset (mcp251863_tx_que_cfg_t *config)
 Reset Transmit Queue Configure object to reset values.
 
err_t mcp251863_transmit_channel_load (mcp251863_t *ctx, uint8_t channel, mcp251863_tx_msg_obj_t *tx_obj, bool flush)
 TX Channel Load.
 
err_t mcp251863_transmit_channel_flush (mcp251863_t *ctx, uint8_t channel)
 TX Channel Flush.
 
err_t mcp251863_transmit_channel_status_get (mcp251863_t *ctx, uint8_t channel, uint16_t *status)
 Transmit Channel Status Get.
 
int8_t mcp251863_transmit_channel_reset (mcp251863_t *ctx, uint8_t channel)
 Transmit FIFO Reset.
 
err_t mcp251863_transmit_channel_update (mcp251863_t *ctx, uint8_t channel, bool flush)
 Transmit FIFO Update.
 
err_t mcp251863_transmit_request_set (mcp251863_t *ctx, uint32_t tx_req)
 Request transmissions using TXREQ register.
 
err_t mcp251863_transmit_request_get (mcp251863_t *ctx, uint32_t *tx_req)
 Get TXREQ register.
 
err_t mcp251863_transmit_channel_abort (mcp251863_t *ctx, uint8_t channel)
 Abort transmission of single FIFO.
 
err_t mcp251863_transmit_abort_all (mcp251863_t *ctx)
 Abort All transmissions.
 
err_t mcp251863_transmit_band_width_sharing_set (mcp251863_t *ctx, uint8_t tx_bws)
 Set Transmit Bandwidth Sharing Delay.
 
err_t mcp251863_filter_object_configure (mcp251863_t *ctx, uint8_t filter, mcp251863_filt_obj_id_t *id)
 Filter Object Configuration.
 
err_t mcp251863_filter_mask_configure (mcp251863_t *ctx, uint8_t filter, mcp251863_mask_obj_id_t *mask)
 Filter Mask Configuration.
 
err_t mcp251863_filter_to_fifo_link (mcp251863_t *ctx, uint8_t filter, uint8_t channel, bool enable)
 Link Filter to FIFO.
 
err_t mcp251863_filter_enable (mcp251863_t *ctx, uint8_t filter)
 Filter Enable.
 
err_t mcp251863_filter_disable (mcp251863_t *ctx, uint8_t filter)
 Filter Disable.
 
err_t mcp251863_device_net_filter_count_set (mcp251863_t *ctx, uint8_t dnfc)
 Set Device Net Filter Count.
 
err_t mcp251863_receive_channel_configure (mcp251863_t *ctx, uint8_t channel, mcp251863_rx_fifo_cfg_t *config)
 Configure Receive FIFO.
 
void mcp251863_receive_channel_configure_object_reset (mcp251863_rx_fifo_cfg_t *config)
 Reset Receive Channel Configure object to reset value.
 
err_t mcp251863_receive_channel_status_get (mcp251863_t *ctx, uint8_t channel, uint8_t *status)
 Receive Channel Status Get.
 
err_t mcp251863_receive_message_get (mcp251863_t *ctx, uint8_t channel, mcp251863_rx_msg_obj_t *rx_obj)
 Get Received Message.
 
err_t mcp251863_receive_channel_reset (mcp251863_t *ctx, uint8_t channel)
 Receive FIFO Reset.
 
err_t mcp251863_receive_channel_update (mcp251863_t *ctx, uint8_t channel)
 Receive FIFO Update.
 
err_t mcp251863_tef_status_get (mcp251863_t *ctx, uint8_t *status)
 Transmit Event FIFO Status Get.
 
err_t mcp251863_tef_message_get (mcp251863_t *ctx, mcp251863_tef_msg_obj_t *tef_obj)
 Get Transmit Event FIFO Message.
 
err_t mcp251863_tef_reset (mcp251863_t *ctx)
 Transmit Event FIFO Reset.
 
err_t mcp251863_tef_update (mcp251863_t *ctx)
 Transmit Event FIFO Update.
 
err_t mcp251863_tef_configure (mcp251863_t *ctx, mcp251863_tef_cfg_t *config)
 Configure Transmit Event FIFO.
 
void mcp251863_tef_configure_object_reset (mcp251863_tef_cfg_t *config)
 Reset TefConfigure object to reset value.
 
err_t mcp251863_module_event_get (mcp251863_t *ctx, uint16_t *flags)
 Module Event Get.
 
err_t mcp251863_module_event_enable (mcp251863_t *ctx, uint16_t flags)
 Module Event Enable.
 
err_t mcp251863_module_event_disable (mcp251863_t *ctx, uint16_t flags)
 Module Event Disable.
 
err_t mcp251863_module_event_clear (mcp251863_t *ctx, uint16_t flags)
 Module Event Clear.
 
err_t mcp251863_module_event_rx_code_get (mcp251863_t *ctx, uint8_t *rx_code)
 Get RX Code.
 
err_t mcp251863_module_event_tx_code_get (mcp251863_t *ctx, uint8_t *tx_code)
 Get TX Code.
 
err_t mcp251863_module_event_filter_hit_get (mcp251863_t *ctx, uint8_t *filter_hit)
 Get Filter Hit.
 
err_t mcp251863_module_event_icode_get (mcp251863_t *ctx, uint8_t *icode)
 Get ICODE.
 
err_t mcp251863_transmit_channel_event_get (mcp251863_t *ctx, uint8_t channel, uint8_t *flags)
 Transmit FIFO Event Get.
 
err_t mcp251863_transmit_event_get (mcp251863_t *ctx, uint32_t *txif)
 Get pending interrupts of all transmit FIFOs.
 
err_t mcp251863_transmit_event_attempt_get (mcp251863_t *ctx, uint32_t *txatif)
 Get pending TXATIF of all transmit FIFOs.
 
err_t mcp251863_transmit_channel_index_get (mcp251863_t *ctx, uint8_t channel, uint8_t *idx)
 Transmit FIFO Index Get.
 
err_t mcp251863_transmit_channel_event_enable (mcp251863_t *ctx, uint8_t channel, uint8_t flags)
 Transmit FIFO Event Enable.
 
err_t mcp251863_transmit_channel_event_disable (mcp251863_t *ctx, uint8_t channel, uint8_t flags)
 Transmit FIFO Event Disable.
 
err_t mcp251863_transmit_channel_event_attempt_clear (mcp251863_t *ctx, uint8_t channel)
 Transmit FIFO Event Clear.
 
err_t mcp251863_receive_channel_event_get (mcp251863_t *ctx, uint8_t channel, uint8_t *flags)
 Receive FIFO Event Get.
 
err_t mcp251863_receive_event_get (mcp251863_t *ctx, uint32_t *rxif)
 Get pending interrupts of all receive FIFOs.
 
err_t mcp251863_receive_event_overflow_get (mcp251863_t *ctx, uint32_t *rxovif)
 Get pending RXOVIF of all receive FIFOs.
 
int8_t mcp251863_receive_channel_index_get (mcp251863_t *ctx, uint8_t channel, uint8_t *idx)
 Receive FIFO Index Get.
 
err_t mcp251863_receive_channel_event_enable (mcp251863_t *ctx, uint8_t channel, uint8_t flags)
 Receive FIFO Event Enable.
 
err_t mcp251863_receive_channel_event_disable (mcp251863_t *ctx, uint8_t channel, uint8_t flags)
 Receive FIFO Event Disable.
 
err_t mcp251863_receive_channel_event_overflow_clear (mcp251863_t *ctx, uint8_t channel)
 Receive FIFO Event Clear.
 
err_t mcp251863_tef_event_get (mcp251863_t *ctx, uint8_t *flags)
 Transmit Event FIFO Event Get.
 
err_t mcp251863_tef_event_enable (mcp251863_t *ctx, uint8_t flags)
 Transmit Event FIFO Event Enable.
 
err_t mcp251863_tef_event_disable (mcp251863_t *ctx, uint8_t flags)
 Transmit Event FIFO Event Disable.
 
err_t mcp251863_tef_event_overflow_clear (mcp251863_t *ctx)
 Transmit Event FIFO Event Clear.
 
err_t mcp251863_error_count_transmit_get (mcp251863_t *ctx, uint8_t *tec)
 Transmit Error Count Get.
 
err_t mcp251863_error_count_receive_get (mcp251863_t *ctx, uint8_t *rec)
 Receive Error Count Get.
 
err_t mcp251863_error_state_get (mcp251863_t *ctx, uint8_t *flags)
 Error State Get.
 
err_t mcp251863_error_count_state_get (mcp251863_t *ctx, uint8_t *tec, uint8_t *rec, uint8_t *flags)
 Error Counts and Error State Get.
 
err_t mcp251863_bus_diagnostics_get (mcp251863_t *ctx, mcp251863_bus_diag_t *bus_diag)
 Get Bus Diagnostic Registers: all data_ at once, since we want to keep them in synch.
 
err_t mcp251863_bus_diagnostics_clear (mcp251863_t *ctx)
 Clear Bus Diagnostic Registers.
 
err_t mcp251863_ecc_enable (mcp251863_t *ctx)
 Enable ECC.
 
err_t mcp251863_ecc_disable (mcp251863_t *ctx)
 Disable ECC.
 
err_t mcp251863_ecc_event_get (mcp251863_t *ctx, uint8_t *flags)
 ECC Event Get.
 
err_t mcp251863_ecc_parity_set (mcp251863_t *ctx, uint8_t parity)
 Set ECC Parity.
 
err_t mcp251863_ecc_parity_get (mcp251863_t *ctx, uint8_t *parity)
 Get ECC Parity.
 
err_t mcp251863_ecc_error_address_get (mcp251863_t *ctx, uint16_t *address)
 Get ECC Error Address.
 
err_t mcp251863_ecc_event_enable (mcp251863_t *ctx, uint8_t flags)
 ECC Event Enable.
 
err_t mcp251863_ecc_event_disable (mcp251863_t *ctx, uint8_t flags)
 ECC Event Disable.
 
err_t mcp251863_ecc_event_clear (mcp251863_t *ctx, uint8_t flags)
 ECC Event Clear.
 
err_t mcp251863_crc_event_enable (mcp251863_t *ctx, uint8_t flags)
 CRC Event Enable.
 
err_t mcp251863_crc_event_disable (mcp251863_t *ctx, uint8_t flags)
 CRC Event Disnable.
 
err_t mcp251863_crc_event_clear (mcp251863_t *ctx, uint8_t flags)
 CRC Event Clear.
 
err_t mcp251863_crc_event_get (mcp251863_t *ctx, uint8_t *flags)
 CRC Event Get.
 
err_t mcp251863_crc_value_get (mcp251863_t *ctx, uint16_t *crc)
 Get CRC Value from device.
 
err_t mcp251863_ram_init (mcp251863_t *ctx, uint8_t rx_data)
 Initialize RAM.
 
err_t mcp251863_time_stamp_enable (mcp251863_t *ctx)
 Time Stamp Enable.
 
err_t mcp251863_time_stamp_disable (mcp251863_t *ctx)
 Time Stamp Disable.
 
err_t mcp251863_time_stamp_get (mcp251863_t *ctx, uint32_t *time_stamp)
 Time Stamp Get.
 
err_t mcp251863_time_stamp_set (mcp251863_t *ctx, uint32_t ts)
 Time Stamp Set.
 
err_t mcp251863_time_stamp_mode_configure (mcp251863_t *ctx, uint8_t mode)
 Time Stamp Mode Configure.
 
err_t mcp251863_time_stamp_prescaler_set (mcp251863_t *ctx, uint16_t time_stamp)
 Time Stamp Prescaler Set.
 
err_t mcp251863_oscillator_enable (mcp251863_t *ctx)
 Enable oscillator to wake-up from sleep.
 
err_t mcp251863_oscillator_control_set (mcp251863_t *ctx, mcp251863_div_ctl_t ctrl)
 Set Oscillator Control.
 
void mcp251863_oscillator_control_object_reset (mcp251863_div_ctl_t *ctrl)
 Reset Oscillator Control.
 
err_t mcp251863_oscillator_status_get (mcp251863_t *ctx, mcp251863_osc_sta_t *status)
 Get Oscillator Status.
 
err_t mcp251863_bit_time_configure (mcp251863_t *ctx, uint8_t bit_time, uint8_t clk)
 Configure Bit Time registers (based on CAN clock speed).
 
err_t mcp251863_bit_time_configure_nominal_40_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Nominal bit time for 40MHz system clock.
 
err_t mcp251863_bit_time_configure_data_40_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Data bit time for 40MHz system clock.
 
err_t mcp251863_bit_time_configure_nominal_20_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Nominal bit time for 20MHz system clock.
 
err_t mcp251863_bit_time_configure_data_20_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Nominal bit time for 20MHz system clock.
 
err_t mcp251863_bit_time_configure_nominal_10_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Nominal bit time for 10MHz system clock.
 
err_t mcp251863_bit_time_configure_data_10_mhz (mcp251863_t *ctx, uint8_t bit_time)
 Configure Data bit time for 10MHz system clock.
 
err_t mcp251863_gpio_mode_configure (mcp251863_t *ctx, uint8_t gpio0, uint8_t gpio1)
 Initialize GPIO Mode.
 
err_t mcp251863_gpio_direction_configure (mcp251863_t *ctx, uint8_t gpio0, uint8_t gpio1)
 Initialize GPIO Direction.
 
err_t mcp251863_gpio_standby_control_enable (mcp251863_t *ctx)
 Enable Transceiver Standby Control.
 
err_t mcp251863_gpio_standby_control_disable (mcp251863_t *ctx)
 Disable Transceiver Standby Control.
 
err_t mcp251863_gpio_interrupt_pins_open_drain_configure (mcp251863_t *ctx, uint8_t mode)
 Configure Open Drain Interrupts.
 
err_t mcp251863_gpio_transmit_pin_open_drain_configure (mcp251863_t *ctx, uint8_t mode)
 Configure Open Drain TXCAN.
 
err_t mcp251863_gpio_pin_set (mcp251863_t *ctx, uint8_t pos, uint8_t latch)
 GPIO Output Pin Set.
 
err_t mcp251863_gpio_pin_read (mcp251863_t *ctx, uint8_t pos, uint8_t *state)
 Input Pin Read.
 
err_t mcp251863_gpio_clock_output_configure (mcp251863_t *ctx, int8_t mode)
 Configure CLKO Pin.
 
uint32_t mcp251863_dlc_to_data_bytes (uint8_t dlc)
 DLC to number of actual data_bytes conversion.
 
err_t mcp251863_fifo_index_get (mcp251863_t *ctx, uint8_t channel, uint8_t *data_out)
 FIFO Index Get.
 
uint16_t mcp251863_calculate_crc16 (uint8_t *data_pointer, uint16_t size)
 Calculate CRC16.
 
uint8_t mcp251863_data_bytes_to_dlc (uint8_t num)
 Data bytes to DLC conversion.
 

Detailed Description

API for configuring and manipulating MCP251863 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Macro Definition Documentation

◆ CAN_RESTRICTED_MODE_PRESENT

#define CAN_RESTRICTED_MODE_PRESENT

MCP251863 Internal oscillator implemented.

Specified setting for Internal oscillator implemented of MCP251863 Click driver.

MCP251863 Restricted Operation Mode implemented.

Specified setting for restricted operation mode implemented of MCP251863 Click driver.

◆ CAN_TXQUEUE_IMPLEMENTED

#define CAN_TXQUEUE_IMPLEMENTED

MCP251863 Transmit Queue.

Specified setting for transmit queue of MCP251863 Click driver.

◆ MCP251863

#define MCP251863

◆ MCP251863_CRCBASE

#define MCP251863_CRCBASE   0xFFFF

◆ MCP251863_CRCUPPER

#define MCP251863_CRCUPPER   1

◆ MCP251863_DRV_CANFDSPI_INDEX_0

#define MCP251863_DRV_CANFDSPI_INDEX_0   0

◆ MCP251863_FIFO_08TO15_IMPLEMENTED

#define MCP251863_FIFO_08TO15_IMPLEMENTED

MCP251863 Number of implemented FIFOs.

Specified setting for number of implemented FIFOs of MCP251863 Click driver.

◆ MCP251863_FIFO_16TO31_IMPLEMENTED

#define MCP251863_FIFO_16TO31_IMPLEMENTED

◆ MCP251863_FIFO_OFFSET

#define MCP251863_FIFO_OFFSET   ( 3 * 4 )

◆ MCP251863_FILT_08TO15_IMPLEMENTED

#define MCP251863_FILT_08TO15_IMPLEMENTED

MCP251863 Number of implemented Filters.

Specified setting for number of implemented Filters of MCP251863 Click driver.

◆ MCP251863_FILT_16TO31_IMPLEMENTED

#define MCP251863_FILT_16TO31_IMPLEMENTED

◆ MCP251863_FILTER_OFFSET

#define MCP251863_FILTER_OFFSET   ( 2 * 4 )

◆ MCP251863_INS_READ

#define MCP251863_INS_READ   0x03

◆ MCP251863_INS_READ_CRC

#define MCP251863_INS_READ_CRC   0x0B

◆ MCP251863_INS_RESET

#define MCP251863_INS_RESET   0x00

◆ MCP251863_INS_WRITE

#define MCP251863_INS_WRITE   0x02

◆ MCP251863_INS_WRITE_CRC

#define MCP251863_INS_WRITE_CRC   0x0A

◆ MCP251863_INS_WRITE_SAFE

#define MCP251863_INS_WRITE_SAFE   0x0C

◆ MCP251863_ISO_CRC

#define MCP251863_ISO_CRC   1

◆ MCP251863_LOW_POWER_MODE_DIS

#define MCP251863_LOW_POWER_MODE_DIS   0x00

◆ MCP251863_LOW_POWER_MODE_EN

#define MCP251863_LOW_POWER_MODE_EN   0x08

◆ MCP251863_MAX_DATA_BYTES

#define MCP251863_MAX_DATA_BYTES   64

◆ MCP251863_MAX_MSG_SIZE

#define MCP251863_MAX_MSG_SIZE   76

◆ MCP251863_MAX_TXQUEUE_ATTEMPTS

#define MCP251863_MAX_TXQUEUE_ATTEMPTS   50

◆ MCP251863_RAM_SIZE

#define MCP251863_RAM_SIZE   2048

◆ MCP251863_RAMADDR_END

#define MCP251863_RAMADDR_END   ( MCP251863_RAMADDR_START + MCP251863_RAM_SIZE )

◆ MCP251863_RAMADDR_START

#define MCP251863_RAMADDR_START   0x400

◆ MCP251863_REG_CIBDIAG0

#define MCP251863_REG_CIBDIAG0   0x038

◆ MCP251863_REG_CIBDIAG1

#define MCP251863_REG_CIBDIAG1   0x03C

◆ MCP251863_REG_CICON

#define MCP251863_REG_CICON   0x000

◆ MCP251863_REG_CIDBTCFG

#define MCP251863_REG_CIDBTCFG   0x008

◆ MCP251863_REG_CIFIFOBA

#define MCP251863_REG_CIFIFOBA   0x04C

◆ MCP251863_REG_CIFIFOCON

#define MCP251863_REG_CIFIFOCON   0x050

◆ MCP251863_REG_CIFIFOSTA

#define MCP251863_REG_CIFIFOSTA   0x054

◆ MCP251863_REG_CIFIFOUA

#define MCP251863_REG_CIFIFOUA   0x058

◆ MCP251863_REG_CIFLTCON

#define MCP251863_REG_CIFLTCON   ( MCP251863_REG_CIFIFOCON + ( MCP251863_FIFO_OFFSET * MCP251863_FIFO_TOTAL_CHANNELS ) )

◆ MCP251863_REG_CIFLTOBJ

#define MCP251863_REG_CIFLTOBJ   ( MCP251863_REG_CIFLTCON + MCP251863_FIFO_TOTAL_CHANNELS )

◆ MCP251863_REG_CIINT

#define MCP251863_REG_CIINT   0x01C

◆ MCP251863_REG_CIINTENABLE

#define MCP251863_REG_CIINTENABLE   ( MCP251863_REG_CIINT + 2 )

◆ MCP251863_REG_CIINTFLAG

#define MCP251863_REG_CIINTFLAG   MCP251863_REG_CIINT

◆ MCP251863_REG_CIMASK

#define MCP251863_REG_CIMASK   ( MCP251863_REG_CIFLTOBJ + 4 )

◆ MCP251863_REG_CINBTCFG

#define MCP251863_REG_CINBTCFG   0x004

◆ MCP251863_REG_CIRXIF

#define MCP251863_REG_CIRXIF   0x020

◆ MCP251863_REG_CIRXOVIF

#define MCP251863_REG_CIRXOVIF   0x028

◆ MCP251863_REG_CITBC

#define MCP251863_REG_CITBC   0x010

◆ MCP251863_REG_CITDC

#define MCP251863_REG_CITDC   0x00C

◆ MCP251863_REG_CITEFCON

#define MCP251863_REG_CITEFCON   0x040

◆ MCP251863_REG_CITEFSTA

#define MCP251863_REG_CITEFSTA   0x044

◆ MCP251863_REG_CITEFUA

#define MCP251863_REG_CITEFUA   0x048

◆ MCP251863_REG_CITREC

#define MCP251863_REG_CITREC   0x034

◆ MCP251863_REG_CITSCON

#define MCP251863_REG_CITSCON   0x014

◆ MCP251863_REG_CITXATIF

#define MCP251863_REG_CITXATIF   0x02C

◆ MCP251863_REG_CITXIF

#define MCP251863_REG_CITXIF   0x024

◆ MCP251863_REG_CITXQCON

#define MCP251863_REG_CITXQCON   0x050

◆ MCP251863_REG_CITXQSTA

#define MCP251863_REG_CITXQSTA   0x054

◆ MCP251863_REG_CITXQUA

#define MCP251863_REG_CITXQUA   0x058

◆ MCP251863_REG_CITXREQ

#define MCP251863_REG_CITXREQ   0x030

◆ MCP251863_REG_CIVEC

#define MCP251863_REG_CIVEC   0x018

◆ MCP251863_REG_CRC

#define MCP251863_REG_CRC   0xE08

◆ MCP251863_REG_ECCCON

#define MCP251863_REG_ECCCON   0xE0C

◆ MCP251863_REG_ECCSTA

#define MCP251863_REG_ECCSTA   0xE10

◆ MCP251863_REG_IOCON

#define MCP251863_REG_IOCON   0xE04

◆ MCP251863_REG_OSC

#define MCP251863_REG_OSC   0xE00

◆ MCP251863_SPI_DEFAULT_BUFFER_LENGTH

#define MCP251863_SPI_DEFAULT_BUFFER_LENGTH   96

◆ MCP251863_TX_REQUEST_ID

#define MCP251863_TX_REQUEST_ID   0x300

◆ MCP251863_TX_RESPONSE_ID

#define MCP251863_TX_RESPONSE_ID   0x301

◆ MCP251863_WAKEUP_INTERR_EN

#define MCP251863_WAKEUP_INTERR_EN   0x40

◆ N_MCP2518_CTRL_REGS

#define N_MCP2518_CTRL_REGS   5

MCP251863 Up to A1 silicon we had to multiply user address by 4.

Specified setting for Up to A1 silicon we had to multiply user address by 4 of MCP251863 Click driver.

◆ REV_B

#define REV_B

MCP251863 Revision.

Specified setting for Revision of MCP251863 Click driver.

Function Documentation

◆ mcp251863_bit_time_configure()

err_t mcp251863_bit_time_configure ( mcp251863_t * ctx,
uint8_t bit_time,
uint8_t clk )

Configure Bit Time registers (based on CAN clock speed).

Function for configuring Bit Time registers ( based on CAN clock speed ).

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
[in]clk: Decode clk.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_data_10_mhz()

err_t mcp251863_bit_time_configure_data_10_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Data bit time for 10MHz system clock.

Function for configuring Data bit time for 10MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_data_20_mhz()

err_t mcp251863_bit_time_configure_data_20_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Nominal bit time for 20MHz system clock.

Function for configuring Nominal bit time for 20MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_data_40_mhz()

err_t mcp251863_bit_time_configure_data_40_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Data bit time for 40MHz system clock.

Function for configuring Data bit time for 40MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_nominal_10_mhz()

err_t mcp251863_bit_time_configure_nominal_10_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Nominal bit time for 10MHz system clock.

Function for configuring Nominal bit time for 10MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_nominal_20_mhz()

err_t mcp251863_bit_time_configure_nominal_20_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Nominal bit time for 20MHz system clock.

Function for configuring Nominal bit time for 20MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bit_time_configure_nominal_40_mhz()

err_t mcp251863_bit_time_configure_nominal_40_mhz ( mcp251863_t * ctx,
uint8_t bit_time )

Configure Nominal bit time for 40MHz system clock.

Function for configuring Nominal bit time for 40MHz system clock.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]bit_time: Bit time.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bus_diagnostics_clear()

err_t mcp251863_bus_diagnostics_clear ( mcp251863_t * ctx)

Clear Bus Diagnostic Registers.

Function for clearing Bus Diagnostic Registers.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_bus_diagnostics_get()

err_t mcp251863_bus_diagnostics_get ( mcp251863_t * ctx,
mcp251863_bus_diag_t * bus_diag )

Get Bus Diagnostic Registers: all data_ at once, since we want to keep them in synch.

Function for getting Bus Diagnostic Registers: all data_ at once, since we want to keep them in synch

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
bus_diag: Bus diag object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_calculate_crc16()

uint16_t mcp251863_calculate_crc16 ( uint8_t * data_pointer,
uint16_t size )

Calculate CRC16.

Function for calculate CRC16.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]data_pointer: Data pointer.
[in]size: Size of array ( table for CRC calculation ).
Returns
CRC base

◆ mcp251863_cfg_setup()

void mcp251863_cfg_setup ( mcp251863_cfg_t * cfg)

MCP251863 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See mcp251863_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ mcp251863_configure()

err_t mcp251863_configure ( mcp251863_t * ctx,
mcp251863_can_cfg_t * config )

CAN Control register configuration.

Function for CAN control register configuration.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]config: CAN config object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_configure_object_reset()

void mcp251863_configure_object_reset ( mcp251863_can_cfg_t * config)

Reset Configure object to reset values.

Function for reset configure object.

Parameters
[in]config: CAN config object.
Returns
Nothing.

◆ mcp251863_crc_event_clear()

err_t mcp251863_crc_event_clear ( mcp251863_t * ctx,
uint8_t flags )

CRC Event Clear.

Function for clearing CRC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt flags of CRC Register
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_crc_event_disable()

err_t mcp251863_crc_event_disable ( mcp251863_t * ctx,
uint8_t flags )

CRC Event Disnable.

Function for disabling CRC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt control bits of CRC Register.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_crc_event_enable()

err_t mcp251863_crc_event_enable ( mcp251863_t * ctx,
uint8_t flags )

CRC Event Enable.

Function for enabling CRC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
flags: Interrupt control bits of CRC Register.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_crc_event_get()

err_t mcp251863_crc_event_get ( mcp251863_t * ctx,
uint8_t * flags )

CRC Event Get.

Function for getting CRC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]flags: Interrupt flags of CRC Register
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_crc_value_get()

err_t mcp251863_crc_value_get ( mcp251863_t * ctx,
uint16_t * crc )

Get CRC Value from device.

Function for getting CRC Value from device.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]crc: CRC value from CRC Register.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_data_bytes_to_dlc()

uint8_t mcp251863_data_bytes_to_dlc ( uint8_t num)

Data bytes to DLC conversion.

Function for conversion Data bytes to DLC

Parameters
[in]num: Number of bytes
Returns
Dcl macro value.

◆ mcp251863_default_cfg()

err_t mcp251863_default_cfg ( mcp251863_t * ctx)

MCP251863 default configuration function.

This function executes a default configuration of MCP251863 click board.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ mcp251863_device_net_filter_count_set()

err_t mcp251863_device_net_filter_count_set ( mcp251863_t * ctx,
uint8_t dnfc )

Set Device Net Filter Count.

Function for setting device net filter count.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]dnfc: Device Net Filter Count
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_dlc_to_data_bytes()

uint32_t mcp251863_dlc_to_data_bytes ( uint8_t dlc)

DLC to number of actual data_bytes conversion.

Function for conversion DLC to number of actual data bytes.

Parameters
[in]dlc: DLC
Returns
Data pointerbytes in object.

◆ mcp251863_ecc_disable()

err_t mcp251863_ecc_disable ( mcp251863_t * ctx)

Disable ECC.

Function for disabling ECC.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_enable()

err_t mcp251863_ecc_enable ( mcp251863_t * ctx)

Enable ECC.

Function for enabling ECC.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_error_address_get()

err_t mcp251863_ecc_error_address_get ( mcp251863_t * ctx,
uint16_t * address )

Get ECC Error Address.

Function for getting ECC Error Address.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Adress to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_event_clear()

err_t mcp251863_ecc_event_clear ( mcp251863_t * ctx,
uint8_t flags )

ECC Event Clear.

Function for clearing ECC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
flags: ECC status.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_event_disable()

err_t mcp251863_ecc_event_disable ( mcp251863_t * ctx,
uint8_t flags )

ECC Event Disable.

Function for disabling ECC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
flags: ECC interrupt.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_event_enable()

err_t mcp251863_ecc_event_enable ( mcp251863_t * ctx,
uint8_t flags )

ECC Event Enable.

Function for enabling ECC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
flags: ECC interrupt.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_event_get()

err_t mcp251863_ecc_event_get ( mcp251863_t * ctx,
uint8_t * flags )

ECC Event Get.

Function for getting ECC Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_parity_get()

err_t mcp251863_ecc_parity_get ( mcp251863_t * ctx,
uint8_t * parity )

Get ECC Parity.

Function for getting ECC Parity.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
parity: Data to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_ecc_parity_set()

err_t mcp251863_ecc_parity_set ( mcp251863_t * ctx,
uint8_t parity )

Set ECC Parity.

Function for setting ECC Parity.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
parity: Write command.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_error_count_receive_get()

err_t mcp251863_error_count_receive_get ( mcp251863_t * ctx,
uint8_t * rec )

Receive Error Count Get.

Function for getting Receive Error Count.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]rec: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_error_count_state_get()

err_t mcp251863_error_count_state_get ( mcp251863_t * ctx,
uint8_t * tec,
uint8_t * rec,
uint8_t * flags )

Error Counts and Error State Get.

Returns content of complete CITREC.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]tec: Buffer to be read.
[out]rec: Buffer to be read.
[out]flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_error_count_transmit_get()

err_t mcp251863_error_count_transmit_get ( mcp251863_t * ctx,
uint8_t * tec )

Transmit Error Count Get.

Function for clearing Transmit Event FIFO Event.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
tec: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_error_state_get()

err_t mcp251863_error_state_get ( mcp251863_t * ctx,
uint8_t * flags )

Error State Get.

Function for getting Error State.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_fifo_index_get()

err_t mcp251863_fifo_index_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * data_out )

FIFO Index Get.

Function for getting FIFO Index.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]channel: Channel.
[in]data_out: Buffer for status register to be read
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_filter_disable()

err_t mcp251863_filter_disable ( mcp251863_t * ctx,
uint8_t filter )

Filter Disable.

Function for disabling specific filter.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]filter: Filter.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_filter_enable()

err_t mcp251863_filter_enable ( mcp251863_t * ctx,
uint8_t filter )

Filter Enable.

Function for enabling specific filter.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]filter: Filter.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_filter_mask_configure()

err_t mcp251863_filter_mask_configure ( mcp251863_t * ctx,
uint8_t filter,
mcp251863_mask_obj_id_t * mask )

Filter Mask Configuration.

Configures Mask of filter object.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]filter: Filter.
[in]mask: Filter mask id
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_filter_object_configure()

err_t mcp251863_filter_object_configure ( mcp251863_t * ctx,
uint8_t filter,
mcp251863_filt_obj_id_t * id )

Filter Object Configuration.

Configures ID of filter object.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]filter: Filter.
[in]id: Filter object id.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_filter_to_fifo_link()

err_t mcp251863_filter_to_fifo_link ( mcp251863_t * ctx,
uint8_t filter,
uint8_t channel,
bool enable )

Link Filter to FIFO.

Initializes the Pointer from Filter to FIFO. Enables or disables the Filter.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]filter: Filter.
[inchannel : Channel.
[in]enable: If TRUE - sets 1 on enable field ( of filter ctl object )
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_generic_read()

err_t mcp251863_generic_read ( mcp251863_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

MCP251863 data reading function.

This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_generic_write()

err_t mcp251863_generic_write ( mcp251863_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

MCP251863 data writing function.

This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_clock_output_configure()

err_t mcp251863_gpio_clock_output_configure ( mcp251863_t * ctx,
int8_t mode )

Configure CLKO Pin.

Function for configuring CLKO Pin.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]mode: Mode.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_direction_configure()

err_t mcp251863_gpio_direction_configure ( mcp251863_t * ctx,
uint8_t gpio0,
uint8_t gpio1 )

Initialize GPIO Direction.

Function for initialising GPIO Direction.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]gpio0: GPIO 0.
[in]gpio1: GPIO 1.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_interrupt_pins_open_drain_configure()

err_t mcp251863_gpio_interrupt_pins_open_drain_configure ( mcp251863_t * ctx,
uint8_t mode )

Configure Open Drain Interrupts.

Function for configuring Open Drain Interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]mode: Mode.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_mode_configure()

err_t mcp251863_gpio_mode_configure ( mcp251863_t * ctx,
uint8_t gpio0,
uint8_t gpio1 )

Initialize GPIO Mode.

Function for initialising GPIO Mode.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]gpio0: GPIO 0.
[in]gpio1: GPIO 1.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_pin_read()

err_t mcp251863_gpio_pin_read ( mcp251863_t * ctx,
uint8_t pos,
uint8_t * state )

Input Pin Read.

Function for reading GPIO Input Pin Read.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]pos: Pin flag.
[in]state: State to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_pin_set()

err_t mcp251863_gpio_pin_set ( mcp251863_t * ctx,
uint8_t pos,
uint8_t latch )

GPIO Output Pin Set.

Function for setting GPIO Output Pin.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]pos: Pin flag.
[in]latch: Pin latch.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_standby_control_disable()

err_t mcp251863_gpio_standby_control_disable ( mcp251863_t * ctx)

Disable Transceiver Standby Control.

Function for disabling Transceiver Standby Control.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_standby_control_enable()

err_t mcp251863_gpio_standby_control_enable ( mcp251863_t * ctx)

Enable Transceiver Standby Control.

Function for enabling Transceiver Standby Control.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_gpio_transmit_pin_open_drain_configure()

err_t mcp251863_gpio_transmit_pin_open_drain_configure ( mcp251863_t * ctx,
uint8_t mode )

Configure Open Drain TXCAN.

Function for configuring Open Drain TXCAN.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]mode: Mode.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_init()

err_t mcp251863_init ( mcp251863_t * ctx,
mcp251863_cfg_t * cfg )

MCP251863 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See mcp251863_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_clear()

err_t mcp251863_module_event_clear ( mcp251863_t * ctx,
uint16_t flags )

Module Event Clear.

Clears interrupt Flags.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt clears to be read.
Returns
spi transfer error ( 0 : if succeed, -2 : write_half_word error )
  • 0 - Success,
  • -1 - Error,
  • -2 - Write half word error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_disable()

err_t mcp251863_module_event_disable ( mcp251863_t * ctx,
uint16_t flags )

Module Event Disable.

Disables interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt disables to be read.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_enable()

err_t mcp251863_module_event_enable ( mcp251863_t * ctx,
uint16_t flags )

Module Event Enable.

Enables interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt disables to be read.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_filter_hit_get()

err_t mcp251863_module_event_filter_hit_get ( mcp251863_t * ctx,
uint8_t * filter_hit )

Get Filter Hit.

Function for getting Filter Hit.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]filter_hit: Filter hit.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_get()

err_t mcp251863_module_event_get ( mcp251863_t * ctx,
uint16_t * flags )

Module Event Get.

Reads interrupt Flags

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt disables to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_icode_get()

err_t mcp251863_module_event_icode_get ( mcp251863_t * ctx,
uint8_t * icode )

Get ICODE.

Function for getting ICODE.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]icode: Decode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_rx_code_get()

err_t mcp251863_module_event_rx_code_get ( mcp251863_t * ctx,
uint8_t * rx_code )

Get RX Code.

Function for getting RX Code.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]rx_code: Decode data_pointer.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_module_event_tx_code_get()

err_t mcp251863_module_event_tx_code_get ( mcp251863_t * ctx,
uint8_t * tx_code )

Get TX Code.

Function for getting TX Code.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]tx_code: Decode data_pointer.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_operation_mode_get()

err_t mcp251863_operation_mode_get ( mcp251863_t * ctx)

Get Operation Mode.

Function for get operation mode.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
Operation mode.

◆ mcp251863_operation_mode_select()

err_t mcp251863_operation_mode_select ( mcp251863_t * ctx,
uint8_t op_mode )

Select Operation Mode.

Function for select operation mode.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]op_mode: Operation mode.
Returns
  • 0 - Success,
  • -1 - Read error.
  • -2 - Writte error.
See #err_t definition for detailed explanation.

◆ mcp251863_oscillator_control_object_reset()

void mcp251863_oscillator_control_object_reset ( mcp251863_div_ctl_t * ctrl)

Reset Oscillator Control.

Function for resetting Oscillator Control.

Parameters
[in]ctrl: Div ctrl object.
Returns
Nothing.

◆ mcp251863_oscillator_control_set()

err_t mcp251863_oscillator_control_set ( mcp251863_t * ctx,
mcp251863_div_ctl_t ctrl )

Set Oscillator Control.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
ctrl: Div ctl object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

Function for setting Oscillator Control

◆ mcp251863_oscillator_enable()

err_t mcp251863_oscillator_enable ( mcp251863_t * ctx)

Enable oscillator to wake-up from sleep.

Function for enabling oscillator to wake-up from sleep.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_oscillator_status_get()

err_t mcp251863_oscillator_status_get ( mcp251863_t * ctx,
mcp251863_osc_sta_t * status )

Get Oscillator Status.

Function for gettting Oscillator Status.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]status: Oscillator status object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_ram_init()

err_t mcp251863_ram_init ( mcp251863_t * ctx,
uint8_t rx_data )

Initialize RAM.

Function for initialising RAM.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]rx_data: Data_pointer.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_byte()

err_t mcp251863_read_byte ( mcp251863_t * ctx,
uint16_t address,
uint8_t * data_out )

SPI Read Byte function.

Function for read byte.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[out]data_out: Buffer where data will be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_byte_array()

err_t mcp251863_read_byte_array ( mcp251863_t * ctx,
uint16_t address,
uint8_t * data_out,
uint16_t n_bytes )

SPI Read Byte Array.

Function for read byte array.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[out]data_out: Buffer where data will be read.
[in]n_bytes: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_byte_array_with_crc()

err_t mcp251863_read_byte_array_with_crc ( mcp251863_t * ctx,
bool from_ram,
bool * crc_is_correct )

SPI Read Byte Array with CRC.

Function for read byte with CRC.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]from_ram: Byte for array size.
[in]crc_is_correct: Compare CRC readings ( true - if equal, false - if not ).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_half_word()

err_t mcp251863_read_half_word ( mcp251863_t * ctx,
uint16_t address,
uint16_t * data_out )

SPI Read Half Word.

Function for read half word.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[out]data_out: Buffer where data will be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_word()

err_t mcp251863_read_word ( mcp251863_t * ctx,
uint16_t address,
uint32_t * data_out )

SPI Read Word.

Function for read word.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[out]data_out: Buffer where data will be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_read_word_array()

err_t mcp251863_read_word_array ( mcp251863_t * ctx,
uint16_t address,
uint32_t * data_out,
uint16_t n_words )

SPI Read Word Array.

Function for read word array.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[out]data_out: Buffer where data will be read.
[in]n_words: Number of words to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_configure()

err_t mcp251863_receive_channel_configure ( mcp251863_t * ctx,
uint8_t channel,
mcp251863_rx_fifo_cfg_t * config )

Configure Receive FIFO.

Function for configuring recive FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]config: Rx FIFO cfg object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_configure_object_reset()

void mcp251863_receive_channel_configure_object_reset ( mcp251863_rx_fifo_cfg_t * config)

Reset Receive Channel Configure object to reset value.

Function for resetting Receive Channel Configure object to reset value.

Parameters
[in]config: Rx FIFO cfg object.
Returns
Nothing.

◆ mcp251863_receive_channel_event_disable()

err_t mcp251863_receive_channel_event_disable ( mcp251863_t * ctx,
uint8_t channel,
uint8_t flags )

Receive FIFO Event Disable.

Disables Receive FIFO interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt Disables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_event_enable()

err_t mcp251863_receive_channel_event_enable ( mcp251863_t * ctx,
uint8_t channel,
uint8_t flags )

Receive FIFO Event Enable.

Enables Receive FIFO interrupts

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt Enables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_event_get()

err_t mcp251863_receive_channel_event_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * flags )

Receive FIFO Event Get.

Reads Receive FIFO interrupt Flags.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt Enables.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_event_overflow_clear()

err_t mcp251863_receive_channel_event_overflow_clear ( mcp251863_t * ctx,
uint8_t channel )

Receive FIFO Event Clear.

Clears Receive FIFO Overflow interrupt Flag.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_index_get()

int8_t mcp251863_receive_channel_index_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * idx )

Receive FIFO Index Get.

Function for getting Receive FIFO Index.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
idx: Transmit Channel Index to be read.
Returns
Transmit channel index.

◆ mcp251863_receive_channel_reset()

err_t mcp251863_receive_channel_reset ( mcp251863_t * ctx,
uint8_t channel )

Receive FIFO Reset.

Function for resetting Receive FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_status_get()

err_t mcp251863_receive_channel_status_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * status )

Receive Channel Status Get.

Function for getting Receive Channel Status.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[out]status: Status.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_channel_update()

err_t mcp251863_receive_channel_update ( mcp251863_t * ctx,
uint8_t channel )

Receive FIFO Update.

Sets UINC of the receive channel.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_event_get()

err_t mcp251863_receive_event_get ( mcp251863_t * ctx,
uint32_t * rxif )

Get pending interrupts of all receive FIFOs.

Function for get pending interrupts of all receive FIFOs.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]rxif: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_event_overflow_get()

err_t mcp251863_receive_event_overflow_get ( mcp251863_t * ctx,
uint32_t * rxovif )

Get pending RXOVIF of all receive FIFOs.

Function for get pending RXOVIF of all receive FIFOs.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]rxovif: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_message()

err_t mcp251863_receive_message ( mcp251863_t * ctx,
uint8_t * data_out,
uint16_t * data_len )

Message Receive function.

Receives the message and checks is message successfully received.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]data_out: Buffer where message be received
[out]data_len: Number of data bytes read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_receive_message_get()

err_t mcp251863_receive_message_get ( mcp251863_t * ctx,
uint8_t channel,
mcp251863_rx_msg_obj_t * rx_obj )

Get Received Message.

Reads Received message from channel.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[out]rx_obj: Rx Message object.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error,
  • -3 - Read byte array error,
  • -4 - Receiver channel update.
See #err_t definition for detailed explanation.

◆ mcp251863_reset()

err_t mcp251863_reset ( mcp251863_t * ctx)

Reset function.

Function for reset using generic transfer

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_configure()

err_t mcp251863_tef_configure ( mcp251863_t * ctx,
mcp251863_tef_cfg_t * config )

Configure Transmit Event FIFO.

Function for configuring Transmit Event FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]config: TEF configure object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_configure_object_reset()

void mcp251863_tef_configure_object_reset ( mcp251863_tef_cfg_t * config)

Reset TefConfigure object to reset value.

Function for resetting value of TEF configure object.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]config: TEF configure object.
Returns
Nothing.

◆ mcp251863_tef_event_disable()

err_t mcp251863_tef_event_disable ( mcp251863_t * ctx,
uint8_t flags )

Transmit Event FIFO Event Disable.

Disables Transmit Event FIFO interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt disables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_event_enable()

err_t mcp251863_tef_event_enable ( mcp251863_t * ctx,
uint8_t flags )

Transmit Event FIFO Event Enable.

Enables Transmit Event FIFO interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]flags: Interrupt enables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_event_get()

err_t mcp251863_tef_event_get ( mcp251863_t * ctx,
uint8_t * flags )

Transmit Event FIFO Event Get.

Reads Transmit Event FIFO interrupt Flags.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_event_overflow_clear()

err_t mcp251863_tef_event_overflow_clear ( mcp251863_t * ctx)

Transmit Event FIFO Event Clear.

Clears Transmit Event FIFO Overflow interrupt Flag.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_message_get()

err_t mcp251863_tef_message_get ( mcp251863_t * ctx,
mcp251863_tef_msg_obj_t * tef_obj )

Get Transmit Event FIFO Message.

Reads Transmit Event FIFO message

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]tef_obj: TEF Message object.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error,
  • -3 - Update error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_reset()

err_t mcp251863_tef_reset ( mcp251863_t * ctx)

Transmit Event FIFO Reset.

Function for resetting Transmit Event FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
See #err_t definition for detailed explanation.

◆ mcp251863_tef_status_get()

err_t mcp251863_tef_status_get ( mcp251863_t * ctx,
uint8_t * status )

Transmit Event FIFO Status Get.

Function for getting Transmit Event FIFO Status.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]status: Status.
Returns
  • 0 - Success,
  • -1 - Read error.
See #err_t definition for detailed explanation.

◆ mcp251863_tef_update()

err_t mcp251863_tef_update ( mcp251863_t * ctx)

Transmit Event FIFO Update.

Sets UINC of the TEF.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_disable()

err_t mcp251863_time_stamp_disable ( mcp251863_t * ctx)

Time Stamp Disable.

Function for disabling Time Stamp.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_enable()

err_t mcp251863_time_stamp_enable ( mcp251863_t * ctx)

Time Stamp Enable.

Function for enabling Time Stamp.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_get()

err_t mcp251863_time_stamp_get ( mcp251863_t * ctx,
uint32_t * time_stamp )

Time Stamp Get.

Function for getting Time Stamp.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[out]time_stamp: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_mode_configure()

err_t mcp251863_time_stamp_mode_configure ( mcp251863_t * ctx,
uint8_t mode )

Time Stamp Mode Configure.

Function for configuring Time Stamp Mode.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]mode: Mode. data to be write.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_prescaler_set()

err_t mcp251863_time_stamp_prescaler_set ( mcp251863_t * ctx,
uint16_t time_stamp )

Time Stamp Prescaler Set.

Function for setting Time Stamp Prescaler.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]time_stamp: Time stamp prescaler.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_time_stamp_set()

err_t mcp251863_time_stamp_set ( mcp251863_t * ctx,
uint32_t ts )

Time Stamp Set.

Function for setting Time Stamp.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]time_stamp: Time stamp data to be write.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_abort_all()

err_t mcp251863_transmit_abort_all ( mcp251863_t * ctx)

Abort All transmissions.

Function for aborting all transmission.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_band_width_sharing_set()

err_t mcp251863_transmit_band_width_sharing_set ( mcp251863_t * ctx,
uint8_t tx_bws )

Set Transmit Bandwidth Sharing Delay.

Function for setting transmit bandwidth sharing delay.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
tx_bws: Transmit Bandwidth to be set.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_abort()

err_t mcp251863_transmit_channel_abort ( mcp251863_t * ctx,
uint8_t channel )

Abort transmission of single FIFO.

Function for aborting transmission of single FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_configure()

err_t mcp251863_transmit_channel_configure ( mcp251863_t * ctx,
uint8_t channel,
mcp251863_tx_fifo_cfg_t * config )

Configure Transmit FIFO.

Function for configuring transmit FIFO.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]config: Tx QUEUE config object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_configure_object_reset()

void mcp251863_transmit_channel_configure_object_reset ( mcp251863_tx_fifo_cfg_t * config)

Reset Transmit Channel Configure object to reset values.

Function for reseting values of Transmit channel configure object.

Parameters
[in]config: Tx QUEUE config object.
Returns
Nothing.

◆ mcp251863_transmit_channel_event_attempt_clear()

err_t mcp251863_transmit_channel_event_attempt_clear ( mcp251863_t * ctx,
uint8_t channel )

Transmit FIFO Event Clear.

Clears Transmit FIFO Attempts Exhausted interrupt Flag.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_event_disable()

err_t mcp251863_transmit_channel_event_disable ( mcp251863_t * ctx,
uint8_t channel,
uint8_t flags )

Transmit FIFO Event Disable.

Disables Transmit FIFO interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt Enables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_event_enable()

err_t mcp251863_transmit_channel_event_enable ( mcp251863_t * ctx,
uint8_t channel,
uint8_t flags )

Transmit FIFO Event Enable.

Enables Transmit FIFO interrupts.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt Enables.
Returns
  • 0 - Success,
  • -1 - Read error,
  • -2 - Write error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_event_get()

err_t mcp251863_transmit_channel_event_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * flags )

Transmit FIFO Event Get.

Reads Transmit FIFO interrupt Flags.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flags: Interrupt flags.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_flush()

err_t mcp251863_transmit_channel_flush ( mcp251863_t * ctx,
uint8_t channel )

TX Channel Flush.

Set TXREG of one channel.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_index_get()

err_t mcp251863_transmit_channel_index_get ( mcp251863_t * ctx,
uint8_t channel,
uint8_t * idx )

Transmit FIFO Index Get.

Reads Transmit FIFO Index.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]idx: Update data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_load()

err_t mcp251863_transmit_channel_load ( mcp251863_t * ctx,
uint8_t channel,
mcp251863_tx_msg_obj_t * tx_obj,
bool flush )

TX Channel Load.

Loads data into Transmit channel.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]tx_obj: Tx Message object.
[in]flush: If TRUE - Requests transmission
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_reset()

int8_t mcp251863_transmit_channel_reset ( mcp251863_t * ctx,
uint8_t channel )

Transmit FIFO Reset.

Function for resetting FIFO Transmit.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_status_get()

err_t mcp251863_transmit_channel_status_get ( mcp251863_t * ctx,
uint8_t channel,
uint16_t * status )

Transmit Channel Status Get.

Function for getting Transmit Channel Status.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]status: Status to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_channel_update()

err_t mcp251863_transmit_channel_update ( mcp251863_t * ctx,
uint8_t channel,
bool flush )

Transmit FIFO Update.

Sets UINC of the transmit channel. Keeps TXREQ unchanged.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]cannel: Channel.
[in]flush: If TRUE - Requests transmission
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_event_attempt_get()

err_t mcp251863_transmit_event_attempt_get ( mcp251863_t * ctx,
uint32_t * txatif )

Get pending TXATIF of all transmit FIFOs.

Function for gettingg pending TXATIF of all transmit FIFOs.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]txatif: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_event_get()

err_t mcp251863_transmit_event_get ( mcp251863_t * ctx,
uint32_t * txif )

Get pending interrupts of all transmit FIFOs.

Function for gettingg pending interrupts of all transmit FIFOs.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]txif: Buffer to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_message()

err_t mcp251863_transmit_message ( mcp251863_t * ctx,
uint8_t * data_in,
uint16_t data_len )

Message Transmit function.

Transmits the desired message and checks is message successfully sent.

Parameters
[in]ctx: Click object. See mcp251863_t object definition for detailed explanation.
[in]data_in: Message to be sent.
[in]data_len: Determines the length of message.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_queue_configure()

err_t mcp251863_transmit_queue_configure ( mcp251863_t * ctx,
mcp251863_tx_que_cfg_t * config )

Configure Transmit Queue.

Function for configuring transmit Queue.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]config: Tx QUEUE config object.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_queue_configure_object_reset()

void mcp251863_transmit_queue_configure_object_reset ( mcp251863_tx_que_cfg_t * config)

Reset Transmit Queue Configure object to reset values.

Function for reseting values of Transmit Queue Configure object.

Parameters
[in]config: Tx QUEUE config object.
Returns
Nothing.

◆ mcp251863_transmit_request_get()

err_t mcp251863_transmit_request_get ( mcp251863_t * ctx,
uint32_t * tx_req )

Get TXREQ register.

Function for getting TXREQ register.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]tx_req: TXREQ register to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_transmit_request_set()

err_t mcp251863_transmit_request_set ( mcp251863_t * ctx,
uint32_t tx_req )

Request transmissions using TXREQ register.

Function for requesting transmissions using TXREQ register.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]tx_req: TXREQ register to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_byte()

err_t mcp251863_write_byte ( mcp251863_t * ctx,
uint16_t address,
uint8_t data_in )

SPI Write Byte.

Function for write byte.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_byte_array()

err_t mcp251863_write_byte_array ( mcp251863_t * ctx,
uint16_t address,
uint8_t * data_in,
uint16_t n_bytes )

SPI Write Byte Array.

Function for write byte array.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
data_in: Buffer of data to be written.
n_bytes: Number of bytes to be write.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_byte_array_with_crc()

err_t mcp251863_write_byte_array_with_crc ( mcp251863_t * ctx,
bool from_ram )

SPI Write Byte Array with CRC.

Function for write byte array with CRC.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]from_ram: Byte for array size.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_byte_safe()

err_t mcp251863_write_byte_safe ( mcp251863_t * ctx,
uint16_t address,
uint8_t data_in )

SPI SFR Write Byte Safe.

Writes Byte to SFR at address using SPI CRC. Byte gets only written if CRC matches.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The function doesn't check if the address is an SFR address.

◆ mcp251863_write_half_word()

err_t mcp251863_write_half_word ( mcp251863_t * ctx,
uint16_t address,
uint16_t data_in )

SPI Write Half Word.

Function for write half word.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_word()

err_t mcp251863_write_word ( mcp251863_t * ctx,
uint16_t address,
uint32_t data_in )

SPI Write Word.

Function for write word.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_word_array()

err_t mcp251863_write_word_array ( mcp251863_t * ctx,
uint16_t address,
uint32_t * data_in,
uint16_t n_words )

SPI Write Word Array.

Function for write word array.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Buffer of data to be written.
[in]n_words: Number of words to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ mcp251863_write_word_safe()

err_t mcp251863_write_word_safe ( mcp251863_t * ctx,
uint16_t address,
uint32_t data_in )

SPI RAM Write Word Safe.

Writes Word to RAM at address using SPI CRC. Word gets only written if CRC matches.

Parameters
[in]ctx: Click context object. See mcp251863_t object definition for detailed explanation.
[in]address: Register adress.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
The function doesn't check if the address is a RAM address.