canbus 2.0.0.0
CAN Bus Click Driver

API for configuring and manipulating CAN Bus Click driver. More...

Topics

 CAN Bus Device Settings
 Settings for registers of CAN Bus Click driver.
 
 CAN Bus MikroBUS Map
 MikroBUS pin mapping of CAN Bus Click driver.
 

Functions

void canbus_cfg_setup (canbus_cfg_t *cfg)
 CAN Bus configuration object setup function.
 
err_t canbus_init (canbus_t *ctx, canbus_cfg_t *cfg)
 CAN Bus initialization function.
 
err_t canbus_default_cfg (canbus_t *ctx)
 CAN Bus default configuration function.
 
err_t canbus_generic_write (canbus_t *ctx, char *data_buf, uint16_t len)
 CAN Bus data writing function.
 
err_t canbus_generic_read (canbus_t *ctx, char *data_buf, uint16_t max_len)
 CAN Bus data reading function.
 
err_t canbus_set_low_current_standby_mode (canbus_t *ctx)
 CAN Bus low current standby mode function.
 
err_t canbus_set_high_speed_mode (canbus_t *ctx)
 CAN Bus high speed mode function.
 
err_t canbus_send_data (canbus_t *ctx, char *tx_data)
 CAN Bus send data function.
 

Detailed Description

API for configuring and manipulating CAN Bus Click driver.

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

Function Documentation

◆ canbus_cfg_setup()

void canbus_cfg_setup ( canbus_cfg_t * cfg)

CAN Bus configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ canbus_default_cfg()

err_t canbus_default_cfg ( canbus_t * ctx)

CAN Bus default configuration function.

This function executes a default configuration of CAN Bus click board.

Parameters
[in]ctx: Click context object. See canbus_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.

◆ canbus_generic_read()

err_t canbus_generic_read ( canbus_t * ctx,
char * data_buf,
uint16_t max_len )

CAN Bus data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See canbus_t object definition for detailed explanation.
[out]data_buf: Output read data.
[in]max_len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer.
See #err_t definition for detailed explanation.
Note
None.

◆ canbus_generic_write()

err_t canbus_generic_write ( canbus_t * ctx,
char * data_buf,
uint16_t len )

CAN Bus data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See canbus_t object definition for detailed explanation.
[in]data_buf: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canbus_init()

err_t canbus_init ( canbus_t * ctx,
canbus_cfg_t * cfg )

CAN Bus initialization function.

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

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

◆ canbus_send_data()

err_t canbus_send_data ( canbus_t * ctx,
char * tx_data )

CAN Bus send data function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See canbus_t object definition for detailed explanation.
[out]tx_data: Output read data.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer.
See #err_t definition for detailed explanation.
Note
None.

◆ canbus_set_high_speed_mode()

err_t canbus_set_high_speed_mode ( canbus_t * ctx)

CAN Bus high speed mode function.

This function enables the high speed operation mode by clears the STB ( AN ) pin on the low level of the CAN Bus click boardâ„¢.

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

◆ canbus_set_low_current_standby_mode()

err_t canbus_set_low_current_standby_mode ( canbus_t * ctx)

CAN Bus low current standby mode function.

This function enables the low current standby mode by sets the STB ( AN ) pin on the high level of the CAN Bus click boardâ„¢.

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