Creating a project about PriSensor for TT_Mxx

PirSensor/PirSensor.cpp

Committer:
ThunderSoft
Date:
2019-04-04
Revision:
1:0b1a84ce037f
Parent:
0:8f7f050af5a8
Child:
3:65b6e5b2be31

File content as of revision 1:0b1a84ce037f:

#include "PirSensor.h"



#if defined(__TT_M4G9__)
#define DEFAULT_DOR_PIN PL0
#endif


#if defined(__TT_M3HQ__)
#define DEFAULT_DOR_PIN PJ4
#endif


PirSensor::PirSensor()
{
     interruptPin = new InterruptIn(DEFAULT_DOR_PIN);
}

PirSensor::PirSensor(PinName pin)
{
    interruptPin = new InterruptIn(pin);
}

void PirSensor::handleCallback(Callback<void()> func)
{
    interruptPin->fall(func);
}