color14 2.0.0.0
|
API for configuring and manipulating Color 14 Click driver. More...
Topics | |
Color 14 Registers List | |
List of registers of Color 14 Click driver. | |
Color 14 Registers Settings | |
Settings for registers of Color 14 Click driver. | |
Color 14 MikroBUS Map | |
MikroBUS pin mapping of Color 14 Click driver. | |
Functions | |
void | color14_cfg_setup (color14_cfg_t *cfg) |
Color 14 configuration object setup function. | |
err_t | color14_init (color14_t *ctx, color14_cfg_t *cfg) |
Color 14 initialization function. | |
err_t | color14_generic_write (color14_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
Color 14 I2C writing function. | |
err_t | color14_generic_read (color14_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
Color 14 I2C reading function. | |
uint8_t | color14_get_int (color14_t *ctx) |
Get interrupt pin state. | |
err_t | color14_get_proximity (color14_t *ctx, uint16_t *ps_data) |
Read proximity data from device. | |
err_t | color14_get_als (color14_t *ctx, float *als_data) |
Read lux data from device. | |
err_t | color14_ls_color (color14_t *ctx, uint8_t ls_reg, uint32_t *ls_data) |
Read ls data from color registers. | |
err_t | color14_get_rgb_ir (color14_t *ctx, color14_color_t *color_data) |
Read color data from device. | |
float | color14_get_als_resolution (color14_t *ctx) |
Get resolution for the lux calculation. | |
API for configuring and manipulating Color 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 color14_cfg_setup | ( | color14_cfg_t * | cfg | ) |
Color 14 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See color14_cfg_t object definition for detailed explanation. |
err_t color14_generic_read | ( | color14_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
Color 14 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 color14_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 color14_generic_write | ( | color14_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
Color 14 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 color14_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.err_t color14_get_als | ( | color14_t * | ctx, |
float * | als_data ) |
Read lux data from device.
This function reads adc data and calculates lux data from device.
[in] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
[out] | als_data | : Output read data. |
0
- Success, -1
- Error.float color14_get_als_resolution | ( | color14_t * | ctx | ) |
Get resolution for the lux calculation.
Function reads configuration from device and returns corresponding lux resolution, and sets member lux_resolution of context object.
[in,out] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
[out] | ps_data | : Output read data. |
uint8_t color14_get_int | ( | color14_t * | ctx | ) |
Get interrupt pin state.
Read int_pin state.
[in] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
err_t color14_get_proximity | ( | color14_t * | ctx, |
uint16_t * | ps_data ) |
Read proximity data from device.
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 color14_t object definition for detailed explanation. |
[out] | ps_data | : Output read data. |
0
- Success, -1
- Error, -2
- Overflow, -4
- Error configuration.err_t color14_get_rgb_ir | ( | color14_t * | ctx, |
color14_color_t * | color_data ) |
Read color data from device.
This function reads red, green, blue, and ir registers data and sets data in color_data object.
[in] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
[out] | color_data | : Color data object. See color14_color_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t color14_init | ( | color14_t * | ctx, |
color14_cfg_t * | cfg ) |
Color 14 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See color14_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t color14_ls_color | ( | color14_t * | ctx, |
uint8_t | ls_reg, | ||
uint32_t * | ls_data ) |
Read ls data from color registers.
This function reads data from reg, green, blue or ir registers and returns data to ls_data.
[in] | ctx | : Click context object. See color14_t object definition for detailed explanation. |
[in] | ls_reg | : LSB register address of data. |
[out] | ls_data | : Output read data. |
0
- Success, -1
- Error, -3
- Error Parameter.