ambient21
2.1.0.0
|
API for configuring and manipulating Ambient 21 Click driver. More...
Modules | |
Ambient 21 Registers List | |
List of registers of Ambient 21 Click driver. | |
Ambient 21 Registers Settings | |
Settings for registers of Ambient 21 Click driver. | |
Ambient 21 MikroBUS Map | |
MikroBUS pin mapping of Ambient 21 Click driver. | |
Functions | |
void | ambient21_cfg_setup (ambient21_cfg_t *cfg) |
Ambient 21 configuration object setup function. More... | |
err_t | ambient21_init (ambient21_t *ctx, ambient21_cfg_t *cfg) |
Ambient 21 initialization function. More... | |
err_t | ambient21_default_cfg (ambient21_t *ctx) |
Ambient 21 default configuration function. More... | |
err_t | ambient21_generic_write (ambient21_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Ambient 21 I2C writing function. More... | |
err_t | ambient21_generic_read (ambient21_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Ambient 21 I2C reading function. More... | |
err_t | ambient21_write_register (ambient21_t *ctx, uint8_t reg, uint8_t data_in) |
Ambient 21 write register function. More... | |
err_t | ambient21_read_register (ambient21_t *ctx, uint8_t reg, uint8_t *data_out) |
Ambient 21 read register function. More... | |
err_t | ambient21_write_spec_func (ambient21_t *ctx, uint8_t spec_func) |
Ambient 21 write spec func function. More... | |
uint8_t | ambient21_get_int_pin (ambient21_t *ctx) |
Ambient 21 get int pin function. More... | |
err_t | ambient21_check_communication (ambient21_t *ctx) |
Ambient 21 check communication function. More... | |
err_t | ambient21_clear_interrupts (ambient21_t *ctx) |
Ambient 21 clear interrupts function. More... | |
err_t | ambient21_set_config (ambient21_t *ctx, uint8_t again, uint8_t atime) |
Ambient 21 set config function. More... | |
err_t | ambient21_read_raw_data (ambient21_t *ctx, uint16_t *ch_0, uint16_t *ch_1) |
Ambient 21 read raw data function. More... | |
err_t | ambient21_measure_light_level (ambient21_t *ctx, uint16_t *lux) |
Ambient 21 measure light level function. More... | |
API for configuring and manipulating Ambient 21 Click driver.
void ambient21_cfg_setup | ( | ambient21_cfg_t * | cfg | ) |
Ambient 21 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ambient21_cfg_t object definition for detailed explanation. |
err_t ambient21_check_communication | ( | ambient21_t * | ctx | ) |
Ambient 21 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_clear_interrupts | ( | ambient21_t * | ctx | ) |
Ambient 21 clear interrupts function.
This function clears all interrupts by sending the INT clear special function command.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_default_cfg | ( | ambient21_t * | ctx | ) |
Ambient 21 default configuration function.
This function executes a default configuration of Ambient 21 click board.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_generic_read | ( | ambient21_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
Ambient 21 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient21_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 (up to 24 bytes). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_generic_write | ( | ambient21_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
Ambient 21 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient21_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 (up to 13 bytes). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t ambient21_get_int_pin | ( | ambient21_t * | ctx | ) |
Ambient 21 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
err_t ambient21_init | ( | ambient21_t * | ctx, |
ambient21_cfg_t * | cfg | ||
) |
Ambient 21 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ambient21_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_measure_light_level | ( | ambient21_t * | ctx, |
uint16_t * | lux | ||
) |
Ambient 21 measure light level function.
This function reads the raw ADC data from two channels and then measures the light level in lux based on those readings.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[out] | lux | : Ambient light level in Lux. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_read_raw_data | ( | ambient21_t * | ctx, |
uint16_t * | ch_0, | ||
uint16_t * | ch_1 | ||
) |
Ambient 21 read raw data function.
This function checks if the data is ready and then reads the raw ADC data from two channels.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[out] | ch_0 | : Raw data from channel 0. |
[out] | ch_1 | : Raw data from channel 1. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_read_register | ( | ambient21_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out | ||
) |
Ambient 21 read register function.
This function reads data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_set_config | ( | ambient21_t * | ctx, |
uint8_t | again, | ||
uint8_t | atime | ||
) |
Ambient 21 set config function.
This function sets again and atime settings and calculates the ctx->cpl.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[in] | again | : ALS gain level
|
[in] | atime | : ALS time
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_write_register | ( | ambient21_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in | ||
) |
Ambient 21 write register function.
This function writes data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient21_write_spec_func | ( | ambient21_t * | ctx, |
uint8_t | spec_func | ||
) |
Ambient 21 write spec func function.
This function writes a special function command byte.
[in] | ctx | : Click context object. See ambient21_t object definition for detailed explanation. |
[in] | spec_func | : Special function command byte. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.