adc18 2.0.0.0
|
API for configuring and manipulating ADC 18 Click driver. More...
Topics | |
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. | |
err_t | adc18_init (adc18_t *ctx, adc18_cfg_t *cfg) |
ADC 18 initialization function. | |
err_t | adc18_default_cfg (adc18_t *ctx) |
ADC 18 default configuration function. | |
err_t | adc18_write_register (adc18_t *ctx, uint8_t reg, uint32_t data_in) |
ADC 18 write register function. | |
err_t | adc18_read_register (adc18_t *ctx, uint8_t reg, uint32_t *data_out) |
ADC 18 read register function. | |
err_t | adc18_enable_spi_crc (adc18_t *ctx) |
ADC 18 enable spi crc function. | |
err_t | adc18_disable_spi_crc (adc18_t *ctx) |
ADC 18 disable spi crc function. | |
err_t | adc18_check_communication (adc18_t *ctx) |
ADC 18 check communication function. | |
void | adc18_reset_device (adc18_t *ctx) |
ADC 18 reset device function. | |
uint8_t | adc18_get_rdy_pin (adc18_t *ctx) |
ADC 18 get rdy pin function. | |
uint8_t | adc18_get_int_pin (adc18_t *ctx) |
ADC 18 get int pin function. | |
err_t | adc18_start_conversion (adc18_t *ctx, uint8_t data_rate) |
ADC 18 start conversion function. | |
err_t | adc18_stop_conversion (adc18_t *ctx) |
ADC 18 stop conversion function. | |
err_t | adc18_set_conversion_mode (adc18_t *ctx, uint8_t mode) |
ADC 18 set conversion mode function. | |
err_t | adc18_set_active_channel (adc18_t *ctx, uint8_t channel) |
ADC 18 set active channel function. | |
err_t | adc18_read_raw_adc (adc18_t *ctx, int32_t *raw_adc) |
ADC 18 read raw adc function. | |
err_t | adc18_read_voltage (adc18_t *ctx, float *voltage) |
ADC 18 read voltage function. | |
API for configuring and manipulating ADC 18 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
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.