obdii 2.1.0.0
OBDII Click Driver

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

Topics

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

Functions

void obdii_cfg_setup (obdii_cfg_t *cfg)
 OBDII configuration object setup function.
 
err_t obdii_init (obdii_t *ctx, obdii_cfg_t *cfg)
 OBDII initialization function.
 
err_t obdii_generic_write (obdii_t *ctx, uint8_t *data_in, uint16_t len)
 OBDII data writing function.
 
err_t obdii_generic_read (obdii_t *ctx, uint8_t *data_out, uint16_t len)
 OBDII data reading function.
 
void obdii_send_command (obdii_t *ctx, uint8_t *cmd)
 OBDII send command function.
 
void obdii_reset_device (obdii_t *ctx)
 OBDII reset device function.
 
void obdii_set_rst_pin (obdii_t *ctx, uint8_t state)
 OBDII set rst pin function.
 
uint8_t obdii_get_int_pin (obdii_t *ctx)
 OBDII get int pin function.
 

Detailed Description

API for configuring and manipulating OBDII 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

◆ obdii_cfg_setup()

void obdii_cfg_setup ( obdii_cfg_t * cfg)

OBDII configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ obdii_generic_read()

err_t obdii_generic_read ( obdii_t * ctx,
uint8_t * data_out,
uint16_t len )

OBDII data reading function.

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

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]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.

◆ obdii_generic_write()

err_t obdii_generic_write ( obdii_t * ctx,
uint8_t * data_in,
uint16_t len )

OBDII data writing function.

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

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
[in]data_in: 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.

◆ obdii_get_int_pin()

uint8_t obdii_get_int_pin ( obdii_t * ctx)

OBDII get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ obdii_init()

err_t obdii_init ( obdii_t * ctx,
obdii_cfg_t * cfg )

OBDII initialization function.

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

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

◆ obdii_reset_device()

void obdii_reset_device ( obdii_t * ctx)

OBDII reset device function.

This function resets the device by toggling the RST pin.

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ obdii_send_command()

void obdii_send_command ( obdii_t * ctx,
uint8_t * cmd )

OBDII send command function.

This function sends command string by using UART serial interface.

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
[in]cmd: Command string to send.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ obdii_set_rst_pin()

void obdii_set_rst_pin ( obdii_t * ctx,
uint8_t state )

OBDII set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See obdii_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.