ambient15 2.0.0.0
|
API for configuring and manipulating Ambient 15 Click driver. More...
Topics | |
Ambient 15 Registers List | |
List of registers of Ambient 15 Click driver. | |
Ambient 15 Registers Settings | |
Settings for registers of Ambient 15 Click driver. | |
Ambient 15 MikroBUS Map | |
MikroBUS pin mapping of Ambient 15 Click driver. | |
Functions | |
void | ambient15_cfg_setup (ambient15_cfg_t *cfg) |
Ambient 15 configuration object setup function. | |
err_t | ambient15_init (ambient15_t *ctx, ambient15_cfg_t *cfg) |
Ambient 15 initialization function. | |
err_t | ambient15_default_cfg (ambient15_t *ctx) |
Ambient 15 default configuration function. | |
err_t | ambient15_generic_write (ambient15_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
Ambient 15 I2C writing function. | |
err_t | ambient15_generic_read (ambient15_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
Ambient 15 I2C reading function. | |
err_t | ambient15_write_register (ambient15_t *ctx, uint8_t reg, uint8_t data_in) |
Ambient 15 write register function. | |
err_t | ambient15_read_register (ambient15_t *ctx, uint8_t reg, uint8_t *data_out) |
Ambient 15 read register function. | |
uint8_t | ambient15_get_int_pin (ambient15_t *ctx) |
Ambient 15 get int pin function. | |
err_t | ambient15_check_communication (ambient15_t *ctx) |
Ambient 15 check communication function. | |
err_t | ambient15_set_atime (ambient15_t *ctx, float atime_ms) |
Ambient 15 set atime function. | |
err_t | ambient15_set_gain (ambient15_t *ctx, uint8_t gain) |
Ambient 15 set gain function. | |
err_t | ambient15_read_raw_data (ambient15_t *ctx, uint16_t *ch_0, uint16_t *ch_1) |
Ambient 15 read raw data function. | |
err_t | ambient15_measure_light_level (ambient15_t *ctx, uint16_t *lux) |
Ambient 15 measure light level function. | |
API for configuring and manipulating Ambient 15 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void ambient15_cfg_setup | ( | ambient15_cfg_t * | cfg | ) |
Ambient 15 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ambient15_cfg_t object definition for detailed explanation. |
err_t ambient15_check_communication | ( | ambient15_t * | ctx | ) |
Ambient 15 check communication function.
This function checks the communication by reading and verifying the chip ID values.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t ambient15_default_cfg | ( | ambient15_t * | ctx | ) |
Ambient 15 default configuration function.
This function executes a default configuration of Ambient 15 click board.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t ambient15_generic_read | ( | ambient15_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
Ambient 15 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 ambient15_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t ambient15_generic_write | ( | ambient15_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
Ambient 15 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 ambient15_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error.uint8_t ambient15_get_int_pin | ( | ambient15_t * | ctx | ) |
Ambient 15 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
err_t ambient15_init | ( | ambient15_t * | ctx, |
ambient15_cfg_t * | cfg ) |
Ambient 15 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ambient15_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t ambient15_measure_light_level | ( | ambient15_t * | ctx, |
uint16_t * | lux ) |
Ambient 15 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 ambient15_t object definition for detailed explanation. |
[out] | lux | : Ambient light level in Lux. |
0
- Success, -1
- Error.err_t ambient15_read_raw_data | ( | ambient15_t * | ctx, |
uint16_t * | ch_0, | ||
uint16_t * | ch_1 ) |
Ambient 15 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 ambient15_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.err_t ambient15_read_register | ( | ambient15_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Ambient 15 read register function.
This function reads a desired data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error.err_t ambient15_set_atime | ( | ambient15_t * | ctx, |
float | atime_ms ) |
Ambient 15 set atime function.
This function sets the timing register for the selected integration time.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
[in] | atime_ms | : Als integration time. Valid values from 2.7 to 688.5 milliseconds. |
0
- Success, -1
- Error.err_t ambient15_set_gain | ( | ambient15_t * | ctx, |
uint8_t | gain ) |
Ambient 15 set gain function.
This function sets the gain level.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
[in] | gain | : Gain level value [0-3]. |
0
- Success, -1
- Error.err_t ambient15_write_register | ( | ambient15_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Ambient 15 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient15_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.