Buffered Test
Dependencies: ExioBufferdController MCP23S17 mbed-rtos mbed
main.cpp
- Committer:
- ryood
- Date:
- 2016-11-04
- Revision:
- 3:ee7fd89f2539
- Parent:
- 2:0a339555ddf6
- Child:
- 4:20ee7612edb9
File content as of revision 3:ee7fd89f2539:
/* * ExioBufferdController Test * * mbed: revison 121 * mbed-rtos: revision 117 * * Created: 2016.11.05 * */ #include "mbed.h" #include "rtos.h" #include "ExioMcp23s17.h" #include "ExioInBuffer.h" #include "ExioBufferedIn.h" SPI Spi(PC_12, PC_11, PC_10); // SPI3: mosi, miso, sclk //SPI Spi(PA_7, PA_6, PA_5); // SPI1: mosi, miso, sclk // MExioMcp23s17(int hardwareaddress, SPI& spi, PinName nCs, PinName nReset); ExioMcp23s17 Exio(0x00, Spi, PD_2, PA_13); void testExioInBuffer() { printf("*** Test ExioInBuffer ***\r\n"); // Reset MCP23S17 (初期化時にreset()が必要) Exio.reset(); ExioInBuffer exioInBufferA(&Exio, ExioPortA); ExioInBuffer exioInBufferB(&Exio, ExioPortB); exioInBufferA.run(1); exioInBufferB.run(1); while (true) { uint8_t va = exioInBufferA.readPort(); uint8_t vb = exioInBufferB.readPort(); printf("%d %d\r\n", va, vb); //Thread::wait(10); } } /* void testExioBufferedIn() { printf("*** Test ExioBuffedIn ***\r\n"); // Reset MCP23S17 (初期化時にreset()が必要) Exio.reset(); ExioInBuffer inBufferB(&Exio, ExioPortB, 1); ExioBufferedIn inB[] = { ExioBufferedIn(&inBufferB, 0), ExioBufferedIn(&inBufferB, 1), ExioBufferedIn(&inBufferB, 2), ExioBufferedIn(&inBufferB, 3), ExioBufferedIn(&inBufferB, 4), ExioBufferedIn(&inBufferB, 5), ExioBufferedIn(&inBufferB, 6), ExioBufferedIn(&inBufferB, 7) }; inBufferB.run(); while (true) { for (int i = 0; i < 8; i++) { int v = inB[i].read(); printf("%d ", v); } printf("\r\n"); //Thread::wait(10); } } */ int main() { testExioInBuffer(); //testExioBufferedIn(); }