Frederico Prado / smartRamalEZR

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

Fork of smartRamalKW by Equipe Firmware V2COM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers boxAlarm.cpp Source File

boxAlarm.cpp

00001 #include "boxAlarm.h"
00002 
00003 BoxAlarm::BoxAlarm(){
00004     
00005 }
00006 
00007 void BoxAlarm::init(){
00008     boxSensor.mode(PullNone);
00009 //    if(isAlarmEnabled(ALARME_CAIXA)){
00010 //        boxSensor.rise(this, &BoxAlarm::stateChanged);
00011 //        boxSensor.fall(this, &BoxAlarm::stateChanged);
00012 //    }
00013 }
00014 
00015 void BoxAlarm::stateChanged(){
00016     bool state = boxSensor;
00017     ledBox = state;
00018     DEBUG(printf("[BOX ALARM] STATE = %d\r\n", state));
00019     alarm.writeAlarm(ALARME_CAIXA, state, getAlarmState(ALARME_CAIXA));
00020 }
00021 
00022 void BoxAlarm::checkState(){
00023     bool state = boxSensor;
00024     ledBox = state;
00025     if(state != getAlarmState(ALARME_CAIXA)){
00026         DEBUG(printf("[BOX ALARM] STATE = %d\r\n", state));
00027         alarm.writeAlarm(ALARME_CAIXA, state, getAlarmState(ALARME_CAIXA));
00028     }
00029 }