light  2.0.0.0
Functions
Public function

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...
 

Detailed Description

Function Documentation

◆ light_calculate_percent()

uint8_t light_calculate_percent ( light_t ctx,
uint16_t  light_value 
)

Function calculate percent.

Parameters
ctxClick object.
light_value14-bit data ADC value

Function calculate light intensity percent.

◆ light_cfg_setup()

void light_cfg_setup ( light_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ light_generic_transfer()

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.

Parameters
ctxClick object.
wr_bufWrite data buffer
wr_lenNumber of byte in write data buffer
rd_bufRead data buffer
rd_lenNumber of byte in read data buffer

Generic SPI transfer, for sending and receiving packages

◆ light_init()

LIGHT_RETVAL light_init ( light_t ctx,
light_cfg_t cfg 
)

Initialization function.

Parameters
lightClick object.
cfgClick configuration structure.

This function initializes all necessary pins and peripherals used for this click.

◆ light_read_data()

uint16_t light_read_data ( light_t ctx)

Generic read data function.

Parameters
ctxClick object.

Function read 14-bit data from MCP3201.

◆ light_write_data()

void light_write_data ( light_t ctx,
uint8_t  address,
uint8_t  write_command 
)

Generic write data function.

Parameters
ctxClick object.
addressRegister address.
write_commandCommand to write.

Function write byte of data to MCP3201.