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

Revision:
22:d6dc8a85f435
Parent:
21:ac062a97a71d
Child:
23:c6c652bef4b9
--- a/DataLogger_Internal.cpp	Fri Apr 23 16:57:58 2021 -0700
+++ b/DataLogger_Internal.cpp	Fri Apr 23 22:46:43 2021 -0700
@@ -2419,28 +2419,11 @@
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
-#elif defined(TARGET_MAX32625PICO) || defined(TARGET_MAX40108DEMOP2U9)
+#elif defined(TARGET_MAX32625PICO)
 //Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
 //Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625PICO: P2_1,P2_0 (underside?)
 //Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
 //
-#if MAX40108_DEMO
-// TX/RX auxiliary UART port cmdLine_AUXserial AUXserial is used as main serial port in MAX40108 Demo board
-Serial serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
-//    #define HAS_AUX_SERIAL 1
-//
-// Serial AUXserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX32625PICO: P2_1,P2_0 (underside?)
-//     #define HAS_AUX_SERIAL 1
-//
-// Hardware serial port over DAPLink
-Serial DAPLINKserial(UART2_TX,UART2_RX); // tx,rx UART2 MAX32625PICO: P3_1,P3_0 (DAPLINK)
-    #define HAS_DAPLINK_SERIAL 1
-//
-// Virtual serial port over USB
-//    #include "USBSerial.h"
-// The baud rate does not affect the virtual USBSerial UART.
-//USBSerial serial;
-#else // MAX40108_DEMO
 // TX/RX auxiliary UART port cmdLine_AUXserial AUXserial
 Serial AUXserial(UART0_TX,UART0_RX); // tx,rx UART0 MAX32625PICO: P0_1,P0_0 (pin 19/20)
     #define HAS_AUX_SERIAL 1
@@ -2453,7 +2436,31 @@
     #include "USBSerial.h"
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
-#endif // MAX40108_DEMO
+//--------------------------------------------------
+#elif defined(TARGET_MAX40108DEMOP2U9)
+//Serial UART0serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
+//Serial UART1serial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK)
+//Serial UART2serial(UART2_TX,UART2_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
+//
+// TX/RX auxiliary UART port cmdLine_AUXserial AUXserial is used as main serial port in MAX40108 Demo board
+Serial serial(UART0_TX,UART0_RX); // tx,rx UART0 MAX40108DEMOP2U9: P0_1,P0_0 (J90.1/J90.0 to console)
+//    #define HAS_AUX_SERIAL 1
+//
+// Hardware serial port over DAPLink
+// connection to external MAX32625PICO(DAPLINK) needed TX/RX swap in firmware.
+// MAX32625PICO(DAPLINK) drives DAPLINK.8, listens on DAPLINK.6.
+// See AN6350 MAX32625 Users Guide 7.5.2.3.1 TX and RX Pin Mapping for UART 1 -- Mapping Option B
+//Serial DAPLINKserial(UART1_TX,UART1_RX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option A (normal)
+Serial DAPLINKserial(UART1_RX,UART1_TX); // tx,rx UART1 MAX40108DEMOP2U9: P2_1,P2_0 (DAPLINK) Mapping Option B (TX/RX-swap)
+    #define HAS_DAPLINK_SERIAL 1
+//
+// Serial AUXserial(UART1_TX,UART1_RX); // tx,rx UART2 MAX40108DEMOP2U9: P3_1,P3_0 (unavailable)
+//     #define HAS_AUX_SERIAL 1
+//
+// Virtual serial port over USB
+//    #include "USBSerial.h"
+// The baud rate does not affect the virtual USBSerial UART.
+//USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_MAX32620FTHR)
 #warning "TARGET_MAX32620FTHR not previously tested; need to define serial pins..."
@@ -2545,6 +2552,8 @@
 {
     //~ void SelfTest(CmdLine & cmdLine);
     //~ SelfTest(cmdLine_serial);
+    //
+    // command_table: list of commands to perform on button press
     static char* onButton1_command_table[] = {
         "#onButton1_command_table",
         "%L91",
@@ -2556,6 +2565,8 @@
         "LR",
         ""
     };
+    //
+    // command_table: perform list of commands
     for (int lineIndex = 0; lineIndex < 10; lineIndex++) {
         if (onButton1_command_table[lineIndex] == NULL) { break; }
         if (onButton1_command_table[lineIndex][0] == '\0') { break; }
@@ -2578,6 +2589,8 @@
     // TBD demo configuration
     // TODO diagnostic LED
     // led1 = LED_OFF; led2 = LED_OFF; led3 = LED_ON;     // diagnostic rbg led BLUE
+    //
+    // command_table: list of commands to perform on button press
     static char* onButton2_command_table[] = {
         "#onButton1_command_table",
         "%H91",
@@ -2585,6 +2598,8 @@
         "%L93",
         ""
     };
+    //
+    // command_table: perform list of commands
     for (int lineIndex = 0; lineIndex < 10; lineIndex++) {
         if (onButton2_command_table[lineIndex] == NULL) { break; }
         if (onButton2_command_table[lineIndex][0] == '\0') { break; }