illuminance 2.0.0.0
Illuminance Click Driver

API for configuring and manipulating Illuminance Click driver. More...

Topics

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

Functions

void illuminance_cfg_setup (illuminance_cfg_t *cfg)
 Illuminance configuration object setup function.
 
err_t illuminance_init (illuminance_t *ctx, illuminance_cfg_t *cfg)
 Illuminance initialization function.
 
err_t illuminance_default_cfg (illuminance_t *ctx)
 Illuminance default configuration function.
 
err_t illuminance_generic_write (illuminance_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Illuminance I2C writing function.
 
err_t illuminance_generic_read (illuminance_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Illuminance I2C reading function.
 
err_t illuminance_write_register (illuminance_t *ctx, uint8_t reg, uint8_t data_in)
 Illuminance write register function.
 
err_t illuminance_read_register (illuminance_t *ctx, uint8_t reg, uint8_t *data_out)
 Illuminance read register function.
 
uint8_t illuminance_get_int_pin (illuminance_t *ctx)
 Illuminance get int pin function.
 
err_t illuminance_check_communication (illuminance_t *ctx)
 Illuminance check communication function.
 
err_t illuminance_set_atime (illuminance_t *ctx, float atime_ms)
 Illuminance set atime function.
 
err_t illuminance_set_gain (illuminance_t *ctx, uint8_t gain)
 Illuminance set gain function.
 
err_t illuminance_read_raw_data (illuminance_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
 Illuminance read raw data function.
 

Detailed Description

API for configuring and manipulating Illuminance 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

◆ illuminance_cfg_setup()

void illuminance_cfg_setup ( illuminance_cfg_t * cfg)

Illuminance configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ illuminance_check_communication()

err_t illuminance_check_communication ( illuminance_t * ctx)

Illuminance check communication function.

This function checks the communication by reading and verifying the chip ID values.

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

◆ illuminance_default_cfg()

err_t illuminance_default_cfg ( illuminance_t * ctx)

Illuminance default configuration function.

This function executes a default configuration of Illuminance click board.

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

◆ illuminance_generic_read()

err_t illuminance_generic_read ( illuminance_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Illuminance 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 illuminance_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ illuminance_generic_write()

err_t illuminance_generic_write ( illuminance_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Illuminance 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 illuminance_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ illuminance_get_int_pin()

uint8_t illuminance_get_int_pin ( illuminance_t * ctx)

Illuminance get int pin function.

This function returns the INT pin logic state.

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

◆ illuminance_init()

err_t illuminance_init ( illuminance_t * ctx,
illuminance_cfg_t * cfg )

Illuminance initialization function.

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

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

◆ illuminance_read_raw_data()

err_t illuminance_read_raw_data ( illuminance_t * ctx,
uint16_t * ch_0,
uint16_t * ch_1 )

Illuminance read raw data function.

This function checks if the data is ready and then reads the raw ADC data from two channels.

Parameters
[in]ctx: Click context object. See illuminance_t object definition for detailed explanation.
[out]ch_0: Raw data from channel 0.
[out]ch_1: Raw data from channel 1.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ illuminance_read_register()

err_t illuminance_read_register ( illuminance_t * ctx,
uint8_t reg,
uint8_t * data_out )

Illuminance read register function.

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

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

◆ illuminance_set_atime()

err_t illuminance_set_atime ( illuminance_t * ctx,
float atime_ms )

Illuminance set atime function.

This function sets the timing register for the selected integration time.

Parameters
[in]ctx: Click context object. See illuminance_t object definition for detailed explanation.
[in]atime_ms: Als integration time. Valid values from 2.7 to 688.5 milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ illuminance_set_gain()

err_t illuminance_set_gain ( illuminance_t * ctx,
uint8_t gain )

Illuminance set gain function.

This function sets the gain level.

Parameters
[in]ctx: Click context object. See illuminance_t object definition for detailed explanation.
[in]gain: Gain level value [0-3].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ illuminance_write_register()

err_t illuminance_write_register ( illuminance_t * ctx,
uint8_t reg,
uint8_t data_in )

Illuminance write register function.

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

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