Buffered Test
Dependencies: ExioBufferdController MCP23S17 mbed-rtos mbed
Diff: main.cpp
- Revision:
- 7:7a17d81db52f
- Parent:
- 6:9acaeb5465d2
- Child:
- 8:d511db400a09
--- a/main.cpp Fri Nov 04 22:38:54 2016 +0000 +++ b/main.cpp Fri Nov 04 22:55:21 2016 +0000 @@ -168,10 +168,39 @@ } } +volatile bool state = false; +volatile uint8_t count = 0; + int main() { //testExioInBuffer(); //testExioBufferedIn(); - testExioBufferedDebounceIn(); + //testExioBufferedDebounceIn(); //testExioBufferedRotaryEncoder(); + + printf("*** Test ExioBufferedContoroller ***\r\n"); + + // Reset MCP23S17 (初期化時にreset()が必要) + Exio.reset(); + + ExioInBuffer inBufferA(&Exio, ExioPortA); + + ExioBufferedDebounceIn pinA6(&inBufferA, 6); + ExioBufferedDebounceIn pinA7(&inBufferA, 7); + + // Start Timers + inBufferA.run(5); + pinA6.set_debounce_us(10000); + pinA7.set_debounce_us(10000); + + while(true) { + if (pinA6.read()) { + state = !state; + } + if (pinA7.read()) { + count++; + } + printf("%d %d\r\n", state, count); + } + } \ No newline at end of file