* @author Phil Buonadonna
*/
module Tsl2561InternalP {
+ provides interface Init;
provides interface HplTSL256x[uint8_t id];
+ uses interface Init as SubInit;
uses interface HplTSL256x as ToHPLC;
+ uses interface GpioInterrupt as InterruptAlert;
}
implementation {
uint8_t currentId;
+ command error_t Init.init() {
+ call SubInit.init();
+ // The Intel Mote 2 Sensorboard multiplexes the TSL interrupt through a NAND
+ // gate. Need to overrid the edge trigger from the driver default
+ call InterruptAlert.enableRisingEdge();
+ return SUCCESS;
+ }
+
command error_t HplTSL256x.measureCh0[uint8_t id]() {
currentId = id;
return call ToHPLC.measureCh0();
signal HplTSL256x.alertThreshold[currentId]();
}
+ async event void InterruptAlert.fired() {}
+
default async event void HplTSL256x.measureCh0Done[uint8_t id]( error_t error, uint16_t val ){ return; }
default async event void HplTSL256x.measureCh1Done[uint8_t id]( error_t error, uint16_t val ){ return; }
default async event void HplTSL256x.setCONTROLDone[uint8_t id]( error_t error ){ return; }