adc18
2.0.0.0
|
API for configuring and manipulating ADC 18 Click driver. More...
Modules | |
ADC 18 Registers List | |
List of registers of ADC 18 Click driver. | |
ADC 18 Registers Settings | |
Settings for registers of ADC 18 Click driver. | |
ADC 18 MikroBUS Map | |
MikroBUS pin mapping of ADC 18 Click driver. | |
Functions | |
void | adc18_cfg_setup (adc18_cfg_t *cfg) |
ADC 18 configuration object setup function. More... | |
err_t | adc18_init (adc18_t *ctx, adc18_cfg_t *cfg) |
ADC 18 initialization function. More... | |
err_t | adc18_default_cfg (adc18_t *ctx) |
ADC 18 default configuration function. More... | |
err_t | adc18_write_register (adc18_t *ctx, uint8_t reg, uint32_t data_in) |
ADC 18 write register function. More... | |
err_t | adc18_read_register (adc18_t *ctx, uint8_t reg, uint32_t *data_out) |
ADC 18 read register function. More... | |
err_t | adc18_enable_spi_crc (adc18_t *ctx) |
ADC 18 enable spi crc function. More... | |
err_t | adc18_disable_spi_crc (adc18_t *ctx) |
ADC 18 disable spi crc function. More... | |
err_t | adc18_check_communication (adc18_t *ctx) |
ADC 18 check communication function. More... | |
void | adc18_reset_device (adc18_t *ctx) |
ADC 18 reset device function. More... | |
uint8_t | adc18_get_rdy_pin (adc18_t *ctx) |
ADC 18 get rdy pin function. More... | |
uint8_t | adc18_get_int_pin (adc18_t *ctx) |
ADC 18 get int pin function. More... | |
err_t | adc18_start_conversion (adc18_t *ctx, uint8_t data_rate) |
ADC 18 start conversion function. More... | |
err_t | adc18_stop_conversion (adc18_t *ctx) |
ADC 18 stop conversion function. More... | |
err_t | adc18_set_conversion_mode (adc18_t *ctx, uint8_t mode) |
ADC 18 set conversion mode function. More... | |
err_t | adc18_set_active_channel (adc18_t *ctx, uint8_t channel) |
ADC 18 set active channel function. More... | |
err_t | adc18_read_raw_adc (adc18_t *ctx, int32_t *raw_adc) |
ADC 18 read raw adc function. More... | |
err_t | adc18_read_voltage (adc18_t *ctx, float *voltage) |
ADC 18 read voltage function. More... | |
API for configuring and manipulating ADC 18 Click driver.
void adc18_cfg_setup | ( | adc18_cfg_t * | cfg | ) |
ADC 18 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See adc18_cfg_t object definition for detailed explanation. |
err_t adc18_check_communication | ( | adc18_t * | ctx | ) |
ADC 18 check communication function.
This function checks the communication by reading and verifying the product ID.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adc18_default_cfg | ( | adc18_t * | ctx | ) |
ADC 18 default configuration function.
This function executes a default configuration of ADC 18 click board.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t adc18_disable_spi_crc | ( | adc18_t * | ctx | ) |
ADC 18 disable spi crc function.
This function disables SPI CRC.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adc18_enable_spi_crc | ( | adc18_t * | ctx | ) |
ADC 18 enable spi crc function.
This function enables SPI CRC.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
0
- Success, -1
- Error. uint8_t adc18_get_int_pin | ( | adc18_t * | ctx | ) |
ADC 18 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
uint8_t adc18_get_rdy_pin | ( | adc18_t * | ctx | ) |
ADC 18 get rdy pin function.
This function returns the RDY pin logic state.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
err_t adc18_init | ( | adc18_t * | ctx, |
adc18_cfg_t * | cfg | ||
) |
ADC 18 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See adc18_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t adc18_read_raw_adc | ( | adc18_t * | ctx, |
int32_t * | raw_adc | ||
) |
ADC 18 read raw adc function.
This function reads RAW ADC value of previous conversion.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[out] | raw_adc | : 24-bit RAW ADC value (signed). |
0
- Success, -1
- Error. err_t adc18_read_register | ( | adc18_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out | ||
) |
ADC 18 read register function.
This function reads a 24-bit data from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : 24-bit data output read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t adc18_read_voltage | ( | adc18_t * | ctx, |
float * | voltage | ||
) |
ADC 18 read voltage function.
This function reads RAW ADC value of previous conversion and converts it to voltage.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[out] | voltage | : Voltage in range -12.5V to +12.5V. |
0
- Success, -1
- Error. void adc18_reset_device | ( | adc18_t * | ctx | ) |
ADC 18 reset device function.
This function resets the device by toggling the RST pin.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
err_t adc18_set_active_channel | ( | adc18_t * | ctx, |
uint8_t | channel | ||
) |
ADC 18 set active channel function.
This function sets the active channel.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | channel | : Channel selection byte [0x00-0x19]. |
0
- Success, -1
- Error. err_t adc18_set_conversion_mode | ( | adc18_t * | ctx, |
uint8_t | mode | ||
) |
ADC 18 set conversion mode function.
This function sets the conversion mode by writing to the DCHNL_CTRL1 register.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | mode | : Conversion mode.
|
0
- Success, -1
- Error. err_t adc18_start_conversion | ( | adc18_t * | ctx, |
uint8_t | data_rate | ||
) |
ADC 18 start conversion function.
This function starts the conversion with the selected data rate.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | data_rate | : Data rate [0x00-0x0F]. |
0
- Success, -1
- Error. err_t adc18_stop_conversion | ( | adc18_t * | ctx | ) |
ADC 18 stop conversion function.
This function stops the conversion.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adc18_write_register | ( | adc18_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in | ||
) |
ADC 18 write register function.
This function writes a 24-bit data to the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See adc18_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 24-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.