Create a UART to USB Serial bridge with the DipCortex
Fork of DipCortex-USB-CDC by
Diff: main.cpp
- Revision:
- 5:dbe3aba53ebf
- Parent:
- 3:5fffa4cb4ca1
--- a/main.cpp Sun Feb 23 22:56:23 2014 +0000 +++ b/main.cpp Sun Feb 23 23:02:12 2014 +0000 @@ -4,7 +4,6 @@ #include "mbed.h" #include "USBSerial.h" -#include "DipCortex-EEprom.h" // Serial TX Pin19, Serial RX Pin20 // Using port and pin names as the mbed definitions pin defs for the M0 are incorrect @@ -26,40 +25,15 @@ int main() { -volatile char charIn; -char tempBuf[15] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; -int i = 0; - - IAP_Init(); pc.attach(settingsChanged); - // wait for a key press - charIn = pc.getc(); - - while (1) - { - pc.printf("Press a key to start\r\n"); - charIn = pc.getc(); - - // Test read - tempBuf[0] = 0; - IAP_Eeprom_Read(1, (uint8_t *)&tempBuf, 15); - pc.printf("EEprom Read : %s\r\n", &tempBuf[0]); + while (1) { + while (uart.readable()) { + pc.putc(uart.getc()); + } - // Write - sprintf( &tempBuf[0], "Testing %i", i ); - IAP_Eeprom_Write(1, (uint8_t *)&tempBuf, 15); - pc.printf("EEprom Writen : %s\r\n", &tempBuf[0]); - - tempBuf[0] = 0; - pc.printf("Press a key to read back\r\n"); - charIn = pc.getc(); - - // Read Back - tempBuf[0] = 0; - IAP_Eeprom_Read(1, (uint8_t *)&tempBuf, 15); - pc.printf("EEprom Read : %s\r\n", &tempBuf[0]); - - i++; + while (pc.readable()) { + uart.putc(pc.getc()); + } } }