spectral2 2.0.0.0
spectral2.h File Reference

This file contains API for Spectral 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  spectral2_t
 Click ctx object definition. More...
 
struct  spectral2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define SPECTRAL2_MAP_MIKROBUS(cfg, mikrobus)
 
#define SPECTRAL2_RETVAL   uint8_t
 
#define SPECTRAL2_OK   0x00
 
#define SPECTRAL2_INIT_ERROR   0xFF
 
#define SPECTRAL2_SOFT_RESET   0x01 << 6
 
#define SPECTRAL2_NORMAL_OPERATION   0x00 << 6
 
#define SPECTRAL2_INT_ENABLE   0x01 << 5
 
#define SPECTRAL2_INT_DISABLE   0x00 << 5
 
#define SPECTRAL2_GAIN_1X   0x00 << 4
 
#define SPECTRAL2_GAIN_3_7X   0x01 << 4
 
#define SPECTRAL2_GAIN_16X   0x02 << 4
 
#define SPECTRAL2_GAIN_64X   0x03 << 4
 
#define SPECTRAL2_MODE_0   0x00 << 2
 
#define SPECTRAL2_MODE_1   0x01 << 2
 
#define SPECTRAL2_MODE_2   0x02 << 2
 
#define SPECTRAL2_MODE_3   0x03 << 2
 
#define SPECTRAL2_LED_DRV_CURRENT_12_5mA   0x00 << 4
 
#define SPECTRAL2_LED_DRV_CURRENT_25mA   0x01 << 4
 
#define SPECTRAL2_LED_DRV_CURRENT_50mA   0x02 << 4
 
#define SPECTRAL2_LED_DRV_CURRENT_100mA   0x03 << 4
 
#define SPECTRAL2_LED_DRV_ENABLE   0x01 << 2
 
#define SPECTRAL2_LED_DRV_DISABLE   0x00 << 2
 
#define SPECTRAL2_LED_IND_CURRENT_1mA   0x00 << 1
 
#define SPECTRAL2_LED_IND_CURRENT_2mA   0x01 << 1
 
#define SPECTRAL2_LED_IND_CURRENT_4mA   0x02 << 1
 
#define SPECTRAL2_LED_IND_CURRENT_8mA   0x03 << 1
 
#define SPECTRAL2_LED_IND_ENABLE   0x01
 
#define SPECTRAL2_LED_IND_DISABLE   0x00
 
#define SPECTRAL2_CALIBRATED_DATA_V   0x14
 
#define SPECTRAL2_CALIBRATED_DATA_B   0x18
 
#define SPECTRAL2_CALIBRATED_DATA_G   0x1C
 
#define SPECTRAL2_CALIBRATED_DATA_Y   0x20
 
#define SPECTRAL2_CALIBRATED_DATA_O   0x24
 
#define SPECTRAL2_CALIBRATED_DATA_R   0x28
 
#define SPECTRAL2_DATA_V   0x08
 
#define SPECTRAL2_DATA_B   0x0A
 
#define SPECTRAL2_DATA_G   0x0C
 
#define SPECTRAL2_DATA_Y   0x0E
 
#define SPECTRAL2_DATA_O   0x10
 
#define SPECTRAL2_DATA_R   0x12
 

Functions

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

Detailed Description

This file contains API for Spectral 2 Click driver.