light3 2.1.0.0
Modules | Functions
Light 3 Click Driver

API for configuring and manipulating Light 3 Click driver. More...

Modules

 Light 3 Registers List
 List of registers of Light 3 Click driver.
 
 Light 3 Registers Settings
 Settings for registers of Light 3 Click driver.
 
 Light 3 MikroBUS Map
 MikroBUS pin mapping of Light 3 Click driver.
 

Functions

void light3_cfg_setup (light3_cfg_t *cfg)
 Light 3 configuration object setup function. More...
 
err_t light3_init (light3_t *ctx, light3_cfg_t *cfg)
 Light 3 initialization function. More...
 
err_t light3_default_cfg (light3_t *ctx)
 Light 3 default configuration function. More...
 
err_t light3_generic_write (light3_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Light 3 I2C writing function. More...
 
err_t light3_generic_read (light3_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Light 3 I2C reading function. More...
 
uint8_t light3_get_int_pin (light3_t *ctx)
 Light 3 get INT pin state function. More...
 
err_t light3_sw_reset (light3_t *ctx)
 Light 3 software reset function. More...
 
err_t light3_write_reg (light3_t *ctx, uint8_t reg, uint16_t data_in)
 Light 3 register writing function. More...
 
err_t light3_read_reg (light3_t *ctx, uint8_t reg, uint16_t *data_out)
 Light 3 register reading function. More...
 
err_t light3_get_ch0_data (light3_t *ctx, float *lux)
 Light 3 read CH0 data function. More...
 
err_t light3_get_ch1_data (light3_t *ctx, float *lux)
 Light 3 read CH1 data function. More...
 
err_t light3_get_ch0_fifo_data (light3_t *ctx, float *lux)
 Light 3 read CH0 FIFO data function. More...
 
err_t light3_get_ch1_fifo_data (light3_t *ctx, float *lux)
 Light 3 read CH1 FIFO data function. More...
 

Detailed Description

API for configuring and manipulating Light 3 Click driver.

Function Documentation

◆ light3_cfg_setup()

void light3_cfg_setup ( light3_cfg_t cfg)

Light 3 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See light3_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ light3_default_cfg()

err_t light3_default_cfg ( light3_t ctx)

Light 3 default configuration function.

This function executes a default configuration of Light 3 click board.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ light3_generic_read()

err_t light3_generic_read ( light3_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Light 3 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light3_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.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_generic_write()

err_t light3_generic_write ( light3_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Light 3 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light3_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.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_get_ch0_data()

err_t light3_get_ch0_data ( light3_t ctx,
float *  lux 
)

Light 3 read CH0 data function.

This function reads ambient light data from the Channel 0 and performs the calculatios from raw data to Lux.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[out]lux: Read ambient light in lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_get_ch0_fifo_data()

err_t light3_get_ch0_fifo_data ( light3_t ctx,
float *  lux 
)

Light 3 read CH0 FIFO data function.

This function reads ambient light data from the Channel 0 FIFO and performs the calculatios from raw data to Lux.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[out]lux: Read ambient light in lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_get_ch1_data()

err_t light3_get_ch1_data ( light3_t ctx,
float *  lux 
)

Light 3 read CH1 data function.

This function reads ambient light data from the Channel 1 and performs the calculatios from raw data to Lux.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[out]lux: Read ambient light in lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_get_ch1_fifo_data()

err_t light3_get_ch1_fifo_data ( light3_t ctx,
float *  lux 
)

Light 3 read CH1 FIFO data function.

This function reads ambient light data from the Channel 1 FIFO and performs the calculatios from raw data to Lux.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[out]lux: Read ambient light in lux.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_get_int_pin()

uint8_t light3_get_int_pin ( light3_t ctx)

Light 3 get INT pin state function.

This function is used to get INT pin state of Light 3 click board.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
Returns
INT pin state.

◆ light3_init()

err_t light3_init ( light3_t ctx,
light3_cfg_t cfg 
)

Light 3 initialization function.

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

Parameters
[out]ctx: Click context object. See light3_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See light3_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_read_reg()

err_t light3_read_reg ( light3_t ctx,
uint8_t  reg,
uint16_t *  data_out 
)

Light 3 register reading function.

This function reads data from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_sw_reset()

err_t light3_sw_reset ( light3_t ctx)

Light 3 software reset function.

This function is used to perform software reset.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light3_write_reg()

err_t light3_write_reg ( light3_t ctx,
uint8_t  reg,
uint16_t  data_in 
)

Light 3 register writing function.

This function writes a desired data into the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See light3_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.