ldc2 2.0.0.0
|
API for configuring and manipulating LDC 2 Click driver. More...
Topics | |
LDC 2 Registers List | |
List of registers of LDC 2 Click driver. | |
LDC 2 Registers Settings | |
Settings for registers of LDC 2 Click driver. | |
LDC 2 MikroBUS Map | |
MikroBUS pin mapping of LDC 2 Click driver. | |
Functions | |
void | ldc2_cfg_setup (ldc2_cfg_t *cfg) |
LDC 2 configuration object setup function. | |
err_t | ldc2_init (ldc2_t *ctx, ldc2_cfg_t *cfg) |
LDC 2 initialization function. | |
err_t | ldc2_default_cfg (ldc2_t *ctx) |
LDC 2 default configuration function. | |
err_t | ldc2_generic_write (ldc2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
LDC 2 data writing function. | |
err_t | ldc2_generic_read (ldc2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
LDC 2 data reading function. | |
err_t | ldc2_check_device_id (ldc2_t *ctx) |
LDC 2 check device ID function. | |
err_t | ldc2_set_rp_range (ldc2_t *ctx, ldc2_rp_range_t rp_min, ldc2_rp_range_t rp_max) |
LDC 2 set Rp range function. | |
err_t | ldc2_set_ldc_config (ldc2_t *ctx, ldc2_amplitude_t amplitude, ldc2_resp_time_t res_time) |
LDC 2 set LDC config function. | |
err_t | ldc2_set_comparator_threshold (ldc2_t *ctx, uint8_t thld_low, uint8_t thld_high) |
LDC 2 set comparator threshold function. | |
err_t | ldc2_set_interrupt_mode (ldc2_t *ctx, ldc2_int_mode_t mode) |
LDC 2 set interrupt mode function. | |
err_t | ldc2_set_power_mode (ldc2_t *ctx, ldc2_pwr_mode_t mode) |
LDC 2 set power mode function. | |
err_t | ldc2_get_status (ldc2_t *ctx, uint8_t *status) |
LDC 2 get status function. | |
err_t | ldc2_read_raw_data (ldc2_t *ctx, uint8_t *prox_data, uint32_t *freq_cnt) |
LDC 2 read raw data function. | |
err_t | ldc2_get_response_time (ldc2_t *ctx, uint16_t *res_time) |
LDC 2 get response time function. | |
err_t | ldc2_get_sensor_frequency (ldc2_t *ctx, float *freq) |
LDC 2 get sensor frequency function. | |
err_t | ldc2_get_rp_range (ldc2_t *ctx, float *rp_min, float *rp_max) |
LDC 2 get Rp range function. | |
err_t | ldc2_set_wdt_frequency (ldc2_t *ctx) |
LDC 2 set watchdog timer frequency function. | |
uint8_t | ldc2_get_int_pin (ldc2_t *ctx) |
LDC 2 get int pin function. | |
err_t | ldc2_measure_resonance_impedance (ldc2_t *ctx, uint8_t *prox_data, float *rp_data) |
LDC 2 measure resonance impedance function. | |
err_t | ldc2_measure_inductance (ldc2_t *ctx, float *freq, float *inductance) |
LDC 2 measure inductance function. | |
API for configuring and manipulating LDC 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void ldc2_cfg_setup | ( | ldc2_cfg_t * | cfg | ) |
LDC 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ldc2_cfg_t object definition for detailed explanation. |
err_t ldc2_check_device_id | ( | ldc2_t * | ctx | ) |
LDC 2 check device ID function.
This function reads and verifies the device ID.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
0
- Success, -1
- Error, wrong ID read. See #err_t definition for detailed explanation. err_t ldc2_default_cfg | ( | ldc2_t * | ctx | ) |
LDC 2 default configuration function.
This function executes a default configuration of LDC 2 click board.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_generic_read | ( | ldc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
LDC 2 data reading function.
This function reads a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See ldc2_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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_generic_write | ( | ldc2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
LDC 2 data writing function.
This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See ldc2_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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t ldc2_get_int_pin | ( | ldc2_t * | ctx | ) |
LDC 2 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
err_t ldc2_get_response_time | ( | ldc2_t * | ctx, |
uint16_t * | res_time ) |
LDC 2 get response time function.
This function reads the response time value from the desired register and converts it to real response time value.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | res_time | : Real response time value. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_get_rp_range | ( | ldc2_t * | ctx, |
float * | rp_min, | ||
float * | rp_max ) |
LDC 2 get Rp range function.
This function reads the Rp min and max values from the desired registers and converts them to resistance in kOhm.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | rp_min | : Rp min value in kOhm. |
[out] | rp_max | : Rp max value in kOhm. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_get_sensor_frequency | ( | ldc2_t * | ctx, |
float * | freq ) |
LDC 2 get sensor frequency function.
This function reads and calculates the sensor frequency.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | freq | : Sensor frequency in MHz. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_get_status | ( | ldc2_t * | ctx, |
uint8_t * | status ) |
LDC 2 get status function.
This function reads the status register.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | status | : Status register content. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_init | ( | ldc2_t * | ctx, |
ldc2_cfg_t * | cfg ) |
LDC 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ldc2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_measure_inductance | ( | ldc2_t * | ctx, |
float * | freq, | ||
float * | inductance ) |
LDC 2 measure inductance function.
This function measures the inductance and sensor frequency.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | freq | : Sensor frequency in MHz. |
[out] | inductance | : Inductance in uH. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_measure_resonance_impedance | ( | ldc2_t * | ctx, |
uint8_t * | prox_data, | ||
float * | rp_data ) |
LDC 2 measure resonance impedance function.
This function measures the resonance impedance and proximity data.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | prox_data | : Proximity data. |
[out] | rp_data | : Resonance impedance value in kOhm. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_read_raw_data | ( | ldc2_t * | ctx, |
uint8_t * | prox_data, | ||
uint32_t * | freq_cnt ) |
LDC 2 read raw data function.
This function reads the proximity and frequency counter data.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[out] | prox_data | : Proximity data [8-bit]. |
[out] | freq_cnt | : Frequency counter data [24-bit]. |
0
- Success, 0x40
- No new data available, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_comparator_threshold | ( | ldc2_t * | ctx, |
uint8_t | thld_low, | ||
uint8_t | thld_high ) |
LDC 2 set comparator threshold function.
This function sets the comparator threshold low and high values.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | thld_low | : Low threshold. |
[in] | thld_high | : High threshold. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_interrupt_mode | ( | ldc2_t * | ctx, |
ldc2_int_mode_t | mode ) |
LDC 2 set interrupt mode function.
This function sets the interrupt pin mode.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | mode | : Interrupt mode. See ldc2_int_mode_t enum definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_ldc_config | ( | ldc2_t * | ctx, |
ldc2_amplitude_t | amplitude, | ||
ldc2_resp_time_t | res_time ) |
LDC 2 set LDC config function.
This function sets the oscillation amplitude and response time of the LDC config register.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | amplitude | : Oscillation amplitude. See ldc2_amplitude_t enum definition for detailed explanation. |
[in] | res_time | : Response time. See ldc2_resp_time_t enum definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_power_mode | ( | ldc2_t * | ctx, |
ldc2_pwr_mode_t | mode ) |
LDC 2 set power mode function.
This function sets the power mode.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | mode | : Power mode. See ldc2_pwr_mode_t enum definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_rp_range | ( | ldc2_t * | ctx, |
ldc2_rp_range_t | rp_min, | ||
ldc2_rp_range_t | rp_max ) |
LDC 2 set Rp range function.
This function sets the Rp min and max registers.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
[in] | rp_min | : Rp min value. |
[in] | rp_max | : Rp max value. See ldc2_rp_range_t enum definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ldc2_set_wdt_frequency | ( | ldc2_t * | ctx | ) |
LDC 2 set watchdog timer frequency function.
This function sets the watchdog timer frequency based on the lowest sensor frequency.
[in] | ctx | : Click context object. See ldc2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.