lightmixsens 2.0.0.0
Light mix sens Click Driver

API for configuring and manipulating Light mix sens Click driver. More...

Topics

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

Functions

void lightmixsens_cfg_setup (lightmixsens_cfg_t *cfg)
 Light mix sens configuration object setup function.
 
err_t lightmixsens_init (lightmixsens_t *ctx, lightmixsens_cfg_t *cfg)
 Light mix sens initialization function.
 
void lightmixsens_default_cfg (lightmixsens_t *ctx)
 Light mix sens default configuration function.
 
void lightmixsens_generic_write (lightmixsens_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Light mix sens I2C writing function.
 
void lightmixsens_generic_read (lightmixsens_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Light mix sens I2C reading function.
 
err_t lightmixsens_write_byte (lightmixsens_t *ctx, uint8_t reg_addr, uint8_t data_in)
 Generic Write Byte function.
 
err_t lightmixsens_write_word (lightmixsens_t *ctx, uint8_t reg_addr, uint16_t data_in)
 Generic Write Word function.
 
err_t lightmixsens_read_byte (lightmixsens_t *ctx, uint8_t reg_addr, uint8_t *data_out)
 Generic Read Byte function.
 
err_t lightmixsens_read_word (lightmixsens_t *ctx, uint8_t reg_addr, uint16_t *data_out)
 Generic Read Word function.
 
void lightmixsens_get_status (lightmixsens_t *ctx, uint8_t flag_mask, uint8_t *status)
 Get Status function.
 
void lightmixsens_switch_ir_to_green (lightmixsens_t *ctx)
 Switch IR To Green Channel function.
 
void lightmixsens_switch_ir_to_prox (lightmixsens_t *ctx)
 Switch IR To Proximity function.
 
void lightmixsens_wait_atime (lightmixsens_t *ctx)
 Wait ALS/Color Intregration Time Done function.
 
void lightmixsens_wait_ptime (lightmixsens_t *ctx)
 Wait Proximity Sample Time Done function.
 
void lightmixsens_wait_wtime (lightmixsens_t *ctx)
 Wait WTIME + WLONG Done function.
 

Detailed Description

API for configuring and manipulating Light mix sens 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

◆ lightmixsens_cfg_setup()

void lightmixsens_cfg_setup ( lightmixsens_cfg_t * cfg)

Light mix sens configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ lightmixsens_default_cfg()

void lightmixsens_default_cfg ( lightmixsens_t * ctx)

Light mix sens default configuration function.

This function executes a default configuration of Light mix sens click board.

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

◆ lightmixsens_generic_read()

void lightmixsens_generic_read ( lightmixsens_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Light mix sens 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 lightmixsens_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_buf: Output read data.
[in]len: Number of bytes to be read.
Returns
None.

◆ lightmixsens_generic_write()

void lightmixsens_generic_write ( lightmixsens_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Light mix sens 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 lightmixsens_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_buf: Data to be written.
[in]len: Number of bytes to be written.
Returns
None.

◆ lightmixsens_get_status()

void lightmixsens_get_status ( lightmixsens_t * ctx,
uint8_t flag_mask,
uint8_t * status )

Get Status function.

This function allows the desired bit flags to be checked from the STATUS register.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
[in]flag_mask: Bit flag selection to include/mask the desired bits.
[in]status: Buffer where masked status byte be placed.
Returns
Nothing.

◆ lightmixsens_init()

err_t lightmixsens_init ( lightmixsens_t * ctx,
lightmixsens_cfg_t * cfg )

Light mix sens initialization function.

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

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

◆ lightmixsens_read_byte()

err_t lightmixsens_read_byte ( lightmixsens_t * ctx,
uint8_t reg_addr,
uint8_t * data_out )

Generic Read Byte function.

This function reads data byte from the selected register.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
[in]reg_addr: Address which from data be read.
[out]data_out: Buffer where data be placed.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ lightmixsens_read_word()

err_t lightmixsens_read_word ( lightmixsens_t * ctx,
uint8_t reg_addr,
uint16_t * data_out )

Generic Read Word function.

This function reads 16-bit data starting from the selected register to the next one.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
[in]reg_addr: Start address which from data be read.
[out]data_out: Buffer where data be placed.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ lightmixsens_switch_ir_to_green()

void lightmixsens_switch_ir_to_green ( lightmixsens_t * ctx)

Switch IR To Green Channel function.

This function switches the IR light to be measured in the Green channel (GDATA) register.

Parameters
[out]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
Returns
Nothing.

◆ lightmixsens_switch_ir_to_prox()

void lightmixsens_switch_ir_to_prox ( lightmixsens_t * ctx)

Switch IR To Proximity function.

This function switches the IR light to measure proximity in the PDATA register.

Parameters
[out]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
Returns
Nothing.

◆ lightmixsens_wait_atime()

void lightmixsens_wait_atime ( lightmixsens_t * ctx)

Wait ALS/Color Intregration Time Done function.

This function performs a delay time determined by the ALS/Color integration time (ATIME) register.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
Returns
Nothing.

◆ lightmixsens_wait_ptime()

void lightmixsens_wait_ptime ( lightmixsens_t * ctx)

Wait Proximity Sample Time Done function.

This function performs a delay time determined by the Proximity sample time (PTIME) register.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
Returns
Nothing.

◆ lightmixsens_wait_wtime()

void lightmixsens_wait_wtime ( lightmixsens_t * ctx)

Wait WTIME + WLONG Done function.

This function performs a delay time determined by the WTIME and WLONG registers.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
Returns
Nothing.

◆ lightmixsens_write_byte()

err_t lightmixsens_write_byte ( lightmixsens_t * ctx,
uint8_t reg_addr,
uint8_t data_in )

Generic Write Byte function.

This function writes data byte to the selected register.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
[in]reg_addr: Address where data be written.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.

◆ lightmixsens_write_word()

err_t lightmixsens_write_word ( lightmixsens_t * ctx,
uint8_t reg_addr,
uint16_t data_in )

Generic Write Word function.

This function writes 16-bit data starting from the selected register to the next one.

Parameters
[in]ctx: Click context object. See lightmixsens_t object definition for detailed explanation.
[in]reg_addr: Start address where data be written.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.