light
2.0.0.0
|
Functions | |
void | light_cfg_setup (light_cfg_t *cfg) |
Config Object Initialization function. More... | |
LIGHT_RETVAL | light_init (light_t *ctx, light_cfg_t *cfg) |
Initialization function. More... | |
void | light_generic_transfer (light_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len) |
Generic transfer function. More... | |
void | light_write_data (light_t *ctx, uint8_t address, uint8_t write_command) |
Generic write data function. More... | |
uint16_t | light_read_data (light_t *ctx) |
Generic read data function. More... | |
uint8_t | light_calculate_percent (light_t *ctx, uint16_t light_value) |
Function calculate percent. More... | |
uint8_t light_calculate_percent | ( | light_t * | ctx, |
uint16_t | light_value | ||
) |
Function calculate percent.
ctx | Click object. |
light_value | 14-bit data ADC value |
Function calculate light intensity percent.
void light_cfg_setup | ( | light_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
This function initializes click configuration structure to init state.
void light_generic_transfer | ( | light_t * | ctx, |
uint8_t * | wr_buf, | ||
uint16_t | wr_len, | ||
uint8_t * | rd_buf, | ||
uint16_t | rd_len | ||
) |
Generic transfer function.
ctx | Click object. |
wr_buf | Write data buffer |
wr_len | Number of byte in write data buffer |
rd_buf | Read data buffer |
rd_len | Number of byte in read data buffer |
Generic SPI transfer, for sending and receiving packages
LIGHT_RETVAL light_init | ( | light_t * | ctx, |
light_cfg_t * | cfg | ||
) |
Initialization function.
light | Click object. |
cfg | Click configuration structure. |
This function initializes all necessary pins and peripherals used for this click.
uint16_t light_read_data | ( | light_t * | ctx | ) |
Generic read data function.
ctx | Click object. |
Function read 14-bit data from MCP3201.
void light_write_data | ( | light_t * | ctx, |
uint8_t | address, | ||
uint8_t | write_command | ||
) |
Generic write data function.
ctx | Click object. |
address | Register address. |
write_command | Command to write. |
Function write byte of data to MCP3201.