Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: libmDot mbed-rtos mbed
Diff: main.cpp
- Revision:
- 2:a2371a150758
- Parent:
- 1:e504b1f72d05
- Child:
- 3:238fa32bcb32
--- a/main.cpp Thu May 19 11:54:18 2016 +0000
+++ b/main.cpp Wed May 25 23:03:33 2016 +0000
@@ -9,6 +9,8 @@
#define REED_PORT PA_0
+DigitalIn reed_sensor(PA_0, PullUp);
+
RawSerial pc(PA_2,NC);
volatile int reed_has_changed = 0;
@@ -17,7 +19,6 @@
reed_has_changed++;
}
-
main() {
pc.baud(115200);
@@ -27,24 +28,27 @@
mDot* dot = mDot::getInstance();
dot->setLogLevel(MTSLog::TRACE_LEVEL);
-
- DigitalIn reed_sensor(REED_PORT);
+ if(dot->getStandbyFlag()){
+ pc.printf("clearing standby flag\r\n");
+ PWR->CSR &= ~PWR_CSR_EWUP;
+ }
+
+ // DigitalIn reed_sensor(REED_PORT);
// reed_sensor.mode(PullUp);
InterruptIn reed_sensor_change(REED_PORT);
-
reed_sensor_change.fall(&isr_reed_sensor_change);
reed_sensor_change.rise(&isr_reed_sensor_change);
reed_sensor_change.mode(PullUp);
-
+
while(1) {
for(int i=0;i<10;i++) {
- pc.printf("changes %d %d\r\n",reed_has_changed,reed_sensor.read());
+ pc.printf("Read %d, Changes: %d\r\n",reed_sensor.read(),reed_has_changed);
wait(1.0);
}
- dot->sleep((int)5, mDot::RTC_ALARM_OR_INTERRUPT, true);
+ dot->sleep((int)10, mDot::RTC_ALARM_OR_INTERRUPT, true);
}
}
\ No newline at end of file