Creating a project about PriSensor for TT_Mxx

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PirSensor.cpp Source File

PirSensor.cpp

00001 #include "PirSensor.h"
00002 
00003 
00004 
00005 #if defined(__TT_M4G9__)
00006 #define DEFAULT_DOR_PIN PK1
00007 #endif
00008 
00009 
00010 #if defined(__TT_M3HQ__)
00011 #define DEFAULT_DOR_PIN PJ4
00012 #endif
00013 
00014 
00015 PirSensor::PirSensor()
00016 {
00017      interruptPin = new InterruptIn(DEFAULT_DOR_PIN);
00018 }
00019 
00020 PirSensor::PirSensor(PinName pin)
00021 {
00022     interruptPin = new InterruptIn(pin);
00023 }
00024 
00025 void PirSensor::handleCallback(Callback<void()> func)
00026 {
00027     interruptPin->fall(func);
00028 }