light4  2.1.0.0
Modules | Functions
Light 4 Click Driver

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

Modules

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

Functions

void light4_cfg_setup (light4_cfg_t *cfg)
 Light 4 configuration object setup function. More...
 
err_t light4_init (light4_t *ctx, light4_cfg_t *cfg)
 Light 4 initialization function. More...
 
err_t light4_default_cfg (light4_t *ctx)
 Light 4 default configuration function. More...
 
err_t light4_generic_write (light4_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Light 4 I2C writing function. More...
 
err_t light4_generic_read (light4_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Light 4 I2C reading function. More...
 
void light4_set_en_pin (light4_t *ctx, uint8_t pin_state)
 Light 4 set EN pin function. More...
 
void light4_set_snc_pin (light4_t *ctx, uint8_t pin_state)
 Light 4 set SNC pin function. More...
 
uint8_t light4_get_int_pin (light4_t *ctx)
 Light 4 get INT pin function. More...
 
err_t light4_write_reg (light4_t *ctx, uint8_t reg, uint8_t data_in)
 Light 4 Register writing function. More...
 
err_t light4_read_reg (light4_t *ctx, uint8_t reg, uint8_t *data_out)
 Light 4 Register reading function. More...
 
err_t light4_sw_reset (light4_t *ctx)
 Light 4 Software reset function. More...
 
err_t light4_read_channel_data (light4_t *ctx, uint8_t channel_sel, float *channel_data)
 Light 4 get channel data function. More...
 

Detailed Description

API for configuring and manipulating Light 4 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ light4_cfg_setup()

void light4_cfg_setup ( light4_cfg_t cfg)

Light 4 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ light4_default_cfg()

err_t light4_default_cfg ( light4_t ctx)

Light 4 default configuration function.

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

Parameters
[in]ctx: Click context object. See light4_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.

◆ light4_generic_read()

err_t light4_generic_read ( light4_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Light 4 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 light4_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.

◆ light4_generic_write()

err_t light4_generic_write ( light4_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Light 4 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 light4_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.

◆ light4_get_int_pin()

uint8_t light4_get_int_pin ( light4_t ctx)

Light 4 get INT pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See light4_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ light4_init()

err_t light4_init ( light4_t ctx,
light4_cfg_t cfg 
)

Light 4 initialization function.

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

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

◆ light4_read_channel_data()

err_t light4_read_channel_data ( light4_t ctx,
uint8_t  channel_sel,
float *  channel_data 
)

Light 4 get channel data function.

This function is used to read data from selected channel of Light 4 click board.

Parameters
[in]ctx: Click context object. See light4_t object definition for detailed explanation.
[in]channel_sel: Channel selection.
[out]channel_data: Read channel data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ light4_read_reg()

err_t light4_read_reg ( light4_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Light 4 Register reading function.

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

Parameters
[in]ctx: Click context object. See light4_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.

◆ light4_set_en_pin()

void light4_set_en_pin ( light4_t ctx,
uint8_t  pin_state 
)

Light 4 set EN pin function.

This function sets the EN pin logic state.

Parameters
[in]ctx: Click context object. See light4_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ light4_set_snc_pin()

void light4_set_snc_pin ( light4_t ctx,
uint8_t  pin_state 
)

Light 4 set SNC pin function.

This function sets the SNC pin logic state.

Parameters
[in]ctx: Click context object. See light4_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ light4_sw_reset()

err_t light4_sw_reset ( light4_t ctx)

Light 4 Software reset function.

This function is used to perform software reset of Light 4 click board.

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

◆ light4_write_reg()

err_t light4_write_reg ( light4_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Light 4 Register writing function.

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

Parameters
[in]ctx: Click context object. See light4_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.