uint32_t Light_D1::getLuminosity() { uint16_t broadband, ir; /* Calculate the actual lux value */ getBroadbandIr(&broadband, &ir); return calculateLux(broadband, ir); }
void Adafruit_TSL2561::getEvent(sensors_event_t *event) { uint16_t broadband, ir; /* Clear the event */ memset(event, 0, sizeof(sensors_event_t)); event->version = sizeof(sensors_event_t); event->sensor_id = _tsl2561SensorID; event->type = SENSOR_TYPE_LIGHT; event->timestamp = 0; /* Calculate the actual lux value */ getLuminosity(&broadband, &ir); event->light = calculateLux(broadband, ir); }
bool Adafruit_TSL2561_Unified::getEvent(sensors_event_t *event) { uint16_t broadband, ir; /* Clear the event */ memset(event, 0, sizeof(sensors_event_t)); event->version = sizeof(sensors_event_t); event->sensor_id = _tsl2561SensorID; event->type = SENSOR_TYPE_LIGHT; event->timestamp = millis(); /* Calculate the actual lux value */ getLuminosity(&broadband, &ir); event->light = calculateLux(broadband, ir); if (event->light == 65536) { return false; } return true; }
int getLight(void){ int light=0; unsigned char temp, adc0, adc1; /* Wait Data Light available */ if(WakeUpModeLight() == 1) { return -1; } setExtendedMode(); do{ adc0 = readAdc0(); adc1 = readAdc1(); } while(! (adc0 & 128 && adc1 & 128)); light = calculateLux(adc0,adc1); sleepModeLight(); I2C_STOP(); return light; }