Adafruit AS726x Arduino Library
|
Class that stores state and functions for interacting with AS726x spectral sensors. More...
#include <Adafruit_AS726x.h>
Public Member Functions | |
Adafruit_AS726x (int8_t addr=AS726x_ADDRESS) | |
Class constructor. More... | |
bool | begin (TwoWire *theWire=&Wire) |
Set up hardware and begin communication with the sensor. More... | |
void | setIndicateCurrent (uint8_t current) |
set the current limit for the driver LED. More... | |
void | indicateLED (boolean on) |
turn on/off the indicator LED More... | |
void | drvOn () |
turn on the driver LED | |
void | drvOff () |
turn off the driver LED | |
void | setDrvCurrent (uint8_t current) |
set the current limit for the driver LED. More... | |
void | setConversionType (uint8_t type) |
Set the conversion mode. More... | |
void | setGain (uint8_t gain) |
Set the sensor gain. More... | |
void | setIntegrationTime (uint8_t time) |
Set the integration time for the sensor. More... | |
void | enableInterrupt () |
enable the device interrupt | |
void | disableInterrupt () |
disable the device interrupt | |
void | startMeasurement () |
begin a measurement. This sets the conversion mode to ONE_SHOT. | |
bool | dataReady () |
Check if the sensor is ready to return data. More... | |
uint8_t | readTemperature () |
Read the on-board temperature sensor. More... | |
uint16_t | readChannel (uint8_t channel) |
read an individual raw spectral channel More... | |
uint16_t | readViolet () |
Read raw violet color value (AS7262 only) More... | |
uint16_t | readBlue () |
Read raw blue color value (AS7262 only) More... | |
uint16_t | readGreen () |
Read raw green color value (AS7262 only) More... | |
uint16_t | readYellow () |
Read raw yellow color value (AS7262 only) More... | |
uint16_t | readOrange () |
Read raw orange color value (AS7262 only) More... | |
uint16_t | readRed () |
Read raw red color value (AS7262 only) More... | |
void | readRawValues (uint16_t *buf, uint8_t num=AS726x_NUM_CHANNELS) |
read the raw channels More... | |
float | readCalibratedValue (uint8_t channel) |
read an individual calibrated spectral channel More... | |
float | readCalibratedViolet () |
Read calibrated violet color value (AS7262 only) More... | |
float | readCalibratedBlue () |
Read calibrated blue color value (AS7262 only) More... | |
float | readCalibratedGreen () |
Read calibrated green color value (AS7262 only) More... | |
float | readCalibratedYellow () |
Read calibrated yellow color value (AS7262 only) More... | |
float | readCalibratedOrange () |
Read calibrated orange color value (AS7262 only) More... | |
float | readCalibratedRed () |
Read calibrated red color value (AS7262 only) More... | |
void | readCalibratedValues (float *buf, uint8_t num=AS726x_NUM_CHANNELS) |
read the calibrated channels More... | |
Class that stores state and functions for interacting with AS726x spectral sensors.
|
inline |
Class constructor.
addr | Optional I2C address the sensor can be found on. Defaults to 0x49. |
bool Adafruit_AS726x::begin | ( | TwoWire * | theWire = &Wire | ) |
Set up hardware and begin communication with the sensor.
theWire | a TwoWire object to use for I2C communication |
void Adafruit_AS726x::setIndicateCurrent | ( | uint8_t | current | ) |
set the current limit for the driver LED.
current | the current limit setting. Should be one of LIMIT_1MA, LIMIT_2MA, LIMIT_4MA, or LIMIT_8MA |
void Adafruit_AS726x::indicateLED | ( | boolean | on | ) |
turn on/off the indicator LED
on | True if you want the LED on, False to turn off |
void Adafruit_AS726x::setDrvCurrent | ( | uint8_t | current | ) |
set the current limit for the driver LED.
current | the current limit setting. Should be one of LIMIT_12MA5, LIMIT_25MA, LIMIT_50MA, or LIMIT_100MA = 0b11. |
void Adafruit_AS726x::setConversionType | ( | uint8_t | type | ) |
Set the conversion mode.
type | the mode to set the sensor to. Should be one of MODE_0, MODE_1, MODE_2, ONE_SHOT. |
void Adafruit_AS726x::setGain | ( | uint8_t | gain | ) |
Set the sensor gain.
gain | the gain to set the sensor to. Should be one of GAIN_1X, GAIN_3X7, GAIN_16X, or GAIN_64X = 0b11. |
void Adafruit_AS726x::setIntegrationTime | ( | uint8_t | time | ) |
Set the integration time for the sensor.
time | the integration time to set. The actual integration time will be time*2.8ms |
|
inline |
Check if the sensor is ready to return data.
|
inline |
Read the on-board temperature sensor.
uint16_t Adafruit_AS726x::readChannel | ( | uint8_t | channel | ) |
read an individual raw spectral channel
channel | the channel to read |
|
inline |
Read raw violet color value (AS7262 only)
|
inline |
Read raw blue color value (AS7262 only)
|
inline |
Read raw green color value (AS7262 only)
|
inline |
Read raw yellow color value (AS7262 only)
|
inline |
Read raw orange color value (AS7262 only)
|
inline |
Read raw red color value (AS7262 only)
void Adafruit_AS726x::readRawValues | ( | uint16_t * | buf, |
uint8_t | num = AS726x_NUM_CHANNELS |
||
) |
read the raw channels
buf | the buffer to read the data into |
num | Optional number of channels to read. Defaults to AS726x_NUM_CHANNELS |
float Adafruit_AS726x::readCalibratedValue | ( | uint8_t | channel | ) |
read an individual calibrated spectral channel
channel | the channel to read |
|
inline |
Read calibrated violet color value (AS7262 only)
|
inline |
Read calibrated blue color value (AS7262 only)
|
inline |
Read calibrated green color value (AS7262 only)
|
inline |
Read calibrated yellow color value (AS7262 only)
|
inline |
Read calibrated orange color value (AS7262 only)
|
inline |
Read calibrated red color value (AS7262 only)
void Adafruit_AS726x::readCalibratedValues | ( | float * | buf, |
uint8_t | num = AS726x_NUM_CHANNELS |
||
) |
read the calibrated channels
buf | the buffer to read the data into |
num | Optional number of channels to read. Defaults to AS726x_NUM_CHANNELS |