generic module AeroVaneReadP(uint16_t period) {
provides interface Notify<aerovector_t>;
uses {
-#if 0
- interface Alarm<T32khz, uint16_t>;
-#else
interface Timer<TMilli>;
-#endif
interface Read<uint16_t>;
interface StdControl as AnemometerControl;
interface AsyncGet<uint16_t> as Count;
init();
call AnemometerControl.start();
- /* FIXME: First alarm should be synced to top of the next second. How? */
-#if 0
- call Alarm.start(call Alarm.getNow() + period);
-#else
+ /* FIXME: How to get first Timer.fired() synced with top of hour? */
call Timer.startPeriodic(period);
-#endif
return SUCCESS;
}
command error_t Notify.disable()
{
call State.toIdle();
-#if 0
- call Alarm.stop();
-#else
call Timer.stop();
-#endif
call AnemometerControl.stop();
return SUCCESS;
}
-#if 0
- task void readVane();
-
- async event void Alarm.fired()
- {
- call Alarm.start(call Alarm.getAlarm() + period);
- post readVane();
- }
-
- task void readVane()
- {
- //call Alarm.start(call Alarm.getAlarm() + period);
-#else
event void Timer.fired()
{
-#endif
if (!(call State.isIdle()))
call Read.read();
}