ambient17
2.0.0.0
|
API for configuring and manipulating Ambient 17 Click driver. More...
Modules | |
Ambient 17 Registers List | |
List of registers of Ambient 17 Click driver. | |
Ambient 17 Registers Settings | |
Settings for registers of Ambient 17 Click driver. | |
Ambient 17 MikroBUS Map | |
MikroBUS pin mapping of Ambient 17 Click driver. | |
Functions | |
void | ambient17_cfg_setup (ambient17_cfg_t *cfg) |
Ambient 17 configuration object setup function. More... | |
err_t | ambient17_init (ambient17_t *ctx, ambient17_cfg_t *cfg) |
Ambient 17 initialization function. More... | |
err_t | ambient17_default_cfg (ambient17_t *ctx) |
Ambient 17 default configuration function. More... | |
err_t | ambient17_generic_write (ambient17_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
Ambient 17 I2C writing function. More... | |
err_t | ambient17_generic_read (ambient17_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
Ambient 17 I2C reading function. More... | |
err_t | ambient17_write_register (ambient17_t *ctx, uint8_t reg, uint8_t data_in) |
Ambient 17 write register function. More... | |
err_t | ambient17_read_register (ambient17_t *ctx, uint8_t reg, uint8_t *data_out) |
Ambient 17 read register function. More... | |
err_t | ambient17_check_communication (ambient17_t *ctx) |
Ambient 17 check communication function. More... | |
uint8_t | ambient17_get_int_pin (ambient17_t *ctx) |
Ambient 17 get INT pin function. More... | |
err_t | ambient17_clear_interrupts (ambient17_t *ctx) |
Ambient 17 clear interrupts function. More... | |
err_t | ambient17_set_atime (ambient17_t *ctx, float atime_ms) |
Ambient 17 set atime function. More... | |
err_t | ambient17_set_wtime (ambient17_t *ctx, float wtime_ms) |
Ambient 17 set wtime function. More... | |
err_t | ambient17_set_again (ambient17_t *ctx, uint8_t again) |
Ambient 17 set again function. More... | |
err_t | ambient17_read_raw_data (ambient17_t *ctx, uint16_t *ch_0, uint16_t *ch_1) |
Ambient 17 read raw data function. More... | |
err_t | ambient17_measure_light_level (ambient17_t *ctx, uint16_t *lux) |
Ambient 17 measure light level function. More... | |
API for configuring and manipulating Ambient 17 Click driver.
void ambient17_cfg_setup | ( | ambient17_cfg_t * | cfg | ) |
Ambient 17 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See ambient17_cfg_t object definition for detailed explanation. |
err_t ambient17_check_communication | ( | ambient17_t * | ctx | ) |
Ambient 17 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_clear_interrupts | ( | ambient17_t * | ctx | ) |
Ambient 17 clear interrupts function.
This function clears all interrupts by sending the INT clear special function command.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_default_cfg | ( | ambient17_t * | ctx | ) |
Ambient 17 default configuration function.
This function executes a default configuration of Ambient 17 click board.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_generic_read | ( | ambient17_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len | ||
) |
Ambient 17 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 ambient17_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. See #err_t definition for detailed explanation. err_t ambient17_generic_write | ( | ambient17_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len | ||
) |
Ambient 17 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 ambient17_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. See #err_t definition for detailed explanation. uint8_t ambient17_get_int_pin | ( | ambient17_t * | ctx | ) |
Ambient 17 get INT pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
err_t ambient17_init | ( | ambient17_t * | ctx, |
ambient17_cfg_t * | cfg | ||
) |
Ambient 17 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See ambient17_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_measure_light_level | ( | ambient17_t * | ctx, |
uint16_t * | lux | ||
) |
Ambient 17 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 ambient17_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 ambient17_read_raw_data | ( | ambient17_t * | ctx, |
uint16_t * | ch_0, | ||
uint16_t * | ch_1 | ||
) |
Ambient 17 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 ambient17_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 ambient17_read_register | ( | ambient17_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out | ||
) |
Ambient 17 read register function.
This function reads data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient17_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 ambient17_set_again | ( | ambient17_t * | ctx, |
uint8_t | again | ||
) |
Ambient 17 set again function.
This function sets the ALS gain level in the CONTROL register.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
[in] | again | : ALS gain level
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_set_atime | ( | ambient17_t * | ctx, |
float | atime_ms | ||
) |
Ambient 17 set atime function.
This function sets the ATIME register for the selected ALS integration time.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
[in] | atime_ms | : Als integration time. Valid values from 2.73 to 699.88 milliseconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_set_wtime | ( | ambient17_t * | ctx, |
float | wtime_ms | ||
) |
Ambient 17 set wtime function.
This function sets the WTIME register for the selected wait time.
[in] | ctx | : Click context object. See ambient17_t object definition for detailed explanation. |
[in] | wtime_ms | : Wait time period. Valid values from 2.73 to 699.88 milliseconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t ambient17_write_register | ( | ambient17_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in | ||
) |
Ambient 17 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See ambient17_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.