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:
- 6:9acaeb5465d2
- Parent:
- 5:526691f54026
- Child:
- 7:7a17d81db52f
--- a/main.cpp Fri Nov 04 22:23:43 2016 +0000
+++ b/main.cpp Fri Nov 04 22:38:54 2016 +0000
@@ -14,6 +14,7 @@
#include "ExioMcp23s17.h"
#include "ExioInBuffer.h"
#include "ExioBufferedIn.h"
+#include "ExioBufferedDebounceIn.h"
#include "ExioBufferedRotaryEncoder.h"
SPI Spi(PC_12, PC_11, PC_10); // SPI3: mosi, miso, sclk
@@ -93,6 +94,60 @@
}
}
+void testExioBufferedDebounceIn()
+{
+ printf("*** Test ExioBuffeDebounceIn ***\r\n");
+
+ // Reset MCP23S17 (初期化時にreset()が必要)
+ Exio.reset();
+
+ ExioInBuffer inBufferA(&Exio, ExioPortA);
+ ExioBufferedDebounceIn inA[] = {
+ ExioBufferedDebounceIn(&inBufferA, 0),
+ ExioBufferedDebounceIn(&inBufferA, 1),
+ ExioBufferedDebounceIn(&inBufferA, 2),
+ ExioBufferedDebounceIn(&inBufferA, 3),
+ ExioBufferedDebounceIn(&inBufferA, 4),
+ ExioBufferedDebounceIn(&inBufferA, 5),
+ ExioBufferedDebounceIn(&inBufferA, 6),
+ ExioBufferedDebounceIn(&inBufferA, 7)
+ };
+
+ ExioInBuffer inBufferB(&Exio, ExioPortB);
+ ExioBufferedIn inB[] = {
+ ExioBufferedDebounceIn(&inBufferB, 0),
+ ExioBufferedDebounceIn(&inBufferB, 1),
+ ExioBufferedDebounceIn(&inBufferB, 2),
+ ExioBufferedDebounceIn(&inBufferB, 3),
+ ExioBufferedDebounceIn(&inBufferB, 4),
+ ExioBufferedDebounceIn(&inBufferB, 5),
+ ExioBufferedDebounceIn(&inBufferB, 6),
+ ExioBufferedDebounceIn(&inBufferB, 7)
+ };
+
+ // Start Timers
+ inBufferA.run(10);
+ inBufferB.run(10);
+ for (int i = 0; i < 8; i++) {
+ inA[i].set_debounce_us(10000);
+ inA[i].set_debounce_us(10000);
+ }
+
+ while (true) {
+ for (int i = 0; i < 8; i++) {
+ int va = inA[i].read();
+ printf("%d ", va);
+ }
+ putchar(' ');
+ for (int i = 0; i < 8; i++) {
+ int vb = inB[i].read();
+ printf("%d ", vb);
+ }
+ printf("\r\n");
+ //Thread::wait(10);
+ }
+}
+
void testExioBufferedRotaryEncoder()
{
printf("*** Test ExioBufferedRotaryEncoder ***\r\n");
@@ -117,5 +172,6 @@
{
//testExioInBuffer();
//testExioBufferedIn();
- testExioBufferedRotaryEncoder();
+ testExioBufferedDebounceIn();
+ //testExioBufferedRotaryEncoder();
}
\ No newline at end of file