adc13
2.0.0.0
|
API for configuring and manipulating ADC 13 Click driver. More...
Modules | |
ADC 13 Commands List | |
List of commands of ADC 13 Click driver. | |
ADC 13 Registers List | |
List of registers of ADC 13 Click driver. | |
ADC 13 Registers Settings | |
Settings for registers of ADC 13 Click driver. | |
ADC 13 MikroBUS Map | |
MikroBUS pin mapping of ADC 13 Click driver. | |
Functions | |
void | adc13_cfg_setup (adc13_cfg_t *cfg) |
ADC 13 configuration object setup function. More... | |
err_t | adc13_init (adc13_t *ctx, adc13_cfg_t *cfg) |
ADC 13 initialization function. More... | |
err_t | adc13_default_cfg (adc13_t *ctx) |
ADC 13 default configuration function. More... | |
err_t | adc13_generic_write (adc13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
ADC 13 data writing function. More... | |
err_t | adc13_generic_read (adc13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
ADC 13 data reading function. More... | |
err_t | adc13_send_command (adc13_t *ctx, uint8_t cmd) |
ADC 13 send command function. More... | |
void | adc13_set_str_pin (adc13_t *ctx, uint8_t state) |
ADC 13 set STR pin function. More... | |
void | adc13_set_rst_pin (adc13_t *ctx, uint8_t state) |
ADC 13 set RST pin function. More... | |
uint8_t | adc13_get_dtr_pin (adc13_t *ctx) |
ADC 13 get DTR pin function. More... | |
void | adc13_reset_by_pin (adc13_t *ctx) |
ADC 13 reset by pin function. More... | |
err_t | adc13_reset_by_command (adc13_t *ctx) |
ADC 13 reset by command function. More... | |
void | adc13_power_down (adc13_t *ctx) |
ADC 13 power down function. More... | |
void | adc13_power_up (adc13_t *ctx) |
ADC 13 power up function. More... | |
err_t | adc13_read_register (adc13_t *ctx, uint8_t reg, uint8_t *data_out) |
ADC 13 read register function. More... | |
err_t | adc13_write_register (adc13_t *ctx, uint8_t reg, uint8_t data_in) |
ADC 13 write register function. More... | |
err_t | adc13_read_registers (adc13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t count) |
ADC 13 read registers function. More... | |
err_t | adc13_write_registers (adc13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t count) |
ADC 13 write registers function. More... | |
err_t | adc13_set_register_bits (adc13_t *ctx, uint8_t reg, uint8_t bit_mask, uint8_t data_in) |
ADC 13 set register bits function. More... | |
err_t | adc13_get_register_bits (adc13_t *ctx, uint8_t reg, uint8_t bit_mask, uint8_t *data_out) |
ADC 13 get register bits function. More... | |
err_t | adc13_read_raw_data (adc13_t *ctx, int32_t *data_out) |
ADC 13 read raw data function. More... | |
err_t | adc13_measure_voltage (adc13_t *ctx, float vref, float *voltage) |
ADC 13 measure voltage function. More... | |
err_t | adc13_measure_temperature (adc13_t *ctx, float *temperature) |
ADC 13 measure temperature function. More... | |
err_t | adc13_set_input_channel (adc13_t *ctx, uint8_t pos, uint8_t neg) |
ADC 13 set input channel function. More... | |
err_t | adc13_set_voltage_reference (adc13_t *ctx, uint8_t pos, uint8_t neg) |
ADC 13 set voltage reference function. More... | |
err_t | adc13_set_gain (adc13_t *ctx, uint8_t gain) |
ADC 13 set gain function. More... | |
err_t | adc13_set_sample_rate (adc13_t *ctx, uint8_t s_rate) |
ADC 13 set sample rate function. More... | |
API for configuring and manipulating ADC 13 Click driver.
void adc13_cfg_setup | ( | adc13_cfg_t * | cfg | ) |
ADC 13 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See adc13_cfg_t object definition for detailed explanation. |
err_t adc13_default_cfg | ( | adc13_t * | ctx | ) |
ADC 13 default configuration function.
This function executes a default configuration of ADC 13 click board.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t adc13_generic_read | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
ADC 13 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 adc13_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.err_t adc13_generic_write | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
ADC 13 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 adc13_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.uint8_t adc13_get_dtr_pin | ( | adc13_t * | ctx | ) |
ADC 13 get DTR pin function.
This function returns the DTR (data ready indicator) pin logic state.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
err_t adc13_get_register_bits | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t | bit_mask, | ||
uint8_t * | data_out | ||
) |
ADC 13 get register bits function.
This function reads a desired bits of input register using the appropriate bit mask.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | bit_mask | : Bit mask. |
[out] | data_out | : Readout bits. |
0
- Success, -1
- Error.err_t adc13_init | ( | adc13_t * | ctx, |
adc13_cfg_t * | cfg | ||
) |
ADC 13 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See adc13_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t adc13_measure_temperature | ( | adc13_t * | ctx, |
float * | temperature | ||
) |
ADC 13 measure temperature function.
This function measures the internal temperature in Celsius.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[out] | temperature | : Temperature in Celsius. |
0
- Success, -1
- Error.err_t adc13_measure_voltage | ( | adc13_t * | ctx, |
float | vref, | ||
float * | voltage | ||
) |
ADC 13 measure voltage function.
This function starts ADC conversation, reads RAW ADC data then calculates the voltage using the input vref for calculations.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | vref | : Voltage reference (either in volts or milivolts). |
[out] | data_out | : RAW ADC data read. |
0
- Success, -1
- Error.void adc13_power_down | ( | adc13_t * | ctx | ) |
ADC 13 power down function.
This function powers down the chip via the RST pin.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
void adc13_power_up | ( | adc13_t * | ctx | ) |
ADC 13 power up function.
This function powers up the chip via the RST pin.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
err_t adc13_read_raw_data | ( | adc13_t * | ctx, |
int32_t * | data_out | ||
) |
ADC 13 read raw data function.
This function reads raw ADC data after the conversation is finished.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[out] | data_out | : RAW ADC data read. |
0
- Success, -1
- Error.err_t adc13_read_register | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out | ||
) |
ADC 13 read register function.
This function reads a data byte from a desider register by using SPI serial interface.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t adc13_read_registers | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | count | ||
) |
ADC 13 read registers function.
This function reads a desired number of registers starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | count | : Number of registers to be read. |
0
- Success, -1
- Error.err_t adc13_reset_by_command | ( | adc13_t * | ctx | ) |
ADC 13 reset by command function.
This function resets the chip by issuing the RESET command.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
0
- Success, -1
- Error.void adc13_reset_by_pin | ( | adc13_t * | ctx | ) |
ADC 13 reset by pin function.
This function resets the chip by toggling the RST pin state.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
err_t adc13_send_command | ( | adc13_t * | ctx, |
uint8_t | cmd | ||
) |
ADC 13 send command function.
This function writes a command byte to the module by using SPI serial interface.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | cmd | : Command byte. |
0
- Success, -1
- Error.err_t adc13_set_gain | ( | adc13_t * | ctx, |
uint8_t | gain | ||
) |
ADC 13 set gain function.
This function sets the ADC gain.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | gain | : Gain value [0-5]. |
0
- Success, -1
- Error.err_t adc13_set_input_channel | ( | adc13_t * | ctx, |
uint8_t | pos, | ||
uint8_t | neg | ||
) |
ADC 13 set input channel function.
This function sets the ADC input positive and negative channels.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | pos | : Positive channel. |
[in] | neg | : Negative channel. |
0
- Success, -1
- Error.err_t adc13_set_register_bits | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t | bit_mask, | ||
uint8_t | data_in | ||
) |
ADC 13 set register bits function.
This function sets a desired bits of input register using the appropriate bit mask, other bits remain unchanged.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | bit_mask | : Bit mask. |
[in] | data_in | : Bits to be set. |
0
- Success, -1
- Error.void adc13_set_rst_pin | ( | adc13_t * | ctx, |
uint8_t | state | ||
) |
ADC 13 set RST pin function.
This function sets reset or power down by setting the RST pin logic state.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t adc13_set_sample_rate | ( | adc13_t * | ctx, |
uint8_t | s_rate | ||
) |
ADC 13 set sample rate function.
This function sets the ADC sample rate.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | s_rate | : Sample rate value [0-15]. |
0
- Success, -1
- Error.void adc13_set_str_pin | ( | adc13_t * | ctx, |
uint8_t | state | ||
) |
ADC 13 set STR pin function.
This function sets start conversion control by setting the STR pin logic state.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t adc13_set_voltage_reference | ( | adc13_t * | ctx, |
uint8_t | pos, | ||
uint8_t | neg | ||
) |
ADC 13 set voltage reference function.
This function sets the ADC inputs for positive and negative voltage reference.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | pos | : Positive reference. |
[in] | neg | : Negative reference. |
0
- Success, -1
- Error.err_t adc13_write_register | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in | ||
) |
ADC 13 write register function.
This function writes a data byte to a desider register by using SPI serial interface.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t adc13_write_registers | ( | adc13_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | count | ||
) |
ADC 13 write registers function.
This function writes a desired number of registers starting from the selected register by using SPI serial interface.
[in] | ctx | : Click context object. See adc13_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | count | : Number of registers to be written. |
0
- Success, -1
- Error.