49#ifdef ARDUINO_T_AMOLED_147
50#include <XPowersAXP2101.tpp>
57#if defined(ARDUINO_T_AMOLED_147)
60 Serial.println(
"PMU NOT FOUND!\n");
62 power.setALDO1Voltage(1800); power.enableALDO1();
63 power.setALDO3Voltage(3300); power.enableALDO3();
64 power.setBLDO1Voltage(1800); power.enableBLDO1();
77 SensorWireHelper::dumpDevices(Wire);
82 Serial.println(
"Failed to find CM32181 - check your wiring!");
88 Serial.println(
"Init CM32181 Sensor success!");
91 Serial.print(
"CM32181 ID = "); Serial.println(
id);
105 uint16_t lowThresholdRaw = 100;
106 uint16_t highThresholdRaw = 250;
131 Serial.println(
"Low interrupt event");
134 Serial.println(
"High interrupt event");
137 Serial.println(
"This is an impossible place to reach");
147 Serial.print(
" IRQ:"); Serial.print(pinVal);
148 Serial.print(
" RAW:"); Serial.print(raw);
149 Serial.print(
" Lux:"); Serial.println(lux);
bool begin(SensorCommCustom::CustomCallback callback, uint8_t addr)
Initialize the sensor using custom callback interface.
High Sensitivity I2C Ambient Light Sensor (CM32181) driver.
void setSampling(Sampling sampling=SAMPLING_X1, IntegrationTime int_time=INTEGRATION_TIME_200MS)
Configure ALS sensitivity and integration time.
InterruptEvent getIrqStatus()
Read IRQ status (and clear interrupt by reading status register).
void enableINT()
Enable interrupt function (REG_ALS_CONF bit1).
void disableINT()
Disable interrupt function (REG_ALS_CONF bit1).
void powerOn()
Power on sensor (REG_ALS_CONF bit0 = 0).
@ INTEGRATION_TIME_400MS
400ms
InterruptEvent
Interrupt event type reported by getIrqStatus().
@ ALS_EVENT_HIGH_TRIGGER
High threshold window interrupt.
@ ALS_EVENT_LOW_TRIGGER
Low threshold window interrupt.
float getLux()
Convert raw ALS to lux (approximate).
uint16_t getRaw()
Read raw ALS data (16-bit).
void setIntThreshold(uint16_t low_threshold, uint16_t high_threshold)
Set ALS interrupt thresholds.
int getChipID()
Read chip ID.
@ SAMPLING_X2
ALS Sensitivity x2.