spectral2  2.0.0.0
Functions

Functions

void spectral2_cfg_setup (spectral2_cfg_t *cfg)
 Config Object Initialization function. More...
 
SPECTRAL2_RETVAL spectral2_init (spectral2_t *ctx, spectral2_cfg_t *cfg)
 Initialization function. More...
 
void spectral2_default_cfg (spectral2_t *ctx)
 Click Default Configuration function. More...
 
void spectral2_generic_write (spectral2_t *ctx, uint8_t reg, uint8_t data_buf)
 Generic write function. More...
 
uint8_t spectral2_generic_read (spectral2_t *ctx, uint8_t reg)
 Generic read function. More...
 
void spectral2_reset (spectral2_t *ctx)
 Reset function. More...
 
void spectral2_set_integration_time (spectral2_t *ctx, uint8_t cur_time)
 Integration time function. More...
 
uint8_t spectral2_get_temperature (spectral2_t *ctx)
 Read temperature function. More...
 
void spectral2_led_control (spectral2_t *ctx, uint8_t led_data)
 Led ctrl and setting function. More...
 
int16_t spectral2_get_data (spectral2_t *ctx, uint8_t data_reg)
 Read data function. More...
 
int32_t spectral2_get_calibrated_data (spectral2_t *ctx, uint8_t data_reg)
 Reads calibrated data function. More...
 

Detailed Description

Function Documentation

◆ spectral2_cfg_setup()

void spectral2_cfg_setup ( spectral2_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ spectral2_default_cfg()

void spectral2_default_cfg ( spectral2_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Spectral2 click.

Function for configuration measurements

Parameters
ctxClick object.

Options for Configuration:

  Soft Reset ( 0 - automatically after the reset / 1 - soft reset )
  Enable interrupt pin output ( 1 - Enable / 0 - Disable )
  Sensor Channel Gain Setting ( 1x, 3.7x, 16x or  64x)
  Data Conversion Type:
   
     Mode 0 -  reads V, B, G and Y data
     Mode 1 -  reads G, Y, O and R data
     Mode 2 -  reads all data
     Mode 3 -  reads V, B, G, Y, O and R in One-Shot mode
   

◆ spectral2_generic_read()

uint8_t spectral2_generic_read ( spectral2_t ctx,
uint8_t  reg 
)

Generic read function.

Parameters
ctxClick object.
regRegister address.
Returns
Read data value.

@description This function reads data from the desired register.

◆ spectral2_generic_write()

void spectral2_generic_write ( spectral2_t ctx,
uint8_t  reg,
uint8_t  data_buf 
)

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData to be written.

@description This function writes data to the desired register.

◆ spectral2_get_calibrated_data()

int32_t spectral2_get_calibrated_data ( spectral2_t ctx,
uint8_t  data_reg 
)

Reads calibrated data function.

Parameters
ctxClick object.
dataRegValue from which the filter will be read.
Returns
Floating point data that is read from the register.

@description Function reads the calibrated data.

◆ spectral2_get_data()

int16_t spectral2_get_data ( spectral2_t ctx,
uint8_t  data_reg 
)

Read data function.

Parameters
ctxClick object.
dataRegValue from which the filter will be read.
Returns
16 bit signed data that is read from the register.

@description Function for reading the measured data.

◆ spectral2_get_temperature()

uint8_t spectral2_get_temperature ( spectral2_t ctx)

Read temperature function.

Parameters
ctxClick object.
Returns
Device temperature data byte in (deg C).

@description Function for reading device temperature.

◆ spectral2_init()

SPECTRAL2_RETVAL spectral2_init ( spectral2_t ctx,
spectral2_cfg_t cfg 
)

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ spectral2_led_control()

void spectral2_led_control ( spectral2_t ctx,
uint8_t  led_data 
)

Led ctrl and setting function.

Parameters
ctxClick object.
led_dataData that will be written in the LED control register.

@description Function for led control and settings led.

Note
Options:
   LED_DRV current limit ( 12.5mA, 25mA, 50mA or 100mA )
   Enable LED_DRV ( 1 - Enable / 0 - Disable )
   LED_IND current limit ( 1mA, 2mA, 4mA or 8mA )
   Enable LED_IND ( 1 - Enable / 0 - Disable )

◆ spectral2_reset()

void spectral2_reset ( spectral2_t ctx)

Reset function.

Parameters
ctxClick object.

@description This function resets the chip.

◆ spectral2_set_integration_time()

void spectral2_set_integration_time ( spectral2_t ctx,
uint8_t  cur_time 
)

Integration time function.

Parameters
ctxClick object.
cur_timeData that will be written in the integration time register.

@description Function for calculating integration time.

Note
Integration time =

* 2.8ms (default 0xFF)