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: ExioBufferdController MCP23S17 mbed-rtos mbed
Diff: main.cpp
- Revision:
- 9:76d17c5cac87
- Parent:
- 8:d511db400a09
- Child:
- 10:5d1a09afe152
--- a/main.cpp Fri Nov 04 23:16:46 2016 +0000
+++ b/main.cpp Fri Nov 04 23:20:32 2016 +0000
@@ -149,11 +149,17 @@
}
}
+bool state = false;
uint8_t count = 0;
+
void pa7Falled() {
count++;
}
+void pa6Falled() {
+ state = !state;
+}
+
void testExioBufferedPinDetect()
{
printf("*** Test ExioBufferedPinDetect ***\r\n");
@@ -162,18 +168,22 @@
Exio.reset();
ExioInBuffer inBufferA(&Exio, ExioPortA);
+ ExioBufferedPinDetect pinA6(&inBufferA, 6);
ExioBufferedPinDetect pinA7(&inBufferA, 7);
// assign callback functions
+ pinA6.attach_asserted(&pa6Falled);
+ pinA6.setAssertValue(0);
pinA7.attach_asserted(&pa7Falled);
pinA7.setAssertValue(0);
// Start Timers
inBufferA.run(5);
+ pinA6.setSampleFrequency(10000);
pinA7.setSampleFrequency(10000);
while (true) {
- printf("%d\r\n", count);
+ printf("%d %d\r\n", state, count);
}
}