ldc 2.0.0.0
ldc.h File Reference

This file contains API for LDC Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  ldc_t
 LDC Click context object. More...
 
struct  ldc_cfg_t
 LDC Click configuration object. More...
 

Macros

#define LDC_REG_DATA_CH0   0x00
 LDC description register.
 
#define LDC_REG_DATA_CH1   0x02
 
#define LDC_REG_RCOUNT_CH0   0x08
 
#define LDC_REG_RCOUNT_CH1   0x09
 
#define LDC_REG_OFFSET_CH0   0x0C
 
#define LDC_REG_OFFSET_CH1   0x0D
 
#define LDC_REG_SETTLECOUNT_CH0   0x10
 
#define LDC_REG_SETTLECOUNT_CH1   0x11
 
#define LDC_REG_CLOCK_DIVIDERS_CH0   0x14
 
#define LDC_REG_CLOCK_DIVIDERS_CH1   0x15
 
#define LDC_REG_STATUS   0x18
 
#define LDC_REG_ERROR_CONFIG   0x19
 
#define LDC_REG_CONFIG   0x1A
 
#define LDC_REG_MUX_CONFIG   0x1B
 
#define LDC_REG_RESET_DEV   0x1C
 
#define LDC_REG_DRIVE_CURRENT_CH0   0x1E
 
#define LDC_REG_DRIVE_CURRENT_CH1   0x1F
 
#define LDC_REG_MANUFACTURER_ID   0x7E
 
#define LDC_REG_DEVICE_ID   0x7F
 
#define LDC_MANUFACTURER_ID   0x5449
 LDC identification data.
 
#define LDC_DEVICE_ID   0x3054
 
#define LDC_INTERNAL_FREQUENCY   43.4/*<MHz*/
 LDC measurement data.
 
#define LDC_FREQUENCY_RESOLUTION   4096
 
#define LDC_SENSOR_CAPACITANCE   0.00022/*<uF*/
 
#define LDC_MATH_TWO_PI   6.28318530717958
 
#define LDC_GAIN_1   0x0000
 Gain configuration.
 
#define LDC_GAIN_4   0x0200
 
#define LDC_GAIN_8   0x0400
 
#define LDC_GAIN_16   0x0600
 
#define LDC_OVER_RANGE   0x8
 Error status data from data register.
 
#define LDC_UNDER_RANGE   0x4
 
#define LDC_WATCHDOG   0x3
 
#define LDC_STATUS_DRDY   0x0040
 Status register.
 
#define LDC_SET_DEV_ADDR   0x2B
 LDC device address setting.
 
#define LDC_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  ldc_return_value_t {
  LDC_OK = 0 , LDC_ERROR = -1 , LDC_ERROR_UNDER_RANGE = -2 , LDC_ERROR_OVER_RANGE = -3 ,
  LDC_ERROR_WATCHDOG = -4
}
 LDC Click return value data. More...
 

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

This file contains API for LDC Click Driver.

Enumeration Type Documentation

◆ ldc_return_value_t

LDC Click return value data.

Predefined enum values for driver return values.

Enumerator
LDC_OK 
LDC_ERROR 
LDC_ERROR_UNDER_RANGE 
LDC_ERROR_OVER_RANGE 
LDC_ERROR_WATCHDOG