adc4 2.0.0.0
Public function

Functions

void adc4_cfg_setup (adc4_cfg_t *cfg)
 Config Object Initialization function.
 
ADC4_RETVAL adc4_init (adc4_t *ctx, adc4_cfg_t *cfg)
 Initialization function.
 
void adc4_default_cfg (adc4_t *ctx)
 Click Default Configuration function.
 
void adc4_generic_transfer (adc4_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t adc4_write_reg (adc4_t *ctx, const uint8_t reg_address, uint8_t *value)
 Generic Write Function.
 
uint8_t adc4_read_reg (adc4_t *ctx, const uint8_t reg_address, uint8_t *value)
 Generic Write Function.
 
void adc4_reset (adc4_t *ctx)
 Reset function.
 
uint8_t adc4_get_err_pin (adc4_t *ctx)
 Error check function.
 
void adc4_get_config (adc4_t *ctx, uint8_t reg_address, uint16_t *value)
 Get configuration function.
 
void adc4_set_config (adc4_t *ctx, const uint8_t reg_address, uint16_t value)
 Set configuration function.
 
uint32_t adc4_get_data (adc4_t *ctx)
 Get data function.
 
uint16_t adc4_get_voltage (adc4_t *ctx, const float ref_voltage)
 Get voltage function.
 

Detailed Description

Function Documentation

◆ adc4_cfg_setup()

void adc4_cfg_setup ( adc4_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ adc4_default_cfg()

void adc4_default_cfg ( adc4_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for ADC 4 click.

◆ adc4_generic_transfer()

void adc4_generic_transfer ( adc4_t * ctx,
uint8_t * wr_buf,
uint16_t wr_len,
uint8_t * rd_buf,
uint16_t rd_len )

Generic transfer function.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer
Note
     Set: ADC4_CH_REG_BASE
             - ADC4_CH_EN
     Set: ADC4_MODE_REG
             - ADC4_MODE_INT_REF_AND_SING_CYC_EN
     Set: ADC4_IFACE_MODE_REG
             - ADC4_IFACE_MODE_CRC_DIS
     Set: ADC4_GPIO_CONFIG_REG
             - ADC4_CFG_SYNC_EN
     Set: ADC4_SETUP_CONFIGURATION_REG
             - 0x1320
@description Generic SPI transfer, for sending and receiving packages

◆ adc4_get_config()

void adc4_get_config ( adc4_t * ctx,
uint8_t reg_address,
uint16_t * value )

Get configuration function.

Parameters
ctxClick object.
reg_addressregister address
valuepointer when output data will be storaged

@description This function writes value of configuration registers in storage determined by pointer value.

◆ adc4_get_data()

uint32_t adc4_get_data ( adc4_t * ctx)

Get data function.

Parameters
ctxClick object.
Returns
24-bit data from register

@description This function checks ready bit, is data ready or not, and returns 24-bit value from data register.

◆ adc4_get_err_pin()

uint8_t adc4_get_err_pin ( adc4_t * ctx)

Error check function.

Parameters
ctxClick object.
Returns
state of INT pin

@description This function returns value of INT (ERROR) pin witch is controlled by ERR_DAT bit in the GPIOCON register.

◆ adc4_get_voltage()

uint16_t adc4_get_voltage ( adc4_t * ctx,
const float ref_voltage )

Get voltage function.

Parameters
ctxClick object.
ref_voltageReferent voltage for ADC conversion
Returns
calculated 16-bit ADC voltage value

@description This function returns 16-bit calculated and AD converted voltage value.

◆ adc4_init()

ADC4_RETVAL adc4_init ( adc4_t * ctx,
adc4_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ adc4_read_reg()

uint8_t adc4_read_reg ( adc4_t * ctx,
const uint8_t reg_address,
uint8_t * value )

Generic Write Function.

Parameters
ctxClick object.
reg_addressregister address
valuepointer when output data will be storaged
Returns
n_bytes - number of bytes to be read

@description Function reads data from register determined by register address parametar of function.

◆ adc4_reset()

void adc4_reset ( adc4_t * ctx)

Reset function.

Parameters
ctxClick object.

@description This function reset ADC 4 click.

◆ adc4_set_config()

void adc4_set_config ( adc4_t * ctx,
const uint8_t reg_address,
uint16_t value )

Set configuration function.

Parameters
ctxClick object.
reg_addressregister address
value16-bit value to be written

@description This function writes 16-bit value in configuration registers determined by register address parametar.

◆ adc4_write_reg()

uint8_t adc4_write_reg ( adc4_t * ctx,
const uint8_t reg_address,
uint8_t * value )

Generic Write Function.

Parameters
ctxClick object.
reg_sddressregister address
valuepointer to input data
Returns
n_bytes - number of bytes to be written

@description Function writes data in register determined by register address parametar of function.