Internal_Datalogger but with USB support removed (for MAX40108 Demo board), proof of concept that MAX32625 can be used successfully with VDDB(USB) left unpowered, as long as the USB library is not used.
Dependencies: max32625pico CmdLine
Diff: DataLogger_Internal.cpp
- Revision:
- 6:f6d16658342b
- Parent:
- 5:aaf8b5f5fda1
- Child:
- 7:949ec8581f5e
diff -r aaf8b5f5fda1 -r f6d16658342b DataLogger_Internal.cpp --- a/DataLogger_Internal.cpp Sun Nov 29 07:47:06 2020 +0000 +++ b/DataLogger_Internal.cpp Sun Nov 29 11:06:18 2020 +0000 @@ -2347,6 +2347,12 @@ // Virtual serial port over USB // The baud rate does not affect the virtual USBSerial UART. USBSerial serial; +// TX/RX auxiliary UART port cmdLine_AUXserial AUXserial +Serial AUXserial(UART0_TX, UART0_RX); // MAX32625PICO pin 19/20 TX P0_1, RX P0_0 + #define HAS_AUX_SERIAL 1 +//Serial serial(UART1_TX, UART1_RX); // MAX32625PICO underside? TX P2_1, RX P2_0 +//Serial DAPLINKserial(UART2_TX, UART2_RX); // MAX32625PICO DAPLINK TX P3_1, RX P3_0 +// #define HAS_DAPLINK_SERIAL 1 //-------------------------------------------------- #elif defined(TARGET_MAX32620FTHR) #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..." @@ -2361,12 +2367,12 @@ //USBSerial serial; //Serial serial(UART0_TX, UART0_RX); // tx, rx MAX32620FTHR: P0_1,P0_0 (PMOD Port 0) //Serial serial(UART1_TX, UART1_RX); // tx, rx MAX32620FTHR: P2_1,P2_0 (DAPLINK) -Serial serial(UART2_TX, UART2_RX); // tx, rx MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14) +// TX/RX auxiliary UART port cmdLine_AUXserial AUXserial +Serial AUXserial(UART2_TX, UART2_RX); // tx, rx MAX32620FTHR: P3_1,P3_0 (J1.15,J1.14) + #define HAS_AUX_SERIAL 1 //Serial serial(UART3_TX, UART3_RX); // tx, rx MAX32620FTHR: P5_4,P5_3 (J2.7,J2.8) //Serial serial(SERIAL_TX, SERIAL_RX); // tx, rx -//Serial serial(USBTX, USBRX); // tx, rx //Serial serial(UART_TX, UART_RX); // tx, rx -// //-------------------------------------------------- #elif defined(TARGET_MAX32600) #include "USBSerial.h" @@ -2398,6 +2404,10 @@ // #include "CmdLine.h" +# if HAS_AUX_SERIAL +// TX/RX auxiliary UART port cmdLine_AUXserial AUXserial +CmdLine cmdLine_AUXserial(AUXserial, "AUXserial"); +# endif // HAS_AUX_SERIAL # if HAS_DAPLINK_SERIAL CmdLine cmdLine_DAPLINKserial(DAPLINKserial, "DAPLINK"); # endif // HAS_DAPLINK_SERIAL @@ -2421,11 +2431,19 @@ cmdLine_DAPLINKserial.clear(); //~ cmdLine_DAPLINKserial.serial().printf("\r\n cmdLine_DAPLINKserial.serial().printf test\r\n"); cmdLine_DAPLINKserial.onEOLcommandParser = main_menu_onEOLcommandParser; - /// @todo CmdLine::set_immediate_handler(char, functionPointer_void_void_on_immediate_0x21); //~ cmdLine_DAPLINKserial.on_immediate_0x21 = on_immediate_0x21; //~ cmdLine_DAPLINKserial.on_immediate_0x7b = on_immediate_0x7b; //~ cmdLine_DAPLINKserial.on_immediate_0x7d = on_immediate_0x7d; # endif +# if HAS_AUX_SERIAL + // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial + cmdLine_AUXserial.clear(); + //~ cmdLine_AUXserial.serial().printf("\r\n cmdLine_AUXserial.serial().printf test\r\n"); + cmdLine_AUXserial.onEOLcommandParser = main_menu_onEOLcommandParser; + //~ cmdLine_AUXserial.on_immediate_0x21 = on_immediate_0x21; + //~ cmdLine_AUXserial.on_immediate_0x7b = on_immediate_0x7b; + //~ cmdLine_AUXserial.on_immediate_0x7d = on_immediate_0x7d; +# endif // HAS_AUX_SERIAL #endif // USE_CMDLINE_MENUS support CmdLine command menus // example code: serial port banner message @@ -2437,6 +2455,9 @@ # if HAS_DAPLINK_SERIAL cmdLine_DAPLINKserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410 # endif // HAS_DAPLINK_SERIAL +# if HAS_AUX_SERIAL + cmdLine_AUXserial.serial().printf("\r\nInternal_DataLogger\r\n"); // instead of Hello_MAX11410 +# endif // HAS_AUX_SERIAL #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC // CODE GENERATOR: get spi properties from device @@ -2494,6 +2515,16 @@ #if USE_CMDLINE_MENUS // support CmdLine command menus // TODO support CmdLine command menus (like on Serial_Tester); help and usual boilerplate +# if HAS_AUX_SERIAL + if (AUXserial.readable()) { + cmdLine_AUXserial.append(AUXserial.getc()); + } +# endif // HAS_AUX_SERIAL +# if HAS_DAPLINK_SERIAL + if (DAPLINKserial.readable()) { + cmdLine_DAPLINKserial.append(DAPLINKserial.getc()); + } +# endif // HAS_DAPLINK_SERIAL if (serial.readable()) { int c = serial.getc(); // instead of getc() or fgetc() cmdLine.append(c);