adac4 2.2.0
Loading...
Searching...
No Matches
ADAC 4 Click Driver

API for configuring and manipulating ADAC 4 Click driver. More...

Topics

 ADAC 4 Registers List
 List of registers of ADAC 4 Click driver.
 ADAC 4 Registers Settings
 Settings for registers of ADAC 4 Click driver.
 ADAC 4 MikroBUS Map
 MikroBUS pin mapping of ADAC 4 Click driver.

Functions

void adac4_cfg_setup (adac4_cfg_t *cfg)
 ADAC 4 configuration object setup function.
err_t adac4_init (adac4_t *ctx, adac4_cfg_t *cfg)
 ADAC 4 initialization function.
err_t adac4_default_cfg (adac4_t *ctx)
 ADAC 4 default configuration function.
err_t adac4_write_reg (adac4_t *ctx, uint8_t reg, uint16_t data_in)
 ADAC 4 write register function.
err_t adac4_read_reg (adac4_t *ctx, uint8_t reg, uint16_t *data_out)
 ADAC 4 read register function.
void adac4_set_rst_pin (adac4_t *ctx, uint8_t state)
 ADAC 4 set RST pin state function.
void adac4_reset_device (adac4_t *ctx)
 ADAC 4 hardware reset function.
err_t adac4_check_communication (adac4_t *ctx)
 ADAC 4 check communication function.
err_t adac4_write_dac (adac4_t *ctx, uint8_t channel, uint16_t dac_data)
 ADAC 4 write DAC channel function.
err_t adac4_read_raw_adc (adac4_t *ctx, uint8_t channel, uint16_t *raw_adc)
 ADAC 4 read raw ADC value function.
err_t adac4_read_adc_voltage (adac4_t *ctx, uint8_t channel, float *voltage)
 ADAC 4 read ADC voltage function.
err_t adac4_read_die_temp (adac4_t *ctx, float *die_temp)
 ADAC 4 read die temperature function.

Detailed Description

API for configuring and manipulating ADAC 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ adac4_cfg_setup()

void adac4_cfg_setup ( adac4_cfg_t * cfg)

ADAC 4 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See adac4_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ adac4_check_communication()

err_t adac4_check_communication ( adac4_t * ctx)

ADAC 4 check communication function.

This function checks communication by verifying the CHIP ID register.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ adac4_default_cfg()

err_t adac4_default_cfg ( adac4_t * ctx)

ADAC 4 default configuration function.

This function executes a default configuration of ADAC 4 Click board.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ adac4_init()

err_t adac4_init ( adac4_t * ctx,
adac4_cfg_t * cfg )

ADAC 4 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See adac4_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ adac4_read_adc_voltage()

err_t adac4_read_adc_voltage ( adac4_t * ctx,
uint8_t channel,
float * voltage )

ADAC 4 read ADC voltage function.

This function reads an ADC voltage value from the specified channel.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]channel: ADC channel number (0?7).
[out]voltage: Pointer to memory where voltage in volts will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
Requires VREF to be set in the context (internal 2.5V reference by default).

◆ adac4_read_die_temp()

err_t adac4_read_die_temp ( adac4_t * ctx,
float * die_temp )

ADAC 4 read die temperature function.

This function reads and calculates internal die temperature.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[out]die_temp: Pointer to memory where temperature in degrees Celsius will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ adac4_read_raw_adc()

err_t adac4_read_raw_adc ( adac4_t * ctx,
uint8_t channel,
uint16_t * raw_adc )

ADAC 4 read raw ADC value function.

This function reads a raw ADC value from the specified channel.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]channel: ADC channel number (0?7).
[out]raw_adc: Pointer to memory where raw ADC data will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ adac4_read_reg()

err_t adac4_read_reg ( adac4_t * ctx,
uint8_t reg,
uint16_t * data_out )

ADAC 4 read register function.

This function reads a 16-bit value from the specified register.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Pointer to memory where read data will be stored.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ adac4_reset_device()

void adac4_reset_device ( adac4_t * ctx)

ADAC 4 hardware reset function.

This function performs a hardware reset by toggling the RST pin.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ adac4_set_rst_pin()

void adac4_set_rst_pin ( adac4_t * ctx,
uint8_t state )

ADAC 4 set RST pin state function.

This function sets the RST pin to the specified logic level.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]state: Pin logic level (0 or 1).
Returns
None.
Note
None.

◆ adac4_write_dac()

err_t adac4_write_dac ( adac4_t * ctx,
uint8_t channel,
uint16_t dac_data )

ADAC 4 write DAC channel function.

This function writes a value to the specified DAC channel.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]channel: DAC channel number (0?7).
[in]dac_data: 12-bit DAC data.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.

◆ adac4_write_reg()

err_t adac4_write_reg ( adac4_t * ctx,
uint8_t reg,
uint16_t data_in )

ADAC 4 write register function.

This function writes a 16-bit value to the specified register.

Parameters
[in]ctx: Click context object. See adac4_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: 16-bit data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
Note
None.