EZR

Dependencies:   CRC16 FreescaleIAP FreescaleWatchdog GGSProtocol LM75B PIMA Parameters PersistentCircularQueue SerialNumberV2COM mbed-dev-watchdog_2016_03_04

Fork of smartRamalKW by Equipe Firmware V2COM

boxAlarm.cpp

Committer:
fprado
Date:
2016-06-16
Revision:
35:78614a27b9e6
Parent:
22:b66e36356dd4

File content as of revision 35:78614a27b9e6:

#include "boxAlarm.h"

BoxAlarm::BoxAlarm(){
    
}

void BoxAlarm::init(){
    boxSensor.mode(PullNone);
//    if(isAlarmEnabled(ALARME_CAIXA)){
//        boxSensor.rise(this, &BoxAlarm::stateChanged);
//        boxSensor.fall(this, &BoxAlarm::stateChanged);
//    }
}

void BoxAlarm::stateChanged(){
    bool state = boxSensor;
    ledBox = state;
    DEBUG(printf("[BOX ALARM] STATE = %d\r\n", state));
    alarm.writeAlarm(ALARME_CAIXA, state, getAlarmState(ALARME_CAIXA));
}

void BoxAlarm::checkState(){
    bool state = boxSensor;
    ledBox = state;
    if(state != getAlarmState(ALARME_CAIXA)){
        DEBUG(printf("[BOX ALARM] STATE = %d\r\n", state));
        alarm.writeAlarm(ALARME_CAIXA, state, getAlarmState(ALARME_CAIXA));
    }
}