ldc 2.0.0.0
LDC Click Driver

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

Topics

 LDC Registers List
 List of registers of LDC Click driver.
 
 LDC Registers Settings
 Settings for registers of LDC Click driver.
 
 LDC MikroBUS Map
 MikroBUS pin mapping of LDC Click driver.
 

Functions

void ldc_cfg_setup (ldc_cfg_t *cfg)
 LDC configuration object setup function.
 
err_t ldc_init (ldc_t *ctx, ldc_cfg_t *cfg)
 LDC initialization function.
 
err_t ldc_default_cfg (ldc_t *ctx)
 LDC default configuration function.
 
err_t ldc_generic_write (ldc_t *ctx, uint8_t reg, uint16_t tx_data)
 LDC I2C writing function.
 
err_t ldc_generic_read (ldc_t *ctx, uint8_t reg, uint16_t *rx_data)
 LDC I2C reading function.
 
uint8_t ldc_get_interrupt (ldc_t *ctx)
 Get interrupt pin status.
 
void ldc_set_shut_down (ldc_t *ctx, uint8_t state)
 Set shut down pin status.
 
err_t ldc_get_frequency (ldc_t *ctx, uint8_t channel, uint16_t divider, float *frequency)
 Get frequency value calulated for specific channel.
 
float ldc_calculate_inductance (float frequency)
 Calculate inductance relative to frequency.
 

Detailed Description

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

◆ ldc_calculate_inductance()

float ldc_calculate_inductance ( float frequency)

Calculate inductance relative to frequency.

This function calculates inductance relative to forwarded frequency.

Parameters
[in]ctx: Click context object. See ldc_t object definition for detailed explanation.
[in]frequency: Current sensor frequency.
Returns
Calculated inductance data in uH unit.

◆ ldc_cfg_setup()

void ldc_cfg_setup ( ldc_cfg_t * cfg)

LDC configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ldc_default_cfg()

err_t ldc_default_cfg ( ldc_t * ctx)

LDC default configuration function.

This function executes a default configuration of LDC click board.

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

◆ ldc_generic_read()

err_t ldc_generic_read ( ldc_t * ctx,
uint8_t reg,
uint16_t * rx_data )

LDC I2C reading function.

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

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

◆ ldc_generic_write()

err_t ldc_generic_write ( ldc_t * ctx,
uint8_t reg,
uint16_t tx_data )

LDC I2C writing function.

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

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

◆ ldc_get_frequency()

err_t ldc_get_frequency ( ldc_t * ctx,
uint8_t channel,
uint16_t divider,
float * frequency )

Get frequency value calulated for specific channel.

This function reads a data from data channel and calculates frequency relative to selected divider.

Parameters
[in]ctx: Click context object. See ldc_t object definition for detailed explanation.
[in]channel: Channel data register to read from.
[in]divider: Divider set for selected channel.
[out]frequency: Calculated frequency in MHz.
Returns
  • 0 - Success,
  • -1 - Error,
  • -2 - Under-range,
  • -3 - Over-range,
  • -4 - Watchdog.
See #err_t definition for detailed explanation.

◆ ldc_get_interrupt()

uint8_t ldc_get_interrupt ( ldc_t * ctx)

Get interrupt pin status.

This function reads int_pin status.

Parameters
[in]ctx: Click context object. See ldc_t object definition for detailed explanation.
Returns
Interrupt pin status.

◆ ldc_init()

err_t ldc_init ( ldc_t * ctx,
ldc_cfg_t * cfg )

LDC initialization function.

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

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

◆ ldc_set_shut_down()

void ldc_set_shut_down ( ldc_t * ctx,
uint8_t state )

Set shut down pin status.

This function sets sd pin status.

Parameters
[in]ctx: Click context object. See ldc_t object definition for detailed explanation.
[in]state: Pin state to set.
Returns
Nothing.