Buffered Test
Dependencies: ExioBufferdController MCP23S17 mbed-rtos mbed
Diff: main.cpp
- Revision:
- 8:d511db400a09
- Parent:
- 7:7a17d81db52f
- Child:
- 9:76d17c5cac87
--- a/main.cpp Fri Nov 04 22:55:21 2016 +0000 +++ b/main.cpp Fri Nov 04 23:16:46 2016 +0000 @@ -15,6 +15,7 @@ #include "ExioInBuffer.h" #include "ExioBufferedIn.h" #include "ExioBufferedDebounceIn.h" +#include "ExioBufferedPinDetect.h" #include "ExioBufferedRotaryEncoder.h" SPI Spi(PC_12, PC_11, PC_10); // SPI3: mosi, miso, sclk @@ -148,6 +149,34 @@ } } +uint8_t count = 0; +void pa7Falled() { + count++; +} + +void testExioBufferedPinDetect() +{ + printf("*** Test ExioBufferedPinDetect ***\r\n"); + + // Reset MCP23S17 (初期化時にreset()が必要) + Exio.reset(); + + ExioInBuffer inBufferA(&Exio, ExioPortA); + ExioBufferedPinDetect pinA7(&inBufferA, 7); + + // assign callback functions + pinA7.attach_asserted(&pa7Falled); + pinA7.setAssertValue(0); + + // Start Timers + inBufferA.run(5); + pinA7.setSampleFrequency(10000); + + while (true) { + printf("%d\r\n", count); + } +} + void testExioBufferedRotaryEncoder() { printf("*** Test ExioBufferedRotaryEncoder ***\r\n"); @@ -168,15 +197,15 @@ } } -volatile bool state = false; -volatile uint8_t count = 0; - int main() { //testExioInBuffer(); //testExioBufferedIn(); //testExioBufferedDebounceIn(); //testExioBufferedRotaryEncoder(); + testExioBufferedPinDetect(); + + /* printf("*** Test ExioBufferedContoroller ***\r\n"); @@ -202,5 +231,5 @@ } printf("%d %d\r\n", state, count); } - + */ } \ No newline at end of file