light2
2.1.0.0
|
API for configuring and manipulating Light 2 Click driver. More...
Modules | |
Light 2 Registers List | |
List of registers of Light 2 Click driver. | |
Light 2 Registers Settings | |
Settings for registers of Light 2 Click driver. | |
Light 2 MikroBUS Map | |
MikroBUS pin mapping of Light 2 Click driver. | |
Functions | |
void | light2_cfg_setup (light2_cfg_t *cfg) |
Light 2 configuration object setup function. More... | |
err_t | light2_init (light2_t *ctx, light2_cfg_t *cfg) |
Light 2 initialization function. More... | |
err_t | light2_default_cfg (light2_t *ctx) |
Light 2 default configuration function. More... | |
err_t | light2_generic_write (light2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Light 2 I2C writing function. More... | |
err_t | light2_generic_read (light2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Light 2 I2C reading function. More... | |
err_t | light2_write_config (light2_t *ctx, uint8_t data_in) |
Light 2 write config function. More... | |
err_t | light2_read_raw_data (light2_t *ctx, uint16_t *data_out) |
Light 2 raw data reading function. More... | |
err_t | light2_get_cal_const (light2_t *ctx) |
Light 2 get calculation constant function. More... | |
err_t | light2_get_light_data (light2_t *ctx, float *light_data) |
Light 2 get light data function. More... | |
API for configuring and manipulating Light 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void light2_cfg_setup | ( | light2_cfg_t * | cfg | ) |
Light 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See light2_cfg_t object definition for detailed explanation. |
err_t light2_default_cfg | ( | light2_t * | ctx | ) |
Light 2 default configuration function.
This function executes a default configuration of Light 2 Click board.
[in] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t light2_generic_read | ( | light2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
Light 2 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 light2_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 light2_generic_write | ( | light2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
Light 2 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 light2_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. err_t light2_get_cal_const | ( | light2_t * | ctx | ) |
Light 2 get calculation constant function.
This function is used to get a calculation constant depending on Light 2 Click board configuration.
[in] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t light2_get_light_data | ( | light2_t * | ctx, |
float * | light_data | ||
) |
Light 2 get light data function.
This function is used to read light data of Light 2 Click board configuration.
[in] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
[out] | light_data | : Read data in LUX. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t light2_init | ( | light2_t * | ctx, |
light2_cfg_t * | cfg | ||
) |
Light 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
[out] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See light2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t light2_read_raw_data | ( | light2_t * | ctx, |
uint16_t * | data_out | ||
) |
Light 2 raw data reading function.
This function reads raw data from the ADC of Light 2 Click board.
[in] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t light2_write_config | ( | light2_t * | ctx, |
uint8_t | data_in | ||
) |
Light 2 write config function.
This function is used to set configuration for Light 2 Click board.
[in] | ctx | : Click context object. See light2_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.