|
ambient14 2.2.0
|
API for configuring and manipulating Ambient 14 Click driver. More...
Topics | |
| Ambient 14 Registers List | |
| List of registers of Ambient 14 Click driver. | |
| Ambient 14 Registers Settings | |
| Settings for registers of Ambient 14 Click driver. | |
| Ambient 14 MikroBUS Map | |
| MikroBUS pin mapping of Ambient 14 Click driver. | |
Functions | |
| void | ambient14_cfg_setup (ambient14_cfg_t *cfg) |
| Ambient 14 configuration object setup function. | |
| err_t | ambient14_init (ambient14_t *ctx, ambient14_cfg_t *cfg) |
| Ambient 14 initialization function. | |
| err_t | ambient14_default_cfg (ambient14_t *ctx) |
| Ambient 14 default configuration function. | |
| err_t | ambient14_write_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| Ambient 14 write regs function. | |
| err_t | ambient14_read_regs (ambient14_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| Ambient 14 read regs function. | |
| err_t | ambient14_write_reg (ambient14_t *ctx, uint8_t reg, uint8_t data_in) |
| Ambient 14 write reg function. | |
| err_t | ambient14_read_reg (ambient14_t *ctx, uint8_t reg, uint8_t *data_out) |
| Ambient 14 read reg function. | |
| void | ambient14_enable_device (ambient14_t *ctx) |
| Ambient 14 enable device function. | |
| void | ambient14_disable_device (ambient14_t *ctx) |
| Ambient 14 disable device function. | |
| uint8_t | ambient14_get_int_pin (ambient14_t *ctx) |
| Ambient 14 get int pin function. | |
| err_t | ambient14_check_communication (ambient14_t *ctx) |
| Ambient 14 check communication function. | |
| err_t | ambient14_soft_reset (ambient14_t *ctx) |
| Ambient 14 soft reset function. | |
| err_t | ambient14_clear_interrupts (ambient14_t *ctx) |
| Ambient 14 clear interrupts function. | |
| err_t | ambient14_set_atime (ambient14_t *ctx, float atime_ms) |
| Ambient 14 set atime function. | |
| err_t | ambient14_set_awtime (ambient14_t *ctx, float awtime_ms) |
| Ambient 14 set awtime function. | |
| err_t | ambient14_set_pwtime (ambient14_t *ctx, float pwtime_ms) |
| Ambient 14 set pwtime function. | |
| err_t | ambient14_read_proximity (ambient14_t *ctx, uint16_t *prox_data) |
| Ambient 14 read proximity function. | |
| err_t | ambient14_read_als_ir (ambient14_t *ctx, uint16_t *als_data, uint16_t *ir_data) |
| Ambient 14 read als ir function. | |
| err_t | ambient14_get_illuminance (ambient14_t *ctx, uint16_t als_data, float *illuminance) |
| Ambient 14 get illuminance function. | |
API for configuring and manipulating Ambient 14 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void ambient14_cfg_setup | ( | ambient14_cfg_t * | cfg | ) |
Ambient 14 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See ambient14_cfg_t object definition for detailed explanation. |
| err_t ambient14_check_communication | ( | ambient14_t * | ctx | ) |
Ambient 14 check communication function.
This function checks the communication by reading and verifying the device ID on up to 10 tries.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_clear_interrupts | ( | ambient14_t * | ctx | ) |
Ambient 14 clear interrupts function.
This function clears all interrupts status.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_default_cfg | ( | ambient14_t * | ctx | ) |
Ambient 14 default configuration function.
This function executes a default configuration of Ambient 14 Click board.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void ambient14_disable_device | ( | ambient14_t * | ctx | ) |
Ambient 14 disable device function.
This function enables the device by setting the SBY pin to LOW logic state.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| void ambient14_enable_device | ( | ambient14_t * | ctx | ) |
Ambient 14 enable device function.
This function enables the device by setting the SBY pin to HIGH logic state.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| err_t ambient14_get_illuminance | ( | ambient14_t * | ctx, |
| uint16_t | als_data, | ||
| float * | illuminance ) |
Ambient 14 get illuminance function.
This function calculates the illuminance level (Lux) from ALS data counts input.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [in] | als_data | : ALS data. |
| [out] | illuminance | : Illuminance in Lux. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | uint8_t ambient14_get_int_pin | ( | ambient14_t * | ctx | ) |
Ambient 14 get int pin function.
This function returns the INT pin logic state.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| err_t ambient14_init | ( | ambient14_t * | ctx, |
| ambient14_cfg_t * | cfg ) |
Ambient 14 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See ambient14_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_read_als_ir | ( | ambient14_t * | ctx, |
| uint16_t * | als_data, | ||
| uint16_t * | ir_data ) |
Ambient 14 read als ir function.
This function reads the raw ALS and IR data.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [out] | als_data | : ALS data. |
| [out] | ir_data | : IR data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_read_proximity | ( | ambient14_t * | ctx, |
| uint16_t * | prox_data ) |
Ambient 14 read proximity function.
This function reads the raw proximity data. The higher the value, the closer the detected object is.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [out] | prox_data | : Proximity data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_read_reg | ( | ambient14_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
Ambient 14 read reg function.
This function reads data from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See ambient14_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 ambient14_read_regs | ( | ambient14_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
Ambient 14 read regs 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 ambient14_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. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_set_atime | ( | ambient14_t * | ctx, |
| float | atime_ms ) |
Ambient 14 set atime function.
This function sets the ADC integration time in milliseconds by setting the ATIME register.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [in] | atime_ms | : ADC integration time in milliseconds. [from AMBIENT14_ATIME_MIN to AMBIENT14_ATIME_MAX]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_set_awtime | ( | ambient14_t * | ctx, |
| float | awtime_ms ) |
Ambient 14 set awtime function.
This function sets the ALS wait time in milliseconds by setting the AWTIME register.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [in] | awtime_ms | : ALS wait time in milliseconds. [from AMBIENT14_AWTIME_MIN to AMBIENT14_AWTIME_MAX]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_set_pwtime | ( | ambient14_t * | ctx, |
| float | pwtime_ms ) |
Ambient 14 set pwtime function.
This function sets the PROX wait time in milliseconds by setting the PWTIME register.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
| [in] | pwtime_ms | : PROX wait time in milliseconds. [from AMBIENT14_PWTIME_MIN to AMBIENT14_PWTIME_MAX]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_soft_reset | ( | ambient14_t * | ctx | ) |
Ambient 14 soft reset function.
This function executes the defice software reset command.
| [in] | ctx | : Click context object. See ambient14_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t ambient14_write_reg | ( | ambient14_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
Ambient 14 write reg function.
This function writes data to the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See ambient14_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 ambient14_write_regs | ( | ambient14_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
Ambient 14 write regs 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 ambient14_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. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.