adac2 2.1.0.0
|
API for configuring and manipulating ADAC 2 Click driver. More...
Topics | |
ADAC 2 Registers List | |
List of registers of ADAC 2 Click driver. | |
ADAC 2 Registers Settings | |
Settings for registers of ADAC 2 Click driver. | |
ADAC 2 MikroBUS Map | |
MikroBUS pin mapping of ADAC 2 Click driver. | |
Functions | |
void | adac2_cfg_setup (adac2_cfg_t *cfg) |
ADAC 2 configuration object setup function. | |
err_t | adac2_init (adac2_t *ctx, adac2_cfg_t *cfg) |
ADAC 2 initialization function. | |
err_t | adac2_default_cfg (adac2_t *ctx) |
ADAC 2 default configuration function. | |
err_t | adac2_write_register (adac2_t *ctx, uint8_t reg, uint32_t data_in) |
ADAC 2 write register function. | |
err_t | adac2_read_register (adac2_t *ctx, uint8_t reg, uint32_t *data_out) |
ADAC 2 read register function. | |
err_t | adac2_enable_spi_crc (adac2_t *ctx) |
ADAC 2 enable spi crc function. | |
err_t | adac2_disable_spi_crc (adac2_t *ctx) |
ADAC 2 disable spi crc function. | |
err_t | adac2_check_communication (adac2_t *ctx) |
ADAC 2 check communication function. | |
void | adac2_reset_device (adac2_t *ctx) |
ADAC 2 reset device function. | |
uint8_t | adac2_get_rdy_pin (adac2_t *ctx) |
ADAC 2 get rdy pin function. | |
uint8_t | adac2_get_int_pin (adac2_t *ctx) |
ADAC 2 get int pin function. | |
err_t | adac2_start_conversion (adac2_t *ctx, uint8_t data_rate) |
ADAC 2 start conversion function. | |
err_t | adac2_stop_conversion (adac2_t *ctx) |
ADAC 2 stop conversion function. | |
err_t | adac2_set_conversion_mode (adac2_t *ctx, uint8_t mode) |
ADAC 2 set conversion mode function. | |
err_t | adac2_set_active_ain_channel (adac2_t *ctx, uint8_t channel) |
ADAC 2 set active ain channel function. | |
err_t | adac2_read_raw_adc (adac2_t *ctx, int32_t *raw_adc) |
ADAC 2 read raw adc function. | |
err_t | adac2_read_voltage (adac2_t *ctx, float fsr, float *voltage) |
ADAC 2 read voltage function. | |
err_t | adac2_write_dac (adac2_t *ctx, int32_t dac) |
ADAC 2 write dac function. | |
API for configuring and manipulating ADAC 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 adac2_cfg_setup | ( | adac2_cfg_t * | cfg | ) |
ADAC 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See adac2_cfg_t object definition for detailed explanation. |
err_t adac2_check_communication | ( | adac2_t * | ctx | ) |
ADAC 2 check communication function.
This function checks the communication by reading and verifying the product ID.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adac2_default_cfg | ( | adac2_t * | ctx | ) |
ADAC 2 default configuration function.
This function executes a default configuration of ADAC 2 click board.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t adac2_disable_spi_crc | ( | adac2_t * | ctx | ) |
ADAC 2 disable spi crc function.
This function disables SPI CRC.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adac2_enable_spi_crc | ( | adac2_t * | ctx | ) |
ADAC 2 enable spi crc function.
This function enables SPI CRC.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
0
- Success, -1
- Error. uint8_t adac2_get_int_pin | ( | adac2_t * | ctx | ) |
ADAC 2 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
uint8_t adac2_get_rdy_pin | ( | adac2_t * | ctx | ) |
ADAC 2 get rdy pin function.
This function returns the RDY pin logic state.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
err_t adac2_init | ( | adac2_t * | ctx, |
adac2_cfg_t * | cfg ) |
ADAC 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See adac2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t adac2_read_raw_adc | ( | adac2_t * | ctx, |
int32_t * | raw_adc ) |
ADAC 2 read raw adc function.
This function reads RAW ADC value of previous conversion.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[out] | raw_adc | : 24-bit RAW ADC value (signed). |
0
- Success, -1
- Error. err_t adac2_read_register | ( | adac2_t * | ctx, |
uint8_t | reg, | ||
uint32_t * | data_out ) |
ADAC 2 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 adac2_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 adac2_read_voltage | ( | adac2_t * | ctx, |
float | fsr, | ||
float * | voltage ) |
ADAC 2 read voltage function.
This function reads RAW ADC value of previous conversion and converts it to voltage.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | fsr | : Full scale range for analog input. |
[out] | voltage | : Voltage in fsr range. |
0
- Success, -1
- Error. void adac2_reset_device | ( | adac2_t * | ctx | ) |
ADAC 2 reset device function.
This function resets the device by toggling the RST pin.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
err_t adac2_set_active_ain_channel | ( | adac2_t * | ctx, |
uint8_t | channel ) |
ADAC 2 set active ain channel function.
This function sets the active analog input channel.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | channel | : Channel selection byte [0x00-0x19]. |
0
- Success, -1
- Error. err_t adac2_set_conversion_mode | ( | adac2_t * | ctx, |
uint8_t | mode ) |
ADAC 2 set conversion mode function.
This function sets the conversion mode by writing to the DCHNL_CTRL1 register.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | mode | : Conversion mode.
|
0
- Success, -1
- Error. err_t adac2_start_conversion | ( | adac2_t * | ctx, |
uint8_t | data_rate ) |
ADAC 2 start conversion function.
This function starts the conversion with the selected data rate.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | data_rate | : Data rate [0x00-0x0F]. |
0
- Success, -1
- Error. err_t adac2_stop_conversion | ( | adac2_t * | ctx | ) |
ADAC 2 stop conversion function.
This function stops the conversion.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
0
- Success, -1
- Error. err_t adac2_write_dac | ( | adac2_t * | ctx, |
int32_t | dac ) |
ADAC 2 write dac function.
This function sets the analog output by writing to the AO_DATA_WR register.
[in] | ctx | : Click context object. See adac2_t object definition for detailed explanation. |
[in] | dac | : DAC raw data [-131072, +131071]. |
0
- Success, -1
- Error. err_t adac2_write_register | ( | adac2_t * | ctx, |
uint8_t | reg, | ||
uint32_t | data_in ) |
ADAC 2 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 adac2_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.