30 #include <mraa/gpio.h> 32 #define SI114X_I2C_BUS 0 33 #define SI114X_DEFAULT_I2C_ADDR 0x60 34 #define SI114X_HW_KEY 0x17 79 typedef enum { REG_PART_ID = 0x00,
83 REG_IRQ_ENABLE = 0x04,
92 REG_MEAS_RATE0 = 0x08,
93 REG_MEAS_RATE1 = 0x09,
106 REG_IRQ_STATUS = 0x21,
107 REG_ALS_VIS_DATA0 = 0x22,
108 REG_ALS_VIS_DATA1 = 0x23,
109 REG_ALS_IR_DATA0 = 0x24,
110 REG_ALS_IR_DATA1 = 0x25,
111 REG_PS1_DATA0 = 0x26,
112 REG_PS1_DATA1 = 0x27,
113 REG_PS2_DATA0 = 0x28,
114 REG_PS2_DATA1 = 0x29,
115 REG_PS3_DATA0 = 0x2a,
116 REG_PS3_DATA1 = 0x2b,
117 REG_AUX_UVINDEX0 = 0x2c,
118 REG_AUX_UVINDEX1 = 0x2d,
119 REG_PARAM_READ = 0x2e,
121 REG_CHIP_STAT = 0x30,
123 REG_ANA_IN_KEY0 = 0x3b,
124 REG_ANA_IN_KEY1 = 0x3c,
125 REG_ANA_IN_KEY2 = 0x3d,
126 REG_ANA_IN_KEY3 = 0x3e
132 typedef enum { PARAM_I2C_ADDDR = 0x00,
134 PARAM_PSLED12_SEL = 0x02,
135 PARAM_PSLED3_SEL = 0x03,
137 PARAM_PS_ENCODING = 0x05,
138 PARAM_ALS_ENCODING = 0x06,
139 PARAM_PS1_ADCMUX = 0x07,
140 PARAM_PS2_ADCMUX = 0x08,
141 PARAM_PS3_ADCMUX = 0x09,
142 PARAM_PS_ADC_COUNT = 0x0a,
143 PARAM_PS_ADC_GAIN = 0x0b,
144 PARAM_PS_ADC_MISC = 0x0c,
146 PARAM_ALS_IR_ADCMUX = 0x0e,
147 PARAM_AUX_ADCMUX = 0x0f,
148 PARAM_ALS_VIS_ADC_COUNT = 0x10,
149 PARAM_ALS_VIS_ADC_GAIN = 0x11,
150 PARAM_ALS_VIS_ADC_MISC = 0x12,
152 PARAM_LED_REC = 0x1c,
153 PARAM_ALS_IR_ADC_COUNT = 0x1d,
154 PARAM_ALS_IR_ADX_GAIN = 0x1e,
155 PARAM_ALS_IR_ADC_MISC = 0x1f
161 typedef enum { CMD_NOOP = 0x00,
167 CMD_ALS_FORCE = 0x06,
168 CMD_PSALS_FORCE = 0x07,
171 CMD_ALS_PAUSE = 0x0a,
172 CMD_PSALS_PAUSE = 0x0b,
176 CMD_PSALS_AUTO = 0x0f,
178 CMD_PARAM_QUERY = 0x80,
186 typedef enum { CHLIST_EN_PS1 = 0x01,
187 CHLIST_EN_PS2 = 0x02,
188 CHLIST_EN_PS3 = 0x04,
190 CHLIST_EN_ALS_VIS = 0x10,
191 CHLIST_EN_ALS_IR = 0x20,
192 CHLIST_EN_AUX = 0x40,
199 typedef enum { ERR_NONE = 0x00,
201 ERR_INVALID_SET = 0x80,
202 ERR_PS1_ADC_OVER = 0x88,
203 ERR_PS2_ADC_OVER = 0x89,
204 ERR_PS3_ADC_OVER = 0x8a,
205 ERR_ALS_VIS_ADC_OVER = 0x8c,
206 ERR_ALS_IR_ADC_OVER = 0x8d,
207 ERR_AUX_ADC_OVER = 0x8e
214 typedef enum { IRQEN_ALS_IE = 0x01,
226 SI114X(
int bus, uint8_t address = SI114X_DEFAULT_I2C_ADDR);
240 bool writeByte(uint8_t reg, uint8_t byte);
314 mraa_i2c_context m_i2c;
bool writeByte(uint8_t reg, uint8_t byte)
Definition: si114x.cxx:78
float getUVIndex()
Definition: si114x.hpp:311
SI114X_CMD_T
Definition: si114x.hpp:161
SI114X_PARAM_T
Definition: si114x.hpp:132
uint16_t readWord(uint8_t reg)
Definition: si114x.cxx:101
void setUVCalibration(uint8_t uvcoeff0, uint8_t uvcoeff1, uint8_t uvcoeff2, uint8_t uvcoeff3)
Definition: si114x.cxx:110
void reset()
Definition: si114x.cxx:141
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
API for the SI1145 UV Light Sensor.
Definition: si114x.hpp:73
void writeParam(SI114X_PARAM_T param, uint8_t value)
Definition: si114x.cxx:120
~SI114X()
Definition: si114x.cxx:73
uint8_t readByte(uint8_t reg)
Definition: si114x.cxx:92
SI114X_CHLIST_BITS_T
Definition: si114x.hpp:186
SI114X_IRQEN_BITS_T
Definition: si114x.hpp:214
uint8_t readParam(SI114X_PARAM_T param)
Definition: si114x.cxx:133
SI114X(int bus, uint8_t address=SI114X_DEFAULT_I2C_ADDR)
Definition: si114x.cxx:39
SI114X_ERR_T
Definition: si114x.hpp:199
void initialize()
Definition: si114x.cxx:167
SI114X_REG_T
Definition: si114x.hpp:79
void update()
Definition: si114x.cxx:190