Maxim Integrated MAX11131 SPI 12-bit 16-channel ADC with SampleSet

Dependents:   MAX11131BOB_Tester MAX11131BOB_12bit_16ch_SampleSet_SPI_ADC MAX11131BOB_Serial_Tester

Revision:
6:cb7bdeb185d0
Parent:
5:6ef046dbe77e
Child:
8:2171c1889a84
--- a/MAX11131.h	Sun Aug 04 01:16:46 2019 -0700
+++ b/MAX11131.h	Fri Sep 27 11:49:23 2019 +0000
@@ -40,6 +40,7 @@
 // System Description = Device driver example
 // Device Name = MAX11131
 // Device Description = 3Msps, Low-Power, Serial SPI 12-Bit, 16-Channel, Differential/Single-Ended Input, SAR ADC
+// Device DeviceBriefDescription = 12-bit 3Msps 16-ch ADC
 // Device Manufacturer = Maxim Integrated
 // Device PartNumber = MAX11131ATI+
 // Device RegValue_Width = DataWidth16bit_HL
@@ -63,10 +64,42 @@
 #ifndef __MAX11131_H__
 #define __MAX11131_H__
 
-// standard include for target platform
+// standard include for target platform -- Platform_Include_Boilerplate
 #include "mbed.h"
+// Platforms:
+//   - MAX32625MBED
+//      - supports mbed-os-5.11, requires USBDevice library
+//      - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/
+//      - remove max32630fthr library (if present)
+//      - remove MAX32620FTHR library (if present)
+//   - MAX32600MBED
+//      - remove max32630fthr library (if present)
+//      - remove MAX32620FTHR library (if present)
+//      - Windows 10 note:  Don't connect HDK until you are ready to load new firmware into the board.
+//   - NUCLEO_F446RE
+//      - remove USBDevice library
+//      - remove max32630fthr library (if present)
+//      - remove MAX32620FTHR library (if present)
+//   - NUCLEO_F401RE
+//      - remove USBDevice library
+//      - remove max32630fthr library (if present)
+//      - remove MAX32620FTHR library (if present)
+//   - MAX32630FTHR
+//      - #include "max32630fthr.h"
+//      - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/
+//      - remove MAX32620FTHR library (if present)
+//   - MAX32620FTHR
+//      - #include "MAX32620FTHR.h"
+//      - remove max32630fthr library (if present)
+//      - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
+//      - not tested yet
+//   - MAX32625PICO
+//      - remove max32630fthr library (if present)
+//      - remove MAX32620FTHR library (if present)
+//      - not tested yet
+//
+// end Platform_Include_Boilerplate
 
-// CODE GENERATOR: conditional defines
 //----------------------------------------
 // Global setting for all channels: ADC_CONFIGURATION.REFSEL
 //
@@ -193,18 +226,18 @@
 //--------------------
 //
 // Default settings if not defined at project level
-#ifndef AIN_0_1_DifferentialBipolarFS2Vref
+#ifndef AIN_0_1_DifferentialBipolarFS2Vref
 # ifndef AIN_0_1_DifferentialBipolarFSVref
-#  ifndef AIN_0_1_DifferentialUnipolar
+#  ifndef AIN_0_1_DifferentialUnipolar
 #   ifndef AIN_0_1_SingleEnded
-#    define AIN_0_1_DifferentialBipolarFS2Vref 	0
-#    define AIN_0_1_DifferentialBipolarFSVref 	0
+#    define AIN_0_1_DifferentialBipolarFS2Vref 	0
+#    define AIN_0_1_DifferentialBipolarFSVref 	0
 #    define AIN_0_1_DifferentialUnipolar 	0
 #    define AIN_0_1_SingleEnded 	1
 #   endif // AIN_0_1_SingleEnded
-#  endif // AIN_0_1_DifferentialUnipolar
+#  endif // AIN_0_1_DifferentialUnipolar
 # endif // AIN_0_1_DifferentialBipolarFSVref
-#endif // AIN_0_1_DifferentialBipolarFS2Vref
+#endif // AIN_0_1_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
 #if AIN_0_1_DifferentialBipolarFS2Vref
@@ -220,35 +253,35 @@
 //~ #  pragma message("AIN_0_1_SingleEnded: ADC Channels AIN0, AIN1 = Both Single-Ended, Unipolar")
 #endif // AIN_0_1_SingleEnded
 //
-// Validate the AIN_0_1_DifferentialBipolarFS2Vref setting
-#if AIN_0_1_DifferentialBipolarFS2Vref
+// Validate the AIN_0_1_DifferentialBipolarFS2Vref setting
+#if AIN_0_1_DifferentialBipolarFS2Vref
 # if AIN_0_1_DifferentialBipolarFSVref
-#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_DifferentialBipolarFSVref; choose one")
+#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_DifferentialBipolarFSVref; choose one")
 # endif // AIN_0_1_DifferentialBipolarFSVref
-# if AIN_0_1_DifferentialUnipolar
-#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_DifferentialUnipolar; choose one")
-# endif // AIN_0_1_DifferentialUnipolar
+# if AIN_0_1_DifferentialUnipolar
+#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_DifferentialUnipolar; choose one")
+# endif // AIN_0_1_DifferentialUnipolar
 # if AIN_0_1_SingleEnded
-#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_SingleEnded; choose one")
+#  error("cannot have both AIN_0_1_DifferentialBipolarFS2Vref and AIN_0_1_SingleEnded; choose one")
 # endif // AIN_0_1_SingleEnded
-#endif // AIN_0_1_DifferentialBipolarFS2Vref
+#endif // AIN_0_1_DifferentialBipolarFS2Vref
 //
 // Validate the AIN_0_1_DifferentialBipolarFSVref setting
 #if AIN_0_1_DifferentialBipolarFSVref
-# if AIN_0_1_DifferentialUnipolar
-#  error("cannot have both AIN_0_1_DifferentialBipolarFSVref and AIN_0_1_DifferentialUnipolar; choose one")
-# endif // AIN_0_1_DifferentialUnipolar
+# if AIN_0_1_DifferentialUnipolar
+#  error("cannot have both AIN_0_1_DifferentialBipolarFSVref and AIN_0_1_DifferentialUnipolar; choose one")
+# endif // AIN_0_1_DifferentialUnipolar
 # if AIN_0_1_SingleEnded
 #  error("cannot have both AIN_0_1_DifferentialBipolarFSVref and AIN_0_1_SingleEnded; choose one")
 # endif // AIN_0_1_SingleEnded
 #endif // AIN_0_1_DifferentialBipolarFSVref
 //
-// Validate the AIN_0_1_DifferentialUnipolar setting
-#if AIN_0_1_DifferentialUnipolar
+// Validate the AIN_0_1_DifferentialUnipolar setting
+#if AIN_0_1_DifferentialUnipolar
 # if AIN_0_1_SingleEnded
-#  error("cannot have both AIN_0_1_DifferentialUnipolar and AIN_0_1_SingleEnded; choose one")
+#  error("cannot have both AIN_0_1_DifferentialUnipolar and AIN_0_1_SingleEnded; choose one")
 # endif // AIN_0_1_SingleEnded
-#endif // AIN_0_1_DifferentialUnipolar
+#endif // AIN_0_1_DifferentialUnipolar
 
 //----------------------------------------
 // ADC Channels AIN2, AIN3
@@ -300,62 +333,62 @@
 //--------------------
 //
 // Default settings if not defined at project level
-#ifndef AIN_2_3_DifferentialBipolarFS2Vref
-# ifndef AIN_2_3_DifferentialBipolarFSVref
-#  ifndef AIN_2_3_DifferentialUnipolar
-#   ifndef AIN_2_3_SingleEnded
-#    define AIN_2_3_DifferentialBipolarFS2Vref 	0
+#ifndef AIN_2_3_DifferentialBipolarFS2Vref
+# ifndef AIN_2_3_DifferentialBipolarFSVref
+#  ifndef AIN_2_3_DifferentialUnipolar
+#   ifndef AIN_2_3_SingleEnded
+#    define AIN_2_3_DifferentialBipolarFS2Vref 	0
 #    define AIN_2_3_DifferentialBipolarFSVref 	0
-#    define AIN_2_3_DifferentialUnipolar 	0
+#    define AIN_2_3_DifferentialUnipolar 	0
 #    define AIN_2_3_SingleEnded 	1
-#   endif // AIN_2_3_SingleEnded
-#  endif // AIN_2_3_DifferentialUnipolar
-# endif // AIN_2_3_DifferentialBipolarFSVref
-#endif // AIN_2_3_DifferentialBipolarFS2Vref
+#   endif // AIN_2_3_SingleEnded
+#  endif // AIN_2_3_DifferentialUnipolar
+# endif // AIN_2_3_DifferentialBipolarFSVref
+#endif // AIN_2_3_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
-#if AIN_2_3_DifferentialBipolarFS2Vref
-//~ #  pragma message("AIN_2_3_DifferentialBipolarFS2Vref: ADC Channels AIN2, AIN3 = Differential Bipolar")
-#endif // AIN_2_3_DifferentialBipolarFS2Vref
+#if AIN_2_3_DifferentialBipolarFS2Vref
+//~ #  pragma message("AIN_2_3_DifferentialBipolarFS2Vref: ADC Channels AIN2, AIN3 = Differential Bipolar")
+#endif // AIN_2_3_DifferentialBipolarFS2Vref
 #if AIN_2_3_DifferentialBipolarFSVref
 //~ #  pragma message("AIN_2_3_DifferentialBipolarFSVref: ADC Channels AIN2, AIN3 = Differential Bipolar")
 #endif // AIN_2_3_DifferentialBipolarFSVref
-#if AIN_2_3_DifferentialUnipolar
-//~ #  pragma message("AIN_2_3_DifferentialUnipolar: ADC Channels AIN2, AIN3 = Differential Unipolar (AIN2 > AIN3)")
-#endif // AIN_2_3_DifferentialUnipolar
+#if AIN_2_3_DifferentialUnipolar
+//~ #  pragma message("AIN_2_3_DifferentialUnipolar: ADC Channels AIN2, AIN3 = Differential Unipolar (AIN2 > AIN3)")
+#endif // AIN_2_3_DifferentialUnipolar
 #if AIN_2_3_SingleEnded
 //~ #  pragma message("AIN_2_3_SingleEnded: ADC Channels AIN2, AIN3 = Both Single-Ended, Unipolar")
 #endif // AIN_2_3_SingleEnded
-//
-// Validate the AIN_2_3_DifferentialBipolarFS2Vref setting
-#if AIN_2_3_DifferentialBipolarFS2Vref
-# if AIN_2_3_DifferentialBipolarFSVref
-#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_DifferentialBipolarFSVref; choose one")
-# endif // AIN_2_3_DifferentialBipolarFSVref
-# if AIN_2_3_DifferentialUnipolar
-#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_DifferentialUnipolar; choose one")
-# endif // AIN_2_3_DifferentialUnipolar
-# if AIN_2_3_SingleEnded
-#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_SingleEnded; choose one")
-# endif // AIN_2_3_SingleEnded
-#endif // AIN_2_3_DifferentialBipolarFS2Vref
+//
+// Validate the AIN_2_3_DifferentialBipolarFS2Vref setting
+#if AIN_2_3_DifferentialBipolarFS2Vref
+# if AIN_2_3_DifferentialBipolarFSVref
+#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_DifferentialBipolarFSVref; choose one")
+# endif // AIN_2_3_DifferentialBipolarFSVref
+# if AIN_2_3_DifferentialUnipolar
+#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_DifferentialUnipolar; choose one")
+# endif // AIN_2_3_DifferentialUnipolar
+# if AIN_2_3_SingleEnded
+#  error("cannot have both AIN_2_3_DifferentialBipolarFS2Vref and AIN_2_3_SingleEnded; choose one")
+# endif // AIN_2_3_SingleEnded
+#endif // AIN_2_3_DifferentialBipolarFS2Vref
 //
 // Validate the AIN_2_3_DifferentialBipolarFSVref setting
 #if AIN_2_3_DifferentialBipolarFSVref
-# if AIN_2_3_DifferentialUnipolar
-#  error("cannot have both AIN_2_3_DifferentialBipolarFSVref and AIN_2_3_DifferentialUnipolar; choose one")
-# endif // AIN_2_3_DifferentialUnipolar
+# if AIN_2_3_DifferentialUnipolar
+#  error("cannot have both AIN_2_3_DifferentialBipolarFSVref and AIN_2_3_DifferentialUnipolar; choose one")
+# endif // AIN_2_3_DifferentialUnipolar
 # if AIN_2_3_SingleEnded
 #  error("cannot have both AIN_2_3_DifferentialBipolarFSVref and AIN_2_3_SingleEnded; choose one")
 # endif // AIN_2_3_SingleEnded
 #endif // AIN_2_3_DifferentialBipolarFSVref
 //
-// Validate the AIN_2_3_DifferentialUnipolar setting
-#if AIN_2_3_DifferentialUnipolar
+// Validate the AIN_2_3_DifferentialUnipolar setting
+#if AIN_2_3_DifferentialUnipolar
 # if AIN_2_3_SingleEnded
-#  error("cannot have both AIN_2_3_DifferentialUnipolar and AIN_2_3_SingleEnded; choose one")
+#  error("cannot have both AIN_2_3_DifferentialUnipolar and AIN_2_3_SingleEnded; choose one")
 # endif // AIN_2_3_SingleEnded
-#endif // AIN_2_3_DifferentialUnipolar
+#endif // AIN_2_3_DifferentialUnipolar
 
 //----------------------------------------
 // ADC Channels AIN4, AIN5
@@ -407,26 +440,26 @@
 //--------------------
 //
 // Default settings if not defined at project level
-#ifndef AIN_4_5_DifferentialBipolarFS2Vref
+#ifndef AIN_4_5_DifferentialBipolarFS2Vref
 # ifndef AIN_4_5_DifferentialBipolarFSVref
-#  ifndef AIN_4_5_DifferentialUnipolar
+#  ifndef AIN_4_5_DifferentialUnipolar
 #   ifndef AIN_4_5_SingleEnded
-#    define AIN_4_5_DifferentialBipolarFS2Vref 	0
-#    define AIN_4_5_DifferentialBipolarFSVref 	0
+#    define AIN_4_5_DifferentialBipolarFS2Vref 	0
+#    define AIN_4_5_DifferentialBipolarFSVref 	0
 #    define AIN_4_5_DifferentialUnipolar 	0
 #    define AIN_4_5_SingleEnded 	1
 #   endif // AIN_4_5_SingleEnded
-#  endif // AIN_4_5_DifferentialUnipolar
+#  endif // AIN_4_5_DifferentialUnipolar
 # endif // AIN_4_5_DifferentialBipolarFSVref
-#endif // AIN_4_5_DifferentialBipolarFS2Vref
+#endif // AIN_4_5_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
-#if AIN_4_5_DifferentialBipolarFS2Vref
-//~ #  pragma message("AIN_4_5_DifferentialBipolarFS2Vref: ADC Channels AIN4, AIN5 = Differential Bipolar")
-#endif // AIN_4_5_DifferentialBipolarFS2Vref
-#if AIN_4_5_DifferentialBipolarFSVref
-//~ #  pragma message("AIN_4_5_DifferentialBipolarFSVref: ADC Channels AIN4, AIN5 = Differential Bipolar")
-#endif // AIN_4_5_DifferentialBipolarFSVref
+#if AIN_4_5_DifferentialBipolarFS2Vref
+//~ #  pragma message("AIN_4_5_DifferentialBipolarFS2Vref: ADC Channels AIN4, AIN5 = Differential Bipolar")
+#endif // AIN_4_5_DifferentialBipolarFS2Vref
+#if AIN_4_5_DifferentialBipolarFSVref
+//~ #  pragma message("AIN_4_5_DifferentialBipolarFSVref: ADC Channels AIN4, AIN5 = Differential Bipolar")
+#endif // AIN_4_5_DifferentialBipolarFSVref
 #if AIN_4_5_DifferentialUnipolar
 //~ #  pragma message("AIN_4_5_DifferentialUnipolar: ADC Channels AIN4, AIN5 = Differential Unipolar (AIN4 > AIN5)")
 #endif // AIN_4_5_DifferentialUnipolar
@@ -434,35 +467,35 @@
 //~ #  pragma message("AIN_4_5_SingleEnded: ADC Channels AIN4, AIN5 = Both Single-Ended, Unipolar")
 #endif // AIN_4_5_SingleEnded
 //
-// Validate the AIN_4_5_DifferentialBipolarFS2Vref setting
-#if AIN_4_5_DifferentialBipolarFS2Vref
+// Validate the AIN_4_5_DifferentialBipolarFS2Vref setting
+#if AIN_4_5_DifferentialBipolarFS2Vref
 # if AIN_4_5_DifferentialBipolarFSVref
-#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_DifferentialBipolarFSVref; choose one")
+#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_DifferentialBipolarFSVref; choose one")
 # endif // AIN_4_5_DifferentialBipolarFSVref
-# if AIN_4_5_DifferentialUnipolar
-#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_DifferentialUnipolar; choose one")
-# endif // AIN_4_5_DifferentialUnipolar
+# if AIN_4_5_DifferentialUnipolar
+#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_DifferentialUnipolar; choose one")
+# endif // AIN_4_5_DifferentialUnipolar
 # if AIN_4_5_SingleEnded
-#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_SingleEnded; choose one")
+#  error("cannot have both AIN_4_5_DifferentialBipolarFS2Vref and AIN_4_5_SingleEnded; choose one")
 # endif // AIN_4_5_SingleEnded
-#endif // AIN_4_5_DifferentialBipolarFS2Vref
+#endif // AIN_4_5_DifferentialBipolarFS2Vref
 //
 // Validate the AIN_4_5_DifferentialBipolarFSVref setting
 #if AIN_4_5_DifferentialBipolarFSVref
-# if AIN_4_5_DifferentialUnipolar
-#  error("cannot have both AIN_4_5_DifferentialBipolarFSVref and AIN_4_5_DifferentialUnipolar; choose one")
-# endif // AIN_4_5_DifferentialUnipolar
+# if AIN_4_5_DifferentialUnipolar
+#  error("cannot have both AIN_4_5_DifferentialBipolarFSVref and AIN_4_5_DifferentialUnipolar; choose one")
+# endif // AIN_4_5_DifferentialUnipolar
 # if AIN_4_5_SingleEnded
 #  error("cannot have both AIN_4_5_DifferentialBipolarFSVref and AIN_4_5_SingleEnded; choose one")
 # endif // AIN_4_5_SingleEnded
 #endif // AIN_4_5_DifferentialBipolarFSVref
 //
-// Validate the AIN_4_5_DifferentialUnipolar setting
-#if AIN_4_5_DifferentialUnipolar
+// Validate the AIN_4_5_DifferentialUnipolar setting
+#if AIN_4_5_DifferentialUnipolar
 # if AIN_4_5_SingleEnded
-#  error("cannot have both AIN_4_5_DifferentialUnipolar and AIN_4_5_SingleEnded; choose one")
+#  error("cannot have both AIN_4_5_DifferentialUnipolar and AIN_4_5_SingleEnded; choose one")
 # endif // AIN_4_5_SingleEnded
-#endif // AIN_4_5_DifferentialUnipolar
+#endif // AIN_4_5_DifferentialUnipolar
 
 //----------------------------------------
 // ADC Channels AIN6, AIN7
@@ -471,16 +504,16 @@
 // either by uncommenting in this file or define at the project level
 //--------------------
 // ADC Channels AIN6, AIN7 = Differential Bipolar
-// Full Scale = 2 * VREF
-// Voltage per LSB count = VREF/2048
-// AIN6, AIN7 are a Differential pair using Bipolar transfer function with range (+/-)Vref
-// AIN6 voltage must always be between 0 and VREF.
-// AIN7 voltage must always be between 0 and VREF.
-//
-//~ #define AIN_6_7_DifferentialBipolarFS2Vref 	1
-//
-//--------------------
-// ADC Channels AIN6, AIN7 = Differential Bipolar
+// Full Scale = 2 * VREF
+// Voltage per LSB count = VREF/2048
+// AIN6, AIN7 are a Differential pair using Bipolar transfer function with range (+/-)Vref
+// AIN6 voltage must always be between 0 and VREF.
+// AIN7 voltage must always be between 0 and VREF.
+//
+//~ #define AIN_6_7_DifferentialBipolarFS2Vref 	1
+//
+//--------------------
+// ADC Channels AIN6, AIN7 = Differential Bipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
 // AIN6, AIN7 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
@@ -490,14 +523,14 @@
 //~ #define AIN_6_7_DifferentialBipolarFSVref 	1
 //
 //--------------------
-// ADC Channels AIN6, AIN7 = Differential Unipolar (AIN6 > AIN7)
-// Full Scale = VREF
+// ADC Channels AIN6, AIN7 = Differential Unipolar (AIN6 > AIN7)
+// Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN6, AIN7 are a Differential pair using Unipolar transfer function.
+// AIN6, AIN7 are a Differential pair using Unipolar transfer function.
 // AIN6 voltage must always be between 0 and VREF.
 // AIN7 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_6_7_DifferentialUnipolar 	1
+//~ #define AIN_6_7_DifferentialUnipolar 	1
 //
 //--------------------
 // ADC Channels AIN6, AIN7 = Both Single-Ended, Unipolar
@@ -514,62 +547,62 @@
 //--------------------
 //
 // Default settings if not defined at project level
-#ifndef AIN_6_7_DifferentialBipolarFS2Vref
-# ifndef AIN_6_7_DifferentialBipolarFSVref
-#  ifndef AIN_6_7_DifferentialUnipolar
-#   ifndef AIN_6_7_SingleEnded
-#    define AIN_6_7_DifferentialBipolarFS2Vref 	0
+#ifndef AIN_6_7_DifferentialBipolarFS2Vref
+# ifndef AIN_6_7_DifferentialBipolarFSVref
+#  ifndef AIN_6_7_DifferentialUnipolar
+#   ifndef AIN_6_7_SingleEnded
+#    define AIN_6_7_DifferentialBipolarFS2Vref 	0
 #    define AIN_6_7_DifferentialBipolarFSVref 	0
-#    define AIN_6_7_DifferentialUnipolar 	0
+#    define AIN_6_7_DifferentialUnipolar 	0
 #    define AIN_6_7_SingleEnded 	1
-#   endif // AIN_6_7_SingleEnded
-#  endif // AIN_6_7_DifferentialUnipolar
-# endif // AIN_6_7_DifferentialBipolarFSVref
-#endif // AIN_6_7_DifferentialBipolarFS2Vref
+#   endif // AIN_6_7_SingleEnded
+#  endif // AIN_6_7_DifferentialUnipolar
+# endif // AIN_6_7_DifferentialBipolarFSVref
+#endif // AIN_6_7_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
-#if AIN_6_7_DifferentialBipolarFS2Vref
-//~ #  pragma message("AIN_6_7_DifferentialBipolarFS2Vref: ADC Channels AIN6, AIN7 = Differential Bipolar")
-#endif // AIN_6_7_DifferentialBipolarFS2Vref
+#if AIN_6_7_DifferentialBipolarFS2Vref
+//~ #  pragma message("AIN_6_7_DifferentialBipolarFS2Vref: ADC Channels AIN6, AIN7 = Differential Bipolar")
+#endif // AIN_6_7_DifferentialBipolarFS2Vref
 #if AIN_6_7_DifferentialBipolarFSVref
 //~ #  pragma message("AIN_6_7_DifferentialBipolarFSVref: ADC Channels AIN6, AIN7 = Differential Bipolar")
 #endif // AIN_6_7_DifferentialBipolarFSVref
-#if AIN_6_7_DifferentialUnipolar
-//~ #  pragma message("AIN_6_7_DifferentialUnipolar: ADC Channels AIN6, AIN7 = Differential Unipolar (AIN6 > AIN7)")
-#endif // AIN_6_7_DifferentialUnipolar
+#if AIN_6_7_DifferentialUnipolar
+//~ #  pragma message("AIN_6_7_DifferentialUnipolar: ADC Channels AIN6, AIN7 = Differential Unipolar (AIN6 > AIN7)")
+#endif // AIN_6_7_DifferentialUnipolar
 #if AIN_6_7_SingleEnded
 //~ #  pragma message("AIN_6_7_SingleEnded: ADC Channels AIN6, AIN7 = Both Single-Ended, Unipolar")
 #endif // AIN_6_7_SingleEnded
-//
-// Validate the AIN_6_7_DifferentialBipolarFS2Vref setting
-#if AIN_6_7_DifferentialBipolarFS2Vref
-# if AIN_6_7_DifferentialBipolarFSVref
-#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_DifferentialBipolarFSVref; choose one")
-# endif // AIN_6_7_DifferentialBipolarFSVref
-# if AIN_6_7_DifferentialUnipolar
-#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_DifferentialUnipolar; choose one")
-# endif // AIN_6_7_DifferentialUnipolar
-# if AIN_6_7_SingleEnded
-#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_SingleEnded; choose one")
-# endif // AIN_6_7_SingleEnded
-#endif // AIN_6_7_DifferentialBipolarFS2Vref
+//
+// Validate the AIN_6_7_DifferentialBipolarFS2Vref setting
+#if AIN_6_7_DifferentialBipolarFS2Vref
+# if AIN_6_7_DifferentialBipolarFSVref
+#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_DifferentialBipolarFSVref; choose one")
+# endif // AIN_6_7_DifferentialBipolarFSVref
+# if AIN_6_7_DifferentialUnipolar
+#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_DifferentialUnipolar; choose one")
+# endif // AIN_6_7_DifferentialUnipolar
+# if AIN_6_7_SingleEnded
+#  error("cannot have both AIN_6_7_DifferentialBipolarFS2Vref and AIN_6_7_SingleEnded; choose one")
+# endif // AIN_6_7_SingleEnded
+#endif // AIN_6_7_DifferentialBipolarFS2Vref
 //
 // Validate the AIN_6_7_DifferentialBipolarFSVref setting
 #if AIN_6_7_DifferentialBipolarFSVref
-# if AIN_6_7_DifferentialUnipolar
-#  error("cannot have both AIN_6_7_DifferentialBipolarFSVref and AIN_6_7_DifferentialUnipolar; choose one")
-# endif // AIN_6_7_DifferentialUnipolar
+# if AIN_6_7_DifferentialUnipolar
+#  error("cannot have both AIN_6_7_DifferentialBipolarFSVref and AIN_6_7_DifferentialUnipolar; choose one")
+# endif // AIN_6_7_DifferentialUnipolar
 # if AIN_6_7_SingleEnded
 #  error("cannot have both AIN_6_7_DifferentialBipolarFSVref and AIN_6_7_SingleEnded; choose one")
 # endif // AIN_6_7_SingleEnded
 #endif // AIN_6_7_DifferentialBipolarFSVref
 //
-// Validate the AIN_6_7_DifferentialUnipolar setting
-#if AIN_6_7_DifferentialUnipolar
+// Validate the AIN_6_7_DifferentialUnipolar setting
+#if AIN_6_7_DifferentialUnipolar
 # if AIN_6_7_SingleEnded
-#  error("cannot have both AIN_6_7_DifferentialUnipolar and AIN_6_7_SingleEnded; choose one")
+#  error("cannot have both AIN_6_7_DifferentialUnipolar and AIN_6_7_SingleEnded; choose one")
 # endif // AIN_6_7_SingleEnded
-#endif // AIN_6_7_DifferentialUnipolar
+#endif // AIN_6_7_DifferentialUnipolar
 
 //----------------------------------------
 // ADC Channels AIN8, AIN9
@@ -577,14 +610,14 @@
 // CUSTOMIZE: select one of the following options
 // either by uncommenting in this file or define at the project level
 //--------------------
-// ADC Channels AIN8, AIN9 = Differential Bipolar
-// Full Scale = 2 * VREF
+// ADC Channels AIN8, AIN9 = Differential Bipolar
+// Full Scale = 2 * VREF
 // Voltage per LSB count = VREF/2048
-// AIN8, AIN9 are a Differential pair using Bipolar transfer function with range (+/-)Vref
+// AIN8, AIN9 are a Differential pair using Bipolar transfer function with range (+/-)Vref
 // AIN8 voltage must always be between 0 and VREF.
 // AIN9 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_8_9_DifferentialBipolarFS2Vref 	1
+//~ #define AIN_8_9_DifferentialBipolarFS2Vref 	1
 //
 //--------------------
 // ADC Channels AIN8, AIN9 = Differential Bipolar
@@ -597,14 +630,14 @@
 //~ #define AIN_8_9_DifferentialBipolarFSVref 	1
 //
 //--------------------
-// ADC Channels AIN8, AIN9 = Differential Unipolar (AIN8 > AIN9)
-// Full Scale = VREF
+// ADC Channels AIN8, AIN9 = Differential Unipolar (AIN8 > AIN9)
+// Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN8, AIN9 are a Differential pair using Unipolar transfer function.
+// AIN8, AIN9 are a Differential pair using Unipolar transfer function.
 // AIN8 voltage must always be between 0 and VREF.
 // AIN9 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_8_9_DifferentialUnipolar 	1
+//~ #define AIN_8_9_DifferentialUnipolar 	1
 //
 //--------------------
 // ADC Channels AIN8, AIN9 = Both Single-Ended, Unipolar
@@ -621,26 +654,26 @@
 //--------------------
 //
 // Default settings if not defined at project level
-#ifndef AIN_8_9_DifferentialBipolarFS2Vref
+#ifndef AIN_8_9_DifferentialBipolarFS2Vref
 # ifndef AIN_8_9_DifferentialBipolarFSVref
-#  ifndef AIN_8_9_DifferentialUnipolar
+#  ifndef AIN_8_9_DifferentialUnipolar
 #   ifndef AIN_8_9_SingleEnded
-#    define AIN_8_9_DifferentialBipolarFS2Vref 	0
-#    define AIN_8_9_DifferentialBipolarFSVref 	0
+#    define AIN_8_9_DifferentialBipolarFS2Vref 	0
+#    define AIN_8_9_DifferentialBipolarFSVref 	0
 #    define AIN_8_9_DifferentialUnipolar 	0
 #    define AIN_8_9_SingleEnded 	1
 #   endif // AIN_8_9_SingleEnded
-#  endif // AIN_8_9_DifferentialUnipolar
+#  endif // AIN_8_9_DifferentialUnipolar
 # endif // AIN_8_9_DifferentialBipolarFSVref
-#endif // AIN_8_9_DifferentialBipolarFS2Vref
+#endif // AIN_8_9_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
-#if AIN_8_9_DifferentialBipolarFS2Vref
-//~ #  pragma message("AIN_8_9_DifferentialBipolarFS2Vref: ADC Channels AIN8, AIN9 = Differential Bipolar")
-#endif // AIN_8_9_DifferentialBipolarFS2Vref
-#if AIN_8_9_DifferentialBipolarFSVref
-//~ #  pragma message("AIN_8_9_DifferentialBipolarFSVref: ADC Channels AIN8, AIN9 = Differential Bipolar")
-#endif // AIN_8_9_DifferentialBipolarFSVref
+#if AIN_8_9_DifferentialBipolarFS2Vref
+//~ #  pragma message("AIN_8_9_DifferentialBipolarFS2Vref: ADC Channels AIN8, AIN9 = Differential Bipolar")
+#endif // AIN_8_9_DifferentialBipolarFS2Vref
+#if AIN_8_9_DifferentialBipolarFSVref
+//~ #  pragma message("AIN_8_9_DifferentialBipolarFSVref: ADC Channels AIN8, AIN9 = Differential Bipolar")
+#endif // AIN_8_9_DifferentialBipolarFSVref
 #if AIN_8_9_DifferentialUnipolar
 //~ #  pragma message("AIN_8_9_DifferentialUnipolar: ADC Channels AIN8, AIN9 = Differential Unipolar (AIN8 > AIN9)")
 #endif // AIN_8_9_DifferentialUnipolar
@@ -648,35 +681,35 @@
 //~ #  pragma message("AIN_8_9_SingleEnded: ADC Channels AIN8, AIN9 = Both Single-Ended, Unipolar")
 #endif // AIN_8_9_SingleEnded
 //
-// Validate the AIN_8_9_DifferentialBipolarFS2Vref setting
-#if AIN_8_9_DifferentialBipolarFS2Vref
+// Validate the AIN_8_9_DifferentialBipolarFS2Vref setting
+#if AIN_8_9_DifferentialBipolarFS2Vref
 # if AIN_8_9_DifferentialBipolarFSVref
-#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_DifferentialBipolarFSVref; choose one")
+#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_DifferentialBipolarFSVref; choose one")
 # endif // AIN_8_9_DifferentialBipolarFSVref
-# if AIN_8_9_DifferentialUnipolar
-#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_DifferentialUnipolar; choose one")
-# endif // AIN_8_9_DifferentialUnipolar
+# if AIN_8_9_DifferentialUnipolar
+#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_DifferentialUnipolar; choose one")
+# endif // AIN_8_9_DifferentialUnipolar
 # if AIN_8_9_SingleEnded
-#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_SingleEnded; choose one")
+#  error("cannot have both AIN_8_9_DifferentialBipolarFS2Vref and AIN_8_9_SingleEnded; choose one")
 # endif // AIN_8_9_SingleEnded
-#endif // AIN_8_9_DifferentialBipolarFS2Vref
+#endif // AIN_8_9_DifferentialBipolarFS2Vref
 //
 // Validate the AIN_8_9_DifferentialBipolarFSVref setting
 #if AIN_8_9_DifferentialBipolarFSVref
-# if AIN_8_9_DifferentialUnipolar
-#  error("cannot have both AIN_8_9_DifferentialBipolarFSVref and AIN_8_9_DifferentialUnipolar; choose one")
-# endif // AIN_8_9_DifferentialUnipolar
+# if AIN_8_9_DifferentialUnipolar
+#  error("cannot have both AIN_8_9_DifferentialBipolarFSVref and AIN_8_9_DifferentialUnipolar; choose one")
+# endif // AIN_8_9_DifferentialUnipolar
 # if AIN_8_9_SingleEnded
 #  error("cannot have both AIN_8_9_DifferentialBipolarFSVref and AIN_8_9_SingleEnded; choose one")
 # endif // AIN_8_9_SingleEnded
 #endif // AIN_8_9_DifferentialBipolarFSVref
 //
-// Validate the AIN_8_9_DifferentialUnipolar setting
-#if AIN_8_9_DifferentialUnipolar
+// Validate the AIN_8_9_DifferentialUnipolar setting
+#if AIN_8_9_DifferentialUnipolar
 # if AIN_8_9_SingleEnded
-#  error("cannot have both AIN_8_9_DifferentialUnipolar and AIN_8_9_SingleEnded; choose one")
+#  error("cannot have both AIN_8_9_DifferentialUnipolar and AIN_8_9_SingleEnded; choose one")
 # endif // AIN_8_9_SingleEnded
-#endif // AIN_8_9_DifferentialUnipolar
+#endif // AIN_8_9_DifferentialUnipolar
 
 //----------------------------------------
 // ADC Channels AIN10, AIN11
@@ -694,14 +727,14 @@
 //~ #define AIN_10_11_DifferentialBipolarFS2Vref 	1
 //
 //--------------------
-// ADC Channels AIN10, AIN11 = Differential Bipolar
+// ADC Channels AIN10, AIN11 = Differential Bipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN10, AIN11 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
+// AIN10, AIN11 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
 // AIN10 voltage must always be between 0 and VREF.
 // AIN11 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_10_11_DifferentialBipolarFSVref 	1
+//~ #define AIN_10_11_DifferentialBipolarFSVref 	1
 //
 //--------------------
 // ADC Channels AIN10, AIN11 = Differential Unipolar (AIN10 > AIN11)
@@ -714,75 +747,75 @@
 //~ #define AIN_10_11_DifferentialUnipolar 	1
 //
 //--------------------
-// ADC Channels AIN10, AIN11 = Both Single-Ended, Unipolar
+// ADC Channels AIN10, AIN11 = Both Single-Ended, Unipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN10 is a Single-Ended input using Unipolar transfer function.
-// AIN11 is a Single-Ended input using Unipolar transfer function.
-// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
+// AIN10 is a Single-Ended input using Unipolar transfer function.
+// AIN11 is a Single-Ended input using Unipolar transfer function.
+// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
 // AIN10 voltage must always be between 0 and VREF.
 // AIN11 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_10_11_SingleEnded 	1
+//~ #define AIN_10_11_SingleEnded 	1
 //
 //--------------------
 //
 // Default settings if not defined at project level
 #ifndef AIN_10_11_DifferentialBipolarFS2Vref
-# ifndef AIN_10_11_DifferentialBipolarFSVref
+# ifndef AIN_10_11_DifferentialBipolarFSVref
 #  ifndef AIN_10_11_DifferentialUnipolar
-#   ifndef AIN_10_11_SingleEnded
+#   ifndef AIN_10_11_SingleEnded
 #    define AIN_10_11_DifferentialBipolarFS2Vref 	0
-#    define AIN_10_11_DifferentialBipolarFSVref 	0
-#    define AIN_10_11_DifferentialUnipolar 	0
+#    define AIN_10_11_DifferentialBipolarFSVref 	0
+#    define AIN_10_11_DifferentialUnipolar 	0
 #    define AIN_10_11_SingleEnded 	1
-#   endif // AIN_10_11_SingleEnded
+#   endif // AIN_10_11_SingleEnded
 #  endif // AIN_10_11_DifferentialUnipolar
-# endif // AIN_10_11_DifferentialBipolarFSVref
+# endif // AIN_10_11_DifferentialBipolarFSVref
 #endif // AIN_10_11_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
 #if AIN_10_11_DifferentialBipolarFS2Vref
 //~ #  pragma message("AIN_10_11_DifferentialBipolarFS2Vref: ADC Channels AIN10, AIN11 = Differential Bipolar")
 #endif // AIN_10_11_DifferentialBipolarFS2Vref
-#if AIN_10_11_DifferentialBipolarFSVref
-//~ #  pragma message("AIN_10_11_DifferentialBipolarFSVref: ADC Channels AIN10, AIN11 = Differential Bipolar")
-#endif // AIN_10_11_DifferentialBipolarFSVref
-#if AIN_10_11_DifferentialUnipolar
-//~ #  pragma message("AIN_10_11_DifferentialUnipolar: ADC Channels AIN10, AIN11 = Differential Unipolar (AIN10 > AIN11)")
-#endif // AIN_10_11_DifferentialUnipolar
+#if AIN_10_11_DifferentialBipolarFSVref
+//~ #  pragma message("AIN_10_11_DifferentialBipolarFSVref: ADC Channels AIN10, AIN11 = Differential Bipolar")
+#endif // AIN_10_11_DifferentialBipolarFSVref
+#if AIN_10_11_DifferentialUnipolar
+//~ #  pragma message("AIN_10_11_DifferentialUnipolar: ADC Channels AIN10, AIN11 = Differential Unipolar (AIN10 > AIN11)")
+#endif // AIN_10_11_DifferentialUnipolar
 #if AIN_10_11_SingleEnded
 //~ #  pragma message("AIN_10_11_SingleEnded: ADC Channels AIN10, AIN11 = Both Single-Ended, Unipolar")
 #endif // AIN_10_11_SingleEnded
 //
 // Validate the AIN_10_11_DifferentialBipolarFS2Vref setting
 #if AIN_10_11_DifferentialBipolarFS2Vref
-# if AIN_10_11_DifferentialBipolarFSVref
-#  error("cannot have both AIN_10_11_DifferentialBipolarFS2Vref and AIN_10_11_DifferentialBipolarFSVref; choose one")
-# endif // AIN_10_11_DifferentialBipolarFSVref
-# if AIN_10_11_DifferentialUnipolar
-#  error("cannot have both AIN_10_11_DifferentialBipolarFS2Vref and AIN_10_11_DifferentialUnipolar; choose one")
-# endif // AIN_10_11_DifferentialUnipolar
+# if AIN_10_11_DifferentialBipolarFSVref
+#  error("cannot have both AIN_10_11_DifferentialBipolarFS2Vref and AIN_10_11_DifferentialBipolarFSVref; choose one")
+# endif // AIN_10_11_DifferentialBipolarFSVref
+# if AIN_10_11_DifferentialUnipolar
+#  error("cannot have both AIN_10_11_DifferentialBipolarFS2Vref and AIN_10_11_DifferentialUnipolar; choose one")
+# endif // AIN_10_11_DifferentialUnipolar
 # if AIN_10_11_SingleEnded
 #  error("cannot have both AIN_10_11_DifferentialBipolarFS2Vref and AIN_10_11_SingleEnded; choose one")
 # endif // AIN_10_11_SingleEnded
 #endif // AIN_10_11_DifferentialBipolarFS2Vref
 //
-// Validate the AIN_10_11_DifferentialBipolarFSVref setting
-#if AIN_10_11_DifferentialBipolarFSVref
+// Validate the AIN_10_11_DifferentialBipolarFSVref setting
+#if AIN_10_11_DifferentialBipolarFSVref
 # if AIN_10_11_DifferentialUnipolar
-#  error("cannot have both AIN_10_11_DifferentialBipolarFSVref and AIN_10_11_DifferentialUnipolar; choose one")
+#  error("cannot have both AIN_10_11_DifferentialBipolarFSVref and AIN_10_11_DifferentialUnipolar; choose one")
 # endif // AIN_10_11_DifferentialUnipolar
-# if AIN_10_11_SingleEnded
-#  error("cannot have both AIN_10_11_DifferentialBipolarFSVref and AIN_10_11_SingleEnded; choose one")
-# endif // AIN_10_11_SingleEnded
-#endif // AIN_10_11_DifferentialBipolarFSVref
+# if AIN_10_11_SingleEnded
+#  error("cannot have both AIN_10_11_DifferentialBipolarFSVref and AIN_10_11_SingleEnded; choose one")
+# endif // AIN_10_11_SingleEnded
+#endif // AIN_10_11_DifferentialBipolarFSVref
 //
 // Validate the AIN_10_11_DifferentialUnipolar setting
 #if AIN_10_11_DifferentialUnipolar
-# if AIN_10_11_SingleEnded
-#  error("cannot have both AIN_10_11_DifferentialUnipolar and AIN_10_11_SingleEnded; choose one")
-# endif // AIN_10_11_SingleEnded
+# if AIN_10_11_SingleEnded
+#  error("cannot have both AIN_10_11_DifferentialUnipolar and AIN_10_11_SingleEnded; choose one")
+# endif // AIN_10_11_SingleEnded
 #endif // AIN_10_11_DifferentialUnipolar
 
 //----------------------------------------
@@ -801,14 +834,14 @@
 //~ #define AIN_12_13_DifferentialBipolarFS2Vref 	1
 //
 //--------------------
-// ADC Channels AIN12, AIN13 = Differential Bipolar
+// ADC Channels AIN12, AIN13 = Differential Bipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN12, AIN13 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
+// AIN12, AIN13 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
 // AIN12 voltage must always be between 0 and VREF.
 // AIN13 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_12_13_DifferentialBipolarFSVref 	1
+//~ #define AIN_12_13_DifferentialBipolarFSVref 	1
 //
 //--------------------
 // ADC Channels AIN12, AIN13 = Differential Unipolar (AIN12 > AIN13)
@@ -821,75 +854,75 @@
 //~ #define AIN_12_13_DifferentialUnipolar 	1
 //
 //--------------------
-// ADC Channels AIN12, AIN13 = Both Single-Ended, Unipolar
+// ADC Channels AIN12, AIN13 = Both Single-Ended, Unipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN12 is a Single-Ended input using Unipolar transfer function.
-// AIN13 is a Single-Ended input using Unipolar transfer function.
-// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
+// AIN12 is a Single-Ended input using Unipolar transfer function.
+// AIN13 is a Single-Ended input using Unipolar transfer function.
+// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
 // AIN12 voltage must always be between 0 and VREF.
 // AIN13 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_12_13_SingleEnded 	1
+//~ #define AIN_12_13_SingleEnded 	1
 //
 //--------------------
 //
 // Default settings if not defined at project level
 #ifndef AIN_12_13_DifferentialBipolarFS2Vref
-# ifndef AIN_12_13_DifferentialBipolarFSVref
+# ifndef AIN_12_13_DifferentialBipolarFSVref
 #  ifndef AIN_12_13_DifferentialUnipolar
-#   ifndef AIN_12_13_SingleEnded
+#   ifndef AIN_12_13_SingleEnded
 #    define AIN_12_13_DifferentialBipolarFS2Vref 	0
-#    define AIN_12_13_DifferentialBipolarFSVref 	0
-#    define AIN_12_13_DifferentialUnipolar 	0
+#    define AIN_12_13_DifferentialBipolarFSVref 	0
+#    define AIN_12_13_DifferentialUnipolar 	0
 #    define AIN_12_13_SingleEnded 	1
-#   endif // AIN_12_13_SingleEnded
+#   endif // AIN_12_13_SingleEnded
 #  endif // AIN_12_13_DifferentialUnipolar
-# endif // AIN_12_13_DifferentialBipolarFSVref
+# endif // AIN_12_13_DifferentialBipolarFSVref
 #endif // AIN_12_13_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
 #if AIN_12_13_DifferentialBipolarFS2Vref
 //~ #  pragma message("AIN_12_13_DifferentialBipolarFS2Vref: ADC Channels AIN12, AIN13 = Differential Bipolar")
 #endif // AIN_12_13_DifferentialBipolarFS2Vref
-#if AIN_12_13_DifferentialBipolarFSVref
-//~ #  pragma message("AIN_12_13_DifferentialBipolarFSVref: ADC Channels AIN12, AIN13 = Differential Bipolar")
-#endif // AIN_12_13_DifferentialBipolarFSVref
-#if AIN_12_13_DifferentialUnipolar
-//~ #  pragma message("AIN_12_13_DifferentialUnipolar: ADC Channels AIN12, AIN13 = Differential Unipolar (AIN12 > AIN13)")
-#endif // AIN_12_13_DifferentialUnipolar
+#if AIN_12_13_DifferentialBipolarFSVref
+//~ #  pragma message("AIN_12_13_DifferentialBipolarFSVref: ADC Channels AIN12, AIN13 = Differential Bipolar")
+#endif // AIN_12_13_DifferentialBipolarFSVref
+#if AIN_12_13_DifferentialUnipolar
+//~ #  pragma message("AIN_12_13_DifferentialUnipolar: ADC Channels AIN12, AIN13 = Differential Unipolar (AIN12 > AIN13)")
+#endif // AIN_12_13_DifferentialUnipolar
 #if AIN_12_13_SingleEnded
 //~ #  pragma message("AIN_12_13_SingleEnded: ADC Channels AIN12, AIN13 = Both Single-Ended, Unipolar")
 #endif // AIN_12_13_SingleEnded
 //
 // Validate the AIN_12_13_DifferentialBipolarFS2Vref setting
 #if AIN_12_13_DifferentialBipolarFS2Vref
-# if AIN_12_13_DifferentialBipolarFSVref
-#  error("cannot have both AIN_12_13_DifferentialBipolarFS2Vref and AIN_12_13_DifferentialBipolarFSVref; choose one")
-# endif // AIN_12_13_DifferentialBipolarFSVref
-# if AIN_12_13_DifferentialUnipolar
-#  error("cannot have both AIN_12_13_DifferentialBipolarFS2Vref and AIN_12_13_DifferentialUnipolar; choose one")
-# endif // AIN_12_13_DifferentialUnipolar
+# if AIN_12_13_DifferentialBipolarFSVref
+#  error("cannot have both AIN_12_13_DifferentialBipolarFS2Vref and AIN_12_13_DifferentialBipolarFSVref; choose one")
+# endif // AIN_12_13_DifferentialBipolarFSVref
+# if AIN_12_13_DifferentialUnipolar
+#  error("cannot have both AIN_12_13_DifferentialBipolarFS2Vref and AIN_12_13_DifferentialUnipolar; choose one")
+# endif // AIN_12_13_DifferentialUnipolar
 # if AIN_12_13_SingleEnded
 #  error("cannot have both AIN_12_13_DifferentialBipolarFS2Vref and AIN_12_13_SingleEnded; choose one")
 # endif // AIN_12_13_SingleEnded
 #endif // AIN_12_13_DifferentialBipolarFS2Vref
 //
-// Validate the AIN_12_13_DifferentialBipolarFSVref setting
-#if AIN_12_13_DifferentialBipolarFSVref
+// Validate the AIN_12_13_DifferentialBipolarFSVref setting
+#if AIN_12_13_DifferentialBipolarFSVref
 # if AIN_12_13_DifferentialUnipolar
-#  error("cannot have both AIN_12_13_DifferentialBipolarFSVref and AIN_12_13_DifferentialUnipolar; choose one")
+#  error("cannot have both AIN_12_13_DifferentialBipolarFSVref and AIN_12_13_DifferentialUnipolar; choose one")
 # endif // AIN_12_13_DifferentialUnipolar
-# if AIN_12_13_SingleEnded
-#  error("cannot have both AIN_12_13_DifferentialBipolarFSVref and AIN_12_13_SingleEnded; choose one")
-# endif // AIN_12_13_SingleEnded
-#endif // AIN_12_13_DifferentialBipolarFSVref
+# if AIN_12_13_SingleEnded
+#  error("cannot have both AIN_12_13_DifferentialBipolarFSVref and AIN_12_13_SingleEnded; choose one")
+# endif // AIN_12_13_SingleEnded
+#endif // AIN_12_13_DifferentialBipolarFSVref
 //
 // Validate the AIN_12_13_DifferentialUnipolar setting
 #if AIN_12_13_DifferentialUnipolar
-# if AIN_12_13_SingleEnded
-#  error("cannot have both AIN_12_13_DifferentialUnipolar and AIN_12_13_SingleEnded; choose one")
-# endif // AIN_12_13_SingleEnded
+# if AIN_12_13_SingleEnded
+#  error("cannot have both AIN_12_13_DifferentialUnipolar and AIN_12_13_SingleEnded; choose one")
+# endif // AIN_12_13_SingleEnded
 #endif // AIN_12_13_DifferentialUnipolar
 
 //----------------------------------------
@@ -908,14 +941,14 @@
 //~ #define AIN_14_15_DifferentialBipolarFS2Vref 	1
 //
 //--------------------
-// ADC Channels AIN14, AIN15 = Differential Bipolar
+// ADC Channels AIN14, AIN15 = Differential Bipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN14, AIN15 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
+// AIN14, AIN15 are a Differential pair using Bipolar transfer function with range (+/-)(1/2)Vref
 // AIN14 voltage must always be between 0 and VREF.
 // AIN15 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_14_15_DifferentialBipolarFSVref 	1
+//~ #define AIN_14_15_DifferentialBipolarFSVref 	1
 //
 //--------------------
 // ADC Channels AIN14, AIN15 = Differential Unipolar (AIN14 > AIN15)
@@ -928,78 +961,77 @@
 //~ #define AIN_14_15_DifferentialUnipolar 	1
 //
 //--------------------
-// ADC Channels AIN14, AIN15 = Both Single-Ended, Unipolar
+// ADC Channels AIN14, AIN15 = Both Single-Ended, Unipolar
 // Full Scale = VREF
 // Voltage per LSB count = VREF/2048
-// AIN14 is a Single-Ended input using Unipolar transfer function.
-// AIN15 is a Single-Ended input using Unipolar transfer function.
-// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
+// AIN14 is a Single-Ended input using Unipolar transfer function.
+// AIN15 is a Single-Ended input using Unipolar transfer function.
+// If PDIFF_COM_1, both are Pseudo-Differential with REF- as common.
 // AIN14 voltage must always be between 0 and VREF.
 // AIN15 voltage must always be between 0 and VREF.
 //
-//~ #define AIN_14_15_SingleEnded 	1
+//~ #define AIN_14_15_SingleEnded 	1
 //
 //--------------------
 //
 // Default settings if not defined at project level
 #ifndef AIN_14_15_DifferentialBipolarFS2Vref
-# ifndef AIN_14_15_DifferentialBipolarFSVref
+# ifndef AIN_14_15_DifferentialBipolarFSVref
 #  ifndef AIN_14_15_DifferentialUnipolar
-#   ifndef AIN_14_15_SingleEnded
+#   ifndef AIN_14_15_SingleEnded
 #    define AIN_14_15_DifferentialBipolarFS2Vref 	0
-#    define AIN_14_15_DifferentialBipolarFSVref 	0
-#    define AIN_14_15_DifferentialUnipolar 	0
+#    define AIN_14_15_DifferentialBipolarFSVref 	0
+#    define AIN_14_15_DifferentialUnipolar 	0
 #    define AIN_14_15_SingleEnded 	1
-#   endif // AIN_14_15_SingleEnded
+#   endif // AIN_14_15_SingleEnded
 #  endif // AIN_14_15_DifferentialUnipolar
-# endif // AIN_14_15_DifferentialBipolarFSVref
+# endif // AIN_14_15_DifferentialBipolarFSVref
 #endif // AIN_14_15_DifferentialBipolarFS2Vref
 //
 // (optional diagnostic) pragma message the active setting
 #if AIN_14_15_DifferentialBipolarFS2Vref
 //~ #  pragma message("AIN_14_15_DifferentialBipolarFS2Vref: ADC Channels AIN14, AIN15 = Differential Bipolar")
 #endif // AIN_14_15_DifferentialBipolarFS2Vref
-#if AIN_14_15_DifferentialBipolarFSVref
-//~ #  pragma message("AIN_14_15_DifferentialBipolarFSVref: ADC Channels AIN14, AIN15 = Differential Bipolar")
-#endif // AIN_14_15_DifferentialBipolarFSVref
-#if AIN_14_15_DifferentialUnipolar
-//~ #  pragma message("AIN_14_15_DifferentialUnipolar: ADC Channels AIN14, AIN15 = Differential Unipolar (AIN14 > AIN15)")
-#endif // AIN_14_15_DifferentialUnipolar
+#if AIN_14_15_DifferentialBipolarFSVref
+//~ #  pragma message("AIN_14_15_DifferentialBipolarFSVref: ADC Channels AIN14, AIN15 = Differential Bipolar")
+#endif // AIN_14_15_DifferentialBipolarFSVref
+#if AIN_14_15_DifferentialUnipolar
+//~ #  pragma message("AIN_14_15_DifferentialUnipolar: ADC Channels AIN14, AIN15 = Differential Unipolar (AIN14 > AIN15)")
+#endif // AIN_14_15_DifferentialUnipolar
 #if AIN_14_15_SingleEnded
 //~ #  pragma message("AIN_14_15_SingleEnded: ADC Channels AIN14, AIN15 = Both Single-Ended, Unipolar")
 #endif // AIN_14_15_SingleEnded
 //
 // Validate the AIN_14_15_DifferentialBipolarFS2Vref setting
 #if AIN_14_15_DifferentialBipolarFS2Vref
-# if AIN_14_15_DifferentialBipolarFSVref
-#  error("cannot have both AIN_14_15_DifferentialBipolarFS2Vref and AIN_14_15_DifferentialBipolarFSVref; choose one")
-# endif // AIN_14_15_DifferentialBipolarFSVref
-# if AIN_14_15_DifferentialUnipolar
-#  error("cannot have both AIN_14_15_DifferentialBipolarFS2Vref and AIN_14_15_DifferentialUnipolar; choose one")
-# endif // AIN_14_15_DifferentialUnipolar
+# if AIN_14_15_DifferentialBipolarFSVref
+#  error("cannot have both AIN_14_15_DifferentialBipolarFS2Vref and AIN_14_15_DifferentialBipolarFSVref; choose one")
+# endif // AIN_14_15_DifferentialBipolarFSVref
+# if AIN_14_15_DifferentialUnipolar
+#  error("cannot have both AIN_14_15_DifferentialBipolarFS2Vref and AIN_14_15_DifferentialUnipolar; choose one")
+# endif // AIN_14_15_DifferentialUnipolar
 # if AIN_14_15_SingleEnded
 #  error("cannot have both AIN_14_15_DifferentialBipolarFS2Vref and AIN_14_15_SingleEnded; choose one")
 # endif // AIN_14_15_SingleEnded
 #endif // AIN_14_15_DifferentialBipolarFS2Vref
 //
-// Validate the AIN_14_15_DifferentialBipolarFSVref setting
-#if AIN_14_15_DifferentialBipolarFSVref
+// Validate the AIN_14_15_DifferentialBipolarFSVref setting
+#if AIN_14_15_DifferentialBipolarFSVref
 # if AIN_14_15_DifferentialUnipolar
-#  error("cannot have both AIN_14_15_DifferentialBipolarFSVref and AIN_14_15_DifferentialUnipolar; choose one")
+#  error("cannot have both AIN_14_15_DifferentialBipolarFSVref and AIN_14_15_DifferentialUnipolar; choose one")
 # endif // AIN_14_15_DifferentialUnipolar
-# if AIN_14_15_SingleEnded
-#  error("cannot have both AIN_14_15_DifferentialBipolarFSVref and AIN_14_15_SingleEnded; choose one")
-# endif // AIN_14_15_SingleEnded
-#endif // AIN_14_15_DifferentialBipolarFSVref
+# if AIN_14_15_SingleEnded
+#  error("cannot have both AIN_14_15_DifferentialBipolarFSVref and AIN_14_15_SingleEnded; choose one")
+# endif // AIN_14_15_SingleEnded
+#endif // AIN_14_15_DifferentialBipolarFSVref
 //
 // Validate the AIN_14_15_DifferentialUnipolar setting
 #if AIN_14_15_DifferentialUnipolar
-# if AIN_14_15_SingleEnded
-#  error("cannot have both AIN_14_15_DifferentialUnipolar and AIN_14_15_SingleEnded; choose one")
-# endif // AIN_14_15_SingleEnded
+# if AIN_14_15_SingleEnded
+#  error("cannot have both AIN_14_15_DifferentialUnipolar and AIN_14_15_SingleEnded; choose one")
+# endif // AIN_14_15_SingleEnded
 #endif // AIN_14_15_DifferentialUnipolar
 
-// CODE GENERATOR: class declaration and docstrings
 /**
  * @brief MAX11131 3Msps, Low-Power, Serial SPI 12-Bit, 16-Channel, Differential/Single-Ended Input, SAR ADC
  *
@@ -1009,13 +1041,43 @@
  *
  *
  *
- * //---------- CODE GENERATOR: helloCppCodeList
  * @code
- * // CODE GENERATOR: example code includes
  * // example code includes
- * // standard include for target platform
+ * // standard include for target platform -- Platform_Include_Boilerplate
  * #include "mbed.h"
- * //#include "max32625.h"
+ * // Platforms:
+ * //   - MAX32625MBED
+ * //      - supports mbed-os-5.11, requires USBDevice library
+ * //      - add https://developer.mbed.org/teams/MaximIntegrated/code/USBDevice/
+ * //      - remove max32630fthr library (if present)
+ * //      - remove MAX32620FTHR library (if present)
+ * //   - MAX32600MBED
+ * //      - remove max32630fthr library (if present)
+ * //      - remove MAX32620FTHR library (if present)
+ * //      - Windows 10 note:  Don't connect HDK until you are ready to load new firmware into the board.
+ * //   - NUCLEO_F446RE
+ * //      - remove USBDevice library
+ * //      - remove max32630fthr library (if present)
+ * //      - remove MAX32620FTHR library (if present)
+ * //   - NUCLEO_F401RE
+ * //      - remove USBDevice library
+ * //      - remove max32630fthr library (if present)
+ * //      - remove MAX32620FTHR library (if present)
+ * //   - MAX32630FTHR
+ * //      - #include "max32630fthr.h"
+ * //      - add http://os.mbed.org/teams/MaximIntegrated/code/max32630fthr/
+ * //      - remove MAX32620FTHR library (if present)
+ * //   - MAX32620FTHR
+ * //      - #include "MAX32620FTHR.h"
+ * //      - remove max32630fthr library (if present)
+ * //      - add https://os.mbed.com/teams/MaximIntegrated/code/MAX32620FTHR/
+ * //      - not tested yet
+ * //   - MAX32625PICO
+ * //      - remove max32630fthr library (if present)
+ * //      - remove MAX32620FTHR library (if present)
+ * //      - not tested yet
+ * //
+ * // end Platform_Include_Boilerplate
  * #include "MAX11131.h"
  *
  * // example code board support
@@ -1060,8 +1122,8 @@
  *
  * // example code declare GPIO interface pins
  * DigitalOut CNVST_pin(D9); // Digital Trigger Input to MAX11131 device
- * // AnalogOut REF__pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
- * // AnalogOut REF__AIN15_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
+ * // AnalogOut REF_plus_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
+ * // AnalogOut REF_minus_slash_AIN15_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX11131 device
  * DigitalIn EOC_pin(D2); // Digital Event Output from MAX11131 device
  * // example code declare device instance
  * MAX11131 g_MAX11131_device(spi, spi_cs, CNVST_pin, EOC_pin, MAX11131::MAX11131_IC);
@@ -1071,41 +1133,41 @@
  * {
  *     while (1)
  *     {
- *         // CODE GENERATOR: example code: member function Init
  *         g_MAX11131_device.Init();
  *
- *         // CODE GENERATOR: example code: has no member function REF
- *         // CODE GENERATOR: example code: has no member function CODE_LOAD
- *         // CODE GENERATOR: example code: has no member function CODEallLOADall
- *         // CODE GENERATOR: example code: has no member function CODEnLOADn
- *         // CODE GENERATOR: example code: member function ScanManual
- *         // @param[in] g_MAX11131_device.channelNumber_0_15: AIN Channel Number
- *         // @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
- *         // @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
- *         int channelId_0_15 = 3;
- *         g_MAX11131_device.channelNumber_0_15 = channelId_0_15;
- *         g_MAX11131_device.PowerManagement_0_2 = 0;
- *         g_MAX11131_device.chan_id_0_1 = 1;
- *         g_MAX11131_device.NumWords = g_MAX11131_device.ScanManual();
+ *         while(1) { // this code repeats forever
+ *             // this code repeats forever
+ *             // Measure ADC channels in sequence from AIN0 to channelNumber_0_15.
+ *             // @param[in] g_MAX11131_device.channelNumber_0_15: AIN Channel Number
+ *             // @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
+ *             // @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
+ *             int channelId_0_15 = 15;
+ *             g_MAX11131_device.channelNumber_0_15 = channelId_0_15;
+ *             g_MAX11131_device.PowerManagement_0_2 = 0;
+ *             g_MAX11131_device.chan_id_0_1 = 1;
+ *             g_MAX11131_device.NumWords = g_MAX11131_device.ScanStandardExternalClock();
  *
- *         // CODE GENERATOR: example code: member function ReadAINcode
- *         // TODO1: CODE GENERATOR: example code: member function ReadAINcode
- *         // Read raw ADC codes from device into AINcode[] and RAW_misoData16[]
- *         // @pre one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords
- *         g_MAX11131_device.ReadAINcode();
- *         // @post RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
- *         // @post AINcode[NUM_CHANNELS] contains the latest readings in LSBs
+ *             // Read raw ADC codes from device into AINcode[] and RAW_misoData16[]
+ *             // @pre one of the MAX11311_Scan functions was called, setting g_MAX11131_device.NumWords
+ *             g_MAX11131_device.ReadAINcode();
+ *             // @post RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
+ *             // @post AINcode[NUM_CHANNELS] contains the latest readings in LSBs
  *
- *         wait(3.0);
+ *             wait(3.0);
+ *             // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
+ *             cmdLine.serial().printf("%d", g_MAX11131_device.AINcode[0]);
+ *             for (int index = 1; index <= channelId_0_15; index++) {
+ *                 cmdLine.serial().printf(",%d", g_MAX11131_device.AINcode[index]);
+ *             }
+ *             cmdLine.serial().printf("\n");
+ *
+ *         } // this code repeats forever
  *     }
  * }
  * @endcode
- * //---------- CODE GENERATOR: end helloCppCodeList
  */
 class MAX11131 {
 public:
-// CODE GENERATOR: TypedefEnum EnumItem declarations
-// CODE GENERATOR: TypedefEnum MAX11131_SCAN_enum_t
     //----------------------------------------
     /// ADC_MODE_CONTROL.SCAN[3:0] ADC Scan Control (command)
     typedef enum MAX11131_SCAN_enum_t {
@@ -1121,7 +1183,6 @@
         SCAN_1001_SampleSetExternalClock = 0x09, //!< 8'b00001001
     } MAX11131_SCAN_enum_t;
 
-// CODE GENERATOR: TypedefEnum MAX11131_RESET_enum_t
     //----------------------------------------
     /// ADC_MODE_CONTROL.RESET[1:0] Reset 0=Normal 1=ResetFIFO 2=ResetAllRegisters 3=reserved
     typedef enum MAX11131_RESET_enum_t {
@@ -1130,7 +1191,6 @@
         RESET_10_ResetAllRegisters = 0x02, //!< 8'b00000010
     } MAX11131_RESET_enum_t;
 
-// CODE GENERATOR: TypedefEnum MAX11131_PM_enum_t
     //----------------------------------------
     /// ADC_MODE_CONTROL.PM[1:0] Power Management 0=Normal, 1=AutoShutdown, 2=AutoStandby 3=reserved
     typedef enum MAX11131_PM_enum_t {
@@ -1139,7 +1199,6 @@
         PM_10_AutoStandby = 0x02, //!< 8'b00000010
     } MAX11131_PM_enum_t;
 
-// TODO1: CODE GENERATOR: ic_variant -- IC's supported with this driver
     /**
      * @brief IC's supported with this driver
      * @details MAX11131
@@ -1150,7 +1209,6 @@
         //MAX11131_IC = 1
     } MAX11131_ic_t;
 
-// TODO1: CODE GENERATOR: class constructor declaration
     /**********************************************************//**
     * @brief Constructor for MAX11131 Class.
     *
@@ -1160,9 +1218,7 @@
     * On Entry:
     *     @param[in] spi - pointer to existing SPI object
     *     @param[in] cs_pin - pointer to a DigitalOut pin object
-    *     CODE GENERATOR: class constructor docstrings gpio InputPin pins
     *     @param[in] CNVST_pin - pointer to a DigitalOut pin object
-    *     CODE GENERATOR: class constructor docstrings gpio OutputPin pins
     *     @param[in] EOC_pin - pointer to a DigitalIn pin object
     *     @param[in] ic_variant - which type of MAX11131 is used
     *
@@ -1171,15 +1227,12 @@
     * @return None
     **************************************************************/
     MAX11131(SPI &spi, DigitalOut &cs_pin, // SPI interface
-            // CODE GENERATOR: class constructor declaration gpio InputPin pins
             DigitalOut &CNVST_pin, // Digital Trigger Input to MAX11131 device
-            // AnalogOut &REF__pin, // Reference Input to MAX11131 device
-            // AnalogOut &REF__AIN15_pin, // Reference Input to MAX11131 device
-            // CODE GENERATOR: class constructor declaration gpio OutputPin pins
+            // AnalogOut &REF_plus_pin, // Reference Input to MAX11131 device
+            // AnalogOut &REF_minus_slash_AIN15_pin, // Reference Input to MAX11131 device
             DigitalIn &EOC_pin, // Digital Event Output from MAX11131 device
             MAX11131_ic_t ic_variant);
 
-// CODE GENERATOR: class destructor declaration
     /************************************************************
      * @brief Default destructor for MAX11131 Class.
      *
@@ -1193,12 +1246,13 @@
      **************************************************************/
     ~MAX11131();
 
-    // CODE GENERATOR: spi_frequency setter declaration
-    /// set SPI SCLK frequency
+    /// Function pointer void f(size_t byteCount, uint8_t mosiData[], uint8_t misoData[])
+    Callback<void(size_t, uint8_t*, uint8_t*)> onSPIprint; //!< optional @ref onSPIprint SPI diagnostic function
+
+    /// set SPI SCLK frequency
     void spi_frequency(int spi_sclk_Hz);
 
 //----------------------------------------
-// CODE GENERATOR: omit typedef enum MAX11131_device_t, class members instead of global device object
 public:
 
     /// shadow of write-only register ADC_MODE_CONTROL
@@ -1243,6 +1297,7 @@
     uint8_t enabledChannelsPatternLength_1_256;
 
     /// unpacked shadow of write-only register SAMPLESET enabledChannelsPattern.
+    /// Array Length = enabledChannelsPatternLength_1_256.
     /// Each entry is a channel number between 0 and 15.
     uint8_t enabledChannelsPattern[256];
 
@@ -1293,17 +1348,13 @@
     /// reference voltage, in Volts
     double VRef;
 
-// CODE GENERATOR: omit global g_MAX11131_device
 
-// CODE GENERATOR: extern function declarations
-// CODE GENERATOR: extern function declaration SPIoutputCS
 //----------------------------------------
 // Assert SPI Chip Select
 // SPI chip-select for MAX11131
 //
     void SPIoutputCS(int isLogicHigh);
 
-// CODE GENERATOR: extern function declaration SPIwrite16bits
 //----------------------------------------
 // SPI write 16 bits
 // SPI interface to MAX11131 shift 16 bits mosiData16 into MAX11131 DIN
@@ -1311,7 +1362,6 @@
 //
     void SPIwrite16bits(int16_t mosiData16);
 
-// CODE GENERATOR: extern function declaration SPIwrite24bits
 //----------------------------------------
 // SPI write 17-24 bits
 // SPI interface to MAX11131 shift 16 bits mosiData16 into MAX11131 DIN
@@ -1320,14 +1370,12 @@
 //
     void SPIwrite24bits(int16_t mosiData16_FFFF00, int8_t mosiData8_0000FF);
 
-// CODE GENERATOR: extern function declaration SPIread16bits
 //----------------------------------------
 // SPI read 16 bits while MOSI (MAX11131 DIN) is 0
 // SPI interface to capture 16 bits miso data from MAX11131 DOUT
 //
     int16_t SPIread16bits();
 
-// CODE GENERATOR: extern function declaration CNVSToutputPulseLow
 //----------------------------------------
 // Assert MAX11131 CNVST convert start.
 // Required when using any of the InternalClock modes with SWCNV 0.
@@ -1335,22 +1383,18 @@
 //
     void CNVSToutputPulseLow();
 
-// CODE GENERATOR: extern function declaration EOCinputWaitUntilLow
 //----------------------------------------
 // Wait for MAX11131 EOC pin low, indicating end of conversion.
 // Required when using any of the InternalClock modes.
 //
     void EOCinputWaitUntilLow();
 
-// CODE GENERATOR: extern function declaration EOCinputValue
 //----------------------------------------
 // Return the status of the MAX11131 EOC pin.
 //
     int EOCinputValue();
 
-// CODE GENERATOR: class member data
 private:
-// CODE GENERATOR: class member data for SPI interface
     // SPI object
     SPI &m_spi;
     int m_SPI_SCLK_Hz;
@@ -1360,7 +1404,6 @@
     // Selector pin object
     DigitalOut &m_cs_pin;
 
-// CODE GENERATOR: class member data for gpio InputPin pins
 // InputPin Name = CNVST
 // InputPin Description = Active-Low Conversion Start Input/Analog Input 14
 // InputPin Function = Trigger
@@ -1369,14 +1412,13 @@
 // InputPin Name = REF+
 // InputPin Description = External Positive Reference Input. Apply a reference voltage at REF+. Bypass to GND with a 0.47uF capacitor.
 // InputPin Function = Reference
-    // AnalogOut &m_REF__pin;
+    // AnalogOut &m_REF_plus_pin;
 //
 // InputPin Name = REF-/AIN15
 // InputPin Description = External Differential Reference Negative Input/Analog Input 15
 // InputPin Function = Reference
-    // AnalogOut &m_REF__AIN15_pin;
+    // AnalogOut &m_REF_minus_slash_AIN15_pin;
 //
-// CODE GENERATOR: class member data for gpio OutputPin pins
 // OutputPin Name = EOC
 // OutputPin Description = End of Conversion Output. Data is valid after EOC pulls low (Internal clock mode only).
 // OutputPin Function = Event
@@ -1388,12 +1430,13 @@
 
 public:
 
-// CODE GENERATOR: class member function declarations
     //----------------------------------------
+    /// Menu item '!'
     /// Initialize device
     void Init(void);
 
     //----------------------------------------
+    /// Menu item 'IS'
     /// ADC Channels AIN(channelId), AIN(channelId+1) = Both Single-Ended, Unipolar
     /// Full Scale = VREF
     /// Voltage per LSB count = VREF/4096
@@ -1403,9 +1446,10 @@
     /// AIN(channelId) voltage must always be between 0 and VREF.
     /// AIN(channelId+1) voltage must always be between 0 and VREF.
     ///
-    void Reconfigure_SingleEnded(int channelNumber_0_15);
+    void Reconfigure_SingleEnded(int channel_0_15);
 
     //----------------------------------------
+    /// Menu item 'IU'
     /// ADC Channels AIN(channelId), AIN(channelId+1) = Differential Unipolar (AIN(channelId) > AIN(channelId+1))
     /// Full Scale = VREF
     /// Voltage per LSB count = VREF/4096
@@ -1413,9 +1457,10 @@
     /// AIN(channelId) voltage must always be between 0 and VREF.
     /// AIN(channelId+1) voltage must always be between 0 and VREF.
     ///
-    void Reconfigure_DifferentialUnipolar(int channelNumber_0_15);
+    void Reconfigure_DifferentialUnipolar(int channel_0_15);
 
     //----------------------------------------
+    /// Menu item 'IB'
     /// ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar
     /// Full Scale = VREF
     /// Voltage per LSB count = VREF/4096
@@ -1423,9 +1468,10 @@
     /// AIN(channelId) voltage must always be between 0 and VREF.
     /// AIN(channelId+1) voltage must always be between 0 and VREF.
     ///
-    void Reconfigure_DifferentialBipolarFSVref(int channelNumber_0_15);
+    void Reconfigure_DifferentialBipolarFSVref(int channel_0_15);
 
     //----------------------------------------
+    /// Menu item 'IR'
     /// ADC Channels AIN(channelId), AIN(channelId+1) = Differential Bipolar
     /// Full Scale = 2 * VREF
     /// Voltage per LSB count = VREF/2048
@@ -1433,7 +1479,7 @@
     /// AIN(channelId) voltage must always be between 0 and VREF.
     /// AIN(channelId+1) voltage must always be between 0 and VREF.
     ///
-    void Reconfigure_DifferentialBipolarFS2Vref(int channelNumber_0_15);
+    void Reconfigure_DifferentialBipolarFS2Vref(int channel_0_15);
 
     //----------------------------------------
     /// SCAN_0000_NOP
@@ -1451,6 +1497,7 @@
     /// If internal clock mode with SWCNV=0, measurements will be triggered using CNVST pin.
     ///
     /// @pre one of the Scan functions was called, setting g_MAX11131_device.NumWords
+    /// @param[in] g_MAX11131_device.NumWords: number of words to be read from the FIFO
     /// @post g_MAX11131_device.RAW_misoData16[index] contains the raw SPI Master-In,Slave-Out data
     /// @post g_MAX11131_device.AINcode[NUM_CHANNELS] contains the latest readings in LSBs
     ///
@@ -1483,6 +1530,7 @@
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For external clock modes, the data format depends on CHAN_ID.
     ///     when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
     ///     when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
@@ -1506,6 +1554,7 @@
     ///         CNVST pin is not used. (AIN14 is available)
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For internal clock modes, the data format always includes the channel address.
     ///     misoData16 = CH[3:0] DATA[11:0]
     ///
@@ -1527,6 +1576,7 @@
     ///         CS must be held low for minimum of 17 SCLK cycles.
     ///         CNVST pin is not used. (AIN14 is available)
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For internal clock modes, the data format always includes the channel address.
     ///     misoData16 = CH[3:0] DATA[11:0]
     ///
@@ -1541,6 +1591,7 @@
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For external clock modes, the data format depends on CHAN_ID.
     ///     when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
     ///     when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
@@ -1563,6 +1614,7 @@
     ///         CS must be held low for minimum of 17 SCLK cycles.
     ///         CNVST pin is not used. (AIN14 is available)
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For internal clock modes, the data format always includes the channel address.
     ///     misoData16 = CH[3:0] DATA[11:0]
     ///
@@ -1577,6 +1629,7 @@
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For external clock modes, the data format depends on CHAN_ID.
     ///     when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
     ///     when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
@@ -1616,6 +1669,7 @@
     ///         CS must be held low for minimum of 17 SCLK cycles.
     ///         CNVST pin is not used. (AIN14 is available)
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For internal clock modes, the data format always includes the channel address.
     ///     misoData16 = CH[3:0] DATA[11:0]
     ///
@@ -1647,6 +1701,7 @@
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For external clock modes, the data format depends on CHAN_ID.
     ///     when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
     ///     when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]
@@ -1668,9 +1723,11 @@
     ///     (((enabledChannelsPattern[0]) & 0x0F) << 4) | ((enabledChannelsPattern[1]) & 0x0F)
     ///     If it is an odd number of channels, additional nybbles will be ignored.
     ///     CS will be asserted low during the entire SAMPLESET pattern selection.
+    /// @param[in] g_MAX11131_device.enabledChannelsPattern: array of channel select, one channel per byte
     /// @param[in] g_MAX11131_device.PowerManagement_0_2: 0=Normal, 1=AutoShutdown, 2=AutoStandby
     /// @param[in] g_MAX11131_device.chan_id_0_1: ADC_MODE_CONTROL.CHAN_ID
     /// @return number of ScanRead() words needed to retrieve the data.
+    /// @post NumWords = number of words to be read from the FIFO
     /// For external clock modes, the data format depends on CHAN_ID.
     ///     when CHAN_ID = 0: misoData16 = 0 DATA[11:0] x x x
     ///     when CHAN_ID = 1: misoData16 = CH[3:0] DATA[11:0]