Creating a project about PriSensor for TT_Mxx

Committer:
ThunderSoft
Date:
Wed May 15 13:13:42 2019 +0000
Revision:
3:65b6e5b2be31
Parent:
1:0b1a84ce037f
Cancel delay.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ThunderSoft 0:8f7f050af5a8 1 #include "PirSensor.h"
ThunderSoft 0:8f7f050af5a8 2
ThunderSoft 0:8f7f050af5a8 3
ThunderSoft 0:8f7f050af5a8 4
ThunderSoft 0:8f7f050af5a8 5 #if defined(__TT_M4G9__)
ThunderSoft 3:65b6e5b2be31 6 #define DEFAULT_DOR_PIN PK1
ThunderSoft 0:8f7f050af5a8 7 #endif
ThunderSoft 0:8f7f050af5a8 8
ThunderSoft 0:8f7f050af5a8 9
ThunderSoft 0:8f7f050af5a8 10 #if defined(__TT_M3HQ__)
ThunderSoft 1:0b1a84ce037f 11 #define DEFAULT_DOR_PIN PJ4
ThunderSoft 0:8f7f050af5a8 12 #endif
ThunderSoft 0:8f7f050af5a8 13
ThunderSoft 0:8f7f050af5a8 14
ThunderSoft 0:8f7f050af5a8 15 PirSensor::PirSensor()
ThunderSoft 0:8f7f050af5a8 16 {
ThunderSoft 0:8f7f050af5a8 17 interruptPin = new InterruptIn(DEFAULT_DOR_PIN);
ThunderSoft 0:8f7f050af5a8 18 }
ThunderSoft 0:8f7f050af5a8 19
ThunderSoft 0:8f7f050af5a8 20 PirSensor::PirSensor(PinName pin)
ThunderSoft 0:8f7f050af5a8 21 {
ThunderSoft 0:8f7f050af5a8 22 interruptPin = new InterruptIn(pin);
ThunderSoft 0:8f7f050af5a8 23 }
ThunderSoft 0:8f7f050af5a8 24
ThunderSoft 0:8f7f050af5a8 25 void PirSensor::handleCallback(Callback<void()> func)
ThunderSoft 0:8f7f050af5a8 26 {
ThunderSoft 0:8f7f050af5a8 27 interruptPin->fall(func);
ThunderSoft 0:8f7f050af5a8 28 }