color16 2.1.0.0
Color 16 Click Driver

API for configuring and manipulating Color 16 Click driver. More...

Topics

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

Functions

void color16_cfg_setup (color16_cfg_t *cfg)
 Color 16 configuration object setup function.
 
err_t color16_init (color16_t *ctx, color16_cfg_t *cfg)
 Color 16 initialization function.
 
err_t color16_default_cfg (color16_t *ctx)
 Color 16 default configuration function.
 
err_t color16_generic_write (color16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Color 16 I2C writing function.
 
err_t color16_generic_read (color16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Color 16 I2C reading function.
 
err_t color16_write_register (color16_t *ctx, uint8_t reg, uint8_t data_in)
 Color 16 write register function.
 
err_t color16_read_register (color16_t *ctx, uint8_t reg, uint8_t *data_out)
 Color 16 read register function.
 
err_t color16_write_register_word (color16_t *ctx, uint8_t reg, uint16_t data_in)
 Color 16 write register word function.
 
err_t color16_read_register_word (color16_t *ctx, uint8_t reg, uint16_t *data_out)
 Color 16 read register word function.
 
err_t color16_check_communication (color16_t *ctx)
 Color 16 check communication function.
 
void color16_set_ldr_pin (color16_t *ctx, uint8_t state)
 Color 16 set ldr pin function.
 
uint8_t color16_get_int_pin (color16_t *ctx)
 Color 16 get int pin function.
 
err_t color16_set_reg_bank_access (color16_t *ctx, uint8_t reg_bank)
 Color 16 set reg bank access function.
 
err_t color16_disable_ext_led (color16_t *ctx)
 Color 16 disable ext led function.
 
err_t color16_enable_ext_led (color16_t *ctx, uint8_t led_curr)
 Color 16 enable ext led function.
 
err_t color16_set_integration_time_ms (color16_t *ctx, float int_time_ms)
 Color 16 set integration time ms function.
 
err_t color16_set_wait_time_ms (color16_t *ctx, float wait_time_ms)
 Color 16 set wait time ms function.
 
err_t color16_read_data (color16_t *ctx, color16_data_t *data_out)
 Color 16 read data function.
 

Detailed Description

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

◆ color16_cfg_setup()

void color16_cfg_setup ( color16_cfg_t * cfg)

Color 16 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ color16_check_communication()

err_t color16_check_communication ( color16_t * ctx)

Color 16 check communication function.

This function checks the communication by reading and verifying the device ID.

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

◆ color16_default_cfg()

err_t color16_default_cfg ( color16_t * ctx)

Color 16 default configuration function.

This function executes a default configuration of Color 16 click board.

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

◆ color16_disable_ext_led()

err_t color16_disable_ext_led ( color16_t * ctx)

Color 16 disable ext led function.

This function disables the onboard LED.

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

◆ color16_enable_ext_led()

err_t color16_enable_ext_led ( color16_t * ctx,
uint8_t led_curr )

Color 16 enable ext led function.

This function enables the onboard LED with the selected led driver current.

Parameters
[in]ctx: Click context object. See color16_t object definition for detailed explanation.
[in]led_curr: LED Driver current in mA [4-258].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color16_generic_read()

err_t color16_generic_read ( color16_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Color 16 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 color16_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.

◆ color16_generic_write()

err_t color16_generic_write ( color16_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Color 16 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 color16_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.

◆ color16_get_int_pin()

uint8_t color16_get_int_pin ( color16_t * ctx)

Color 16 get int pin function.

This function returns the INT pin logic state.

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

◆ color16_init()

err_t color16_init ( color16_t * ctx,
color16_cfg_t * cfg )

Color 16 initialization function.

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

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

◆ color16_read_data()

err_t color16_read_data ( color16_t * ctx,
color16_data_t * data_out )

Color 16 read data function.

This function checks if the spectral measurement data is ready and then reads data from all channels along with the STATUS and ASTATUS bytes.

Parameters
[in]ctx: Click context object. See color16_t object definition for detailed explanation.
[out]data_out: Spectral measurements data object. See color16_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color16_read_register()

err_t color16_read_register ( color16_t * ctx,
uint8_t reg,
uint8_t * data_out )

Color 16 read register function.

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

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

◆ color16_read_register_word()

err_t color16_read_register_word ( color16_t * ctx,
uint8_t reg,
uint16_t * data_out )

Color 16 read register word function.

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

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

◆ color16_set_integration_time_ms()

err_t color16_set_integration_time_ms ( color16_t * ctx,
float int_time_ms )

Color 16 set integration time ms function.

This function sets the integration time in milliseconds by setting the ATIME and ASTEP registers.

Parameters
[in]ctx: Click context object. See color16_t object definition for detailed explanation.
[in]int_time_ms: Integration time in milliseconds [from COLOR16_INTEGRATION_TIME_MIN to COLOR16_INTEGRATION_TIME_MAX].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color16_set_ldr_pin()

void color16_set_ldr_pin ( color16_t * ctx,
uint8_t state )

Color 16 set ldr pin function.

This function sets the LDR pin logic state.

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

◆ color16_set_reg_bank_access()

err_t color16_set_reg_bank_access ( color16_t * ctx,
uint8_t reg_bank )

Color 16 set reg bank access function.

This function sets the register bank access.

Parameters
[in]ctx: Click context object. See color16_t object definition for detailed explanation.
[in]reg_bank:
  • 0 - Access to registers above 80h,
  • 1 - Access to registers from 20h to 7Fh.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color16_set_wait_time_ms()

err_t color16_set_wait_time_ms ( color16_t * ctx,
float wait_time_ms )

Color 16 set wait time ms function.

This function sets the wait time in milliseconds by setting the WTIME register.

Parameters
[in]ctx: Click context object. See color16_t object definition for detailed explanation.
[in]wait_time_ms: Wait time in milliseconds [from COLOR16_WAIT_TIME_MIN to COLOR16_WAIT_TIME_MAX].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ color16_write_register()

err_t color16_write_register ( color16_t * ctx,
uint8_t reg,
uint8_t data_in )

Color 16 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 color16_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.

◆ color16_write_register_word()

err_t color16_write_register_word ( color16_t * ctx,
uint8_t reg,
uint16_t data_in )

Color 16 write register word function.

This function writes a data word starting from the selected register by using I2C serial interface.

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