ambient18 2.0.0.0
|
API for configuring and manipulating Ambient 18 Click driver. More...
Topics | |
Ambient 18 Registers Settings | |
Settings for registers of Ambient 18 Click driver. | |
Ambient 18 MikroBUS Map | |
MikroBUS pin mapping of Ambient 18 Click driver. | |
Functions | |
void | ambient18_cfg_setup (ambient18_cfg_t *cfg) |
Ambient 18 configuration object setup function. | |
void | ambient18_drv_interface_selection (ambient18_cfg_t *cfg, ambient18_drv_t drv_sel) |
Ambient 18 driver interface setup function. | |
err_t | ambient18_init (ambient18_t *ctx, ambient18_cfg_t *cfg) |
Ambient 18 initialization function. | |
err_t | ambient18_read_raw_adc (ambient18_t *ctx, uint16_t *raw_adc) |
Ambient 18 read raw ADC value function. | |
err_t | ambient18_read_voltage (ambient18_t *ctx, float *voltage) |
Ambient 18 read voltage level function. | |
err_t | ambient18_set_vref (ambient18_t *ctx, float vref) |
Ambient 18 set vref function. | |
void | ambient18_set_gain_mode (ambient18_t *ctx, uint8_t mode) |
Ambient 18 set gain mode function. | |
int32_t | ambient18_voltage_to_lux (ambient18_t *ctx, float voltage) |
Ambient 18 voltage to illuminance function. | |
API for configuring and manipulating Ambient 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 ambient18_cfg_setup | ( | ambient18_cfg_t * | cfg | ) |
Ambient 18 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ambient18_cfg_t object definition for detailed explanation. |
void ambient18_drv_interface_selection | ( | ambient18_cfg_t * | cfg, |
ambient18_drv_t | drv_sel ) |
Ambient 18 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See ambient18_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See ambient18_drv_t object definition for detailed explanation. |
err_t ambient18_init | ( | ambient18_t * | ctx, |
ambient18_cfg_t * | cfg ) |
Ambient 18 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ambient18_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ambient18_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t ambient18_read_raw_adc | ( | ambient18_t * | ctx, |
uint16_t * | raw_adc ) |
Ambient 18 read raw ADC value function.
This function reads raw ADC value.
[in] | ctx | : Click context object. See ambient18_t object definition for detailed explanation. |
[out] | raw_adc | : Output ADC result. |
0
- Success, -1
- Error.err_t ambient18_read_voltage | ( | ambient18_t * | ctx, |
float * | voltage ) |
Ambient 18 read voltage level function.
This function reads raw ADC value and converts it to proportional voltage level.
[in] | ctx | : Click context object. See ambient18_t object definition for detailed explanation. |
[out] | voltage | : Output voltage level [V]. |
0
- Success, -1
- Error.void ambient18_set_gain_mode | ( | ambient18_t * | ctx, |
uint8_t | mode ) |
Ambient 18 set gain mode function.
This function sets the gain mode.
[in] | ctx | : Click context object. See ambient18_t object definition for detailed explanation. |
[in] | mode | :
|
err_t ambient18_set_vref | ( | ambient18_t * | ctx, |
float | vref ) |
Ambient 18 set vref function.
This function sets the voltage reference for Ambient 18 click driver.
[in] | ctx | : Click context object. See ambient18_t object definition for detailed explanation. |
[in] | vref | : Reference voltage (volts). |
0
- Success, -1
- Error.int32_t ambient18_voltage_to_lux | ( | ambient18_t * | ctx, |
float | voltage ) |
Ambient 18 voltage to illuminance function.
This function calculates illuminance (lux) based on the voltage input.
[in] | voltage | : Voltage from IOUT (volts). |
>=0
Illuminance in lux, <0
Gain mode error.