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:
- 13:184a08909405
- Parent:
- 12:2dfc1f2009e0
- Child:
- 14:d4092094dbfe
diff -r 2dfc1f2009e0 -r 184a08909405 DataLogger_Internal.cpp --- a/DataLogger_Internal.cpp Fri Jan 29 02:34:52 2021 +0000 +++ b/DataLogger_Internal.cpp Tue Feb 02 02:51:01 2021 +0000 @@ -367,6 +367,7 @@ #include "max32625pico.h" // configure MAX32625PICO VDDIOH mode, and I/O voltages for DIP pins and SWD pins MAX32625PICO pico( + // Select source of higher-voltage logic high supply VDDIOH // vddioh_mode_t iohMode //~ MAX32625PICO::IOH_OFF, // No connections to VDDIOH //~ MAX32625PICO::IOH_DIP_IN, // VDDIOH input from DIP pin 1 (AIN0) @@ -375,10 +376,12 @@ //~ MAX32625PICO::IOH_DIP_OUT, // VDDIOH = 3.3V output to DIP pin 1 //~ MAX32625PICO::IOH_SWD_OUT, // VDDIOH = 3.3V output to SWD pin 1 // + // Digital I/O pin logic high voltage 1.8V or 3.3V // vio_t dipVio = MAX32625PICO::VIO_1V8 or MAX32625PICO::VIO_IOH - //~ MAX32625PICO::VIO_1V8, // 1.8V IO (local) - MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V) + MAX32625PICO::VIO_1V8, // 1.8V IO (local) + //~ MAX32625PICO::VIO_IOH, // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V) // + // Software Debug logic high voltage (normally use VIO_IOH) // vio_t swdVio //~ MAX32625PICO::VIO_1V8 // 1.8V IO (local) MAX32625PICO::VIO_IOH // Use VDDIOH (from DIP pin 1, or SWD pin1, or local 3.3V) @@ -1682,6 +1685,20 @@ }; // double SPI_AIN_Voltage[NUM_DUT_ANALOG_IN_CHANNELS]; +// Optional custom per-channel header suffix +#ifndef HAS_SPI_AIN_customChannelHeader +#define HAS_SPI_AIN_customChannelHeader 0 +#endif +#if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix +const char* const SPI_AIN_customChannelHeader_ch[NUM_DUT_ANALOG_IN_CHANNELS] = { + "", // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA + "", // MAX40108: AIN1_1V0_voltage + "WE", // MAX40108: AIN2_WE + "CE", // MAX40108: AIN3_CE + "*100/3.34=mA", // MAX40108: AIN4_*100/3.34=mA + "CELL_VOLTAGE", // MAX40108: AIN5_CELL_VOLTAGE +}; +#endif // HAS_SPI_AIN_customChannelHeader #endif // defined(SPI_ADC_DeviceName) // SPI connected ADC // ---------- Measure_Voltage_custom_props in Measure_Voltage @pre and in class properties ---------- #if defined(SPI_ADC_DeviceName) // SPI connected ADC @@ -1853,7 +1870,7 @@ Platform_AIN_Enable_LSB = 1, Platform_AIN_Enable_Volt = 2, } Platform_AIN_Enable_t; -uint8_t Platform_Enable_ch[NUM_DUT_ANALOG_IN_CHANNELS] = { +uint8_t Platform_Enable_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = { Platform_AIN_Enable_Volt, // AIN0 2=Volt Platform_AIN_Enable_Volt, // AIN1 2=Volt Platform_AIN_Enable_Volt, // AIN2 2=Volt @@ -1861,6 +1878,19 @@ Platform_AIN_Enable_Volt, // AIN4 2=Volt Platform_AIN_Enable_Volt, // AIN5 2=Volt }; +#ifndef HAS_Platform_AIN_customChannelHeader +#define HAS_Platform_AIN_customChannelHeader 1 +#endif +#if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix +const char* const Platform_AIN_customChannelHeader_ch[NUM_PLATFORM_ANALOG_IN_CHANNELS] = { + "=AIN4", // MAX40108: AIN0_1V0_current_ 0.591202*100/3.34 = 17.70065868263473mA + "=AIN5", // MAX40108: AIN1_1V0_voltage + "WE", // MAX40108: AIN2_WE + "CE", // MAX40108: AIN3_CE + "*100/3.34=mA", // MAX40108: AIN4_*100/3.34=mA + "CELL_VOLTAGE", // MAX40108: AIN5_CELL_VOLTAGE +}; +#endif // HAS_Platform_AIN_customChannelHeader //-------------------------------------------------- // Option to log platform analog inputs as raw LSB code #ifndef LOG_PLATFORM_ANALOG_IN_LSB @@ -2891,18 +2921,39 @@ #endif // SPI_ADC_DeviceName == MAX11410 // SPI connected ADC if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_LSB) { // _LSB column header suffix - cmdLine.serial().printf("_LSB\""); + cmdLine.serial().printf("_LSB"); # if HAS_DAPLINK_SERIAL - cmdLine_DAPLINKserial.serial().printf("_LSB\""); + cmdLine_DAPLINKserial.serial().printf("_LSB"); # endif // HAS_DAPLINK_SERIAL } else if (SPI_AIN_Enable_ch[channel_index] == SPI_AIN_Enable_Volt) { // _V column header suffix - cmdLine.serial().printf("_V\""); + cmdLine.serial().printf("_V"); # if HAS_DAPLINK_SERIAL - cmdLine_DAPLINKserial.serial().printf("_V\""); + cmdLine_DAPLINKserial.serial().printf("_V"); # endif // HAS_DAPLINK_SERIAL } +#if HAS_SPI_AIN_customChannelHeader // Optional custom per-channel header suffix + // Optional custom per-channel header suffix + if (SPI_AIN_customChannelHeader_ch[channel_index] && SPI_AIN_customChannelHeader_ch[channel_index][0]) { + // not a null pointer, and not an empty string + cmdLine.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]); +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("_%s", SPI_AIN_customChannelHeader_ch[channel_index]); +# endif // HAS_DAPLINK_SERIAL + } else { + // no custom channel name for this channel + //~ cmdLine.serial().printf("~"); +# if HAS_DAPLINK_SERIAL + //~ cmdLine_DAPLINKserial.serial().printf("~"); +# endif // HAS_DAPLINK_SERIAL + } +#endif // HAS_SPI_AIN_customChannelHeader + // close quote + cmdLine.serial().printf("\""); +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("\""); +# endif // HAS_DAPLINK_SERIAL } #if VERIFY_PART_ID_IN_LOOP @@ -2927,12 +2978,33 @@ cmdLine.serial().printf("\"A%d", channel_index); if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_LSB) { // _LSB column header suffix - cmdLine.serial().printf("_LSB\""); + cmdLine.serial().printf("_LSB"); } if (Platform_Enable_ch[channel_index] == Platform_AIN_Enable_Volt) { // _V column header suffix - cmdLine.serial().printf("_V\""); + cmdLine.serial().printf("_V"); } +#if HAS_Platform_AIN_customChannelHeader // Optional custom per-channel header suffix + // Optional custom per-channel header suffix + if (Platform_AIN_customChannelHeader_ch[channel_index] && Platform_AIN_customChannelHeader_ch[channel_index][0]) { + // not a null pointer, and not an empty string + cmdLine.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]); +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("_%s", Platform_AIN_customChannelHeader_ch[channel_index]); +# endif // HAS_DAPLINK_SERIAL + } else { + // no custom channel name for this channel + //~ cmdLine.serial().printf("~"); +# if HAS_DAPLINK_SERIAL + //~ cmdLine_DAPLINKserial.serial().printf("~"); +# endif // HAS_DAPLINK_SERIAL + } +#endif // HAS_Platform_AIN_customChannelHeader + // close quote + cmdLine.serial().printf("\""); +# if HAS_DAPLINK_SERIAL + cmdLine_DAPLINKserial.serial().printf("\""); +# endif // HAS_DAPLINK_SERIAL } #endif // defined(LOG_PLATFORM_AIN) // end of column header line