Test program running on MAX32625MBED. Control through USB Serial commands using a terminal emulator such as teraterm or putty.

Dependencies:   MaximTinyTester CmdLine MAX541 USBDevice

Embed: (wiki syntax)

« Back to documentation index

MAX11043 Class Reference

MAX11043 Class Reference

MAX11043 200ksps, Low-Power, Serial SPI 24-Bit, 4-Channel, Differential/Single-Ended Input, Simultaneous-Sampling SD ADC. More...

#include <MAX11043.h>

Public Types

enum  MAX11043_CMDOP_enum_t { CMDOP_0aaa_aa00_WriteRegister = 0x00, CMDOP_0aaa_aa10_ReadRegister = 0x02, CMDOP_1111_1111_NoOperationMOSIidleHigh = 0xff }
 

Command Operation Format (see function DecodeCommand)

More...
enum  MAX11043_CMD_enum_t {
  CMD_0000_0010_d16o8_Rd00_ADCa = 0x02, CMD_0000_0110_d16o8_Rd01_ADCb = 0x06, CMD_0000_1010_d16o8_Rd02_ADCc = 0x0a, CMD_0000_1110_d16o8_Rd03_ADCd = 0x0e,
  CMD_0001_0010_d16o8_d16o8_Rd04_ADCab = 0x12, CMD_0001_0110_d16o8_d16o8_Rd05_ADCcd = 0x16, CMD_0001_1010_d16o8_d16o8_d16o8_d16o8_Rd06_ADCabcd = 0x1a, CMD_0001_1110_d8_Rd07_Status = 0x1e,
  CMD_0010_0000_d16_Wr08_Configuration = 0x20, CMD_0010_0010_d16_Rd08_Configuration = 0x22, CMD_0010_0100_d16_Wr09_DAC = 0x24, CMD_0010_0110_d16_Rd09_DAC = 0x26,
  CMD_0010_1000_d16_Wr0A_DACStep = 0x28, CMD_0010_1010_d16_Rd0A_DACStep = 0x2a, CMD_0010_1100_d16_Wr0B_DACHDACL = 0x2c, CMD_0010_1110_d16_Rd0B_DACHDACL = 0x2e,
  CMD_0011_0000_d16_Wr0C_ConfigA = 0x30, CMD_0011_0010_d16_Rd0C_ConfigA = 0x32, CMD_0011_0100_d16_Wr0D_ConfigB = 0x34, CMD_0011_0110_d16_Rd0D_ConfigB = 0x36,
  CMD_0011_1000_d16_Wr0E_ConfigC = 0x38, CMD_0011_1010_d16_Rd0E_ConfigC = 0x3a, CMD_0011_1100_d16_Wr0F_ConfigD = 0x3c, CMD_0011_1110_d16_Rd0F_ConfigD = 0x3e,
  CMD_0100_0000_d16_Wr10_Reference = 0x40, CMD_0100_0010_d16_Rd10_Reference = 0x42, CMD_0100_0100_d16_Wr11_AGain = 0x44, CMD_0100_0110_d16_Rd11_AGain = 0x46,
  CMD_0100_1000_d16_Wr12_BGain = 0x48, CMD_0100_1010_d16_Rd12_BGain = 0x4a, CMD_0100_1100_d16_Wr13_CGain = 0x4c, CMD_0100_1110_d16_Rd13_CGain = 0x4e,
  CMD_0101_0000_d16_Wr14_DGain = 0x50, CMD_0101_0010_d16_Rd14_DGain = 0x52, CMD_0101_0100_d8_Wr15_FilterCAddress = 0x54, CMD_0101_0110_d8_Rd15_FilterCAddress = 0x56,
  CMD_0101_1000_d32_Wr16_FilterCDataOut = 0x58, CMD_0101_1010_d32_Rd16_FilterCDataOut = 0x5a, CMD_0101_1100_d32_Wr17_FilterCDataIn = 0x5c, CMD_0101_1110_d32_Rd17_FilterCDataIn = 0x5e,
  CMD_0110_0000_d8_Wr18_FlashMode = 0x60, CMD_0110_0010_d8_Rd18_FlashMode = 0x62, CMD_0110_0100_d16_Wr19_FlashAddr = 0x64, CMD_0110_0110_d16_Rd19_FlashAddr = 0x66,
  CMD_0110_1000_d16_Wr1A_FlashDataIn = 0x68, CMD_0110_1010_d16_Rd1A_FlashDataIn = 0x6a, CMD_0110_1110_d16_Rd1B_FlashDataOut = 0x6e
}
 

Register Addresses.

More...
enum  MAX11043_STATUS_enum_t {
  STATUS_xxxx_xxx1_OverflowFlagOFLGD = 0x01, STATUS_xxxx_xx1x_OverflowFlagOFLGC = 0x02, STATUS_xxxx_x1xx_OverflowFlagOFLGB = 0x04, STATUS_xxxx_1xxx_OverflowFlagOFLGA = 0x08,
  STATUS_xxx1_xxxx_PowerOnResetBOOT = 0x10, STATUS_xx1x_xxxx_FlashBusy = 0x20, STATUS_x1xx_xxxx_RESERVED = 0x40, STATUS_1xxx_xxxx_RESERVED = 0x80
}
 

CMD_0001_1110_d8_Rd07_Status regAddr=07h Status: x x FlashBusy BOOT OFLGA OFLGB OFLGC OFLGD.

More...
enum  MAX11043_CONFIG_enum_t {
  CONFIG_xxxx_xxxx_xxxx_xxx1_DECSEL12 = 0x0001, CONFIG_xxxx_xxxx_xxxx_xx1x_SCHAND = 0x0002, CONFIG_xxxx_xxxx_xxxx_x1xx_SCHANC = 0x0004, CONFIG_xxxx_xxxx_xxxx_1xxx_SCHANB = 0x0008,
  CONFIG_xxxx_xxxx_xxx1_xxxx_SCHANA = 0x0010, CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT = 0x0020, CONFIG_xxxx_xxxx_x1xx_xxxx_PDOSC = 0x0040, CONFIG_xxxx_xxxx_1xxx_xxxx_PDDAC = 0x0080,
  CONFIG_xxxx_xxx1_xxxx_xxxx_PDD = 0x0100, CONFIG_xxxx_xx1x_xxxx_xxxx_PDC = 0x0200, CONFIG_xxxx_x1xx_xxxx_xxxx_PDB = 0x0400, CONFIG_xxxx_1xxx_xxxx_xxxx_PDA = 0x0800,
  CONFIG_xxx1_xxxx_xxxx_xxxx_PD = 0x1000, CONFIG_xx1x_xxxx_xxxx_xxxx_CLKDIV0 = 0x2000, CONFIG_x1xx_xxxx_xxxx_xxxx_CLKDIV1 = 0x4000, CONFIG_1xxx_xxxx_xxxx_xxxx_EXTCLK = 0x8000
}
 

CMD_0010_0000_d16_Wr08_Configuration regAddr=08h Config: EXTCLK CLKDIV1 CLKDIV0 PD PDA PDB PDC PDD PDDAC PDOSC 24BIT SCHANA SCHANB SCHANC SCHAND DECSEL.

More...
enum  MAX11043_CONFIGABCD_enum_t {
  CONFIGABCD_xxxx_xxxx_xxxx_xxx1_ENBIASN = 0x0001, CONFIGABCD_xxxx_xxxx_xxxx_xx1x_ENBIASP = 0x0002, CONFIGABCD_xxxx_xxxx_xxxx_x1xx_PGAG16 = 0x0004, CONFIGABCD_xxxx_xxxx_xxxx_1xxx_FILTLP = 0x0008,
  CONFIGABCD_xxxx_xxxx_xxx1_xxxx_PDPGA = 0x0010, CONFIGABCD_xxxx_xxxx_xx1x_xxxx_MODG0 = 0x0020, CONFIGABCD_xxxx_xxxx_x1xx_xxxx_MODG1 = 0x0040, CONFIGABCD_xxxx_xxxx_1xxx_xxxx_EQ = 0x0080,
  CONFIGABCD_xxxx_xxx1_xxxx_xxxx_DIFF = 0x0100, CONFIGABCD_xxxx_xx1x_xxxx_xxxx_BDAC0 = 0x0200, CONFIGABCD_xxxx_x1xx_xxxx_xxxx_BDAC1 = 0x0400, CONFIGABCD_xxxx_1xxx_xxxx_xxxx_BDAC2 = 0x0800,
  CONFIGABCD_xxx1_xxxx_xxxx_xxxx_BDAC3 = 0x1000, CONFIGABCD_xx1x_xxxx_xxxx_xxxx_RESERVED = 0x2000, CONFIGABCD_x1xx_xxxx_xxxx_xxxx_RESERVED = 0x4000, CONFIGABCD_1xxx_xxxx_xxxx_xxxx_RESERVED = 0x8000
}
 

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN.

More...
enum  MAX11043_BDAC_enum_t {
  BDAC_0000_033pctAVDD = 0x00, BDAC_0001_035pctAVDD = 0x01, BDAC_0010_038pctAVDD = 0x02, BDAC_0011_040pctAVDD = 0x03,
  BDAC_0100_042pctAVDD = 0x04, BDAC_0101_044pctAVDD = 0x05, BDAC_0110_046pctAVDD = 0x06, BDAC_0111_048pctAVDD = 0x07,
  BDAC_1000_050pctAVDD = 0x08, BDAC_1001_052pctAVDD = 0x09, BDAC_1010_054pctAVDD = 0x0a, BDAC_1011_056pctAVDD = 0x0b,
  BDAC_1100_058pctAVDD = 0x0c, BDAC_1101_060pctAVDD = 0x0d, BDAC_1110_062pctAVDD = 0x0e, BDAC_1111_065pctAVDD = 0x0f
}
 

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh.

More...
enum  MAX11043_REFERENCE_enum_t {
  REFERENCE_xxxx_xxxx_xxxx_xxx1_EXBUFDACL = 0x0001, REFERENCE_xxxx_xxxx_xxxx_xx1x_EXBUFDACH = 0x0002, REFERENCE_xxxx_xxxx_xxxx_x1xx_EXBUFDAC = 0x0004, REFERENCE_xxxx_xxxx_xxxx_1xxx_EXBUFD = 0x0008,
  REFERENCE_xxxx_xxxx_xxx1_xxxx_EXBUFC = 0x0010, REFERENCE_xxxx_xxxx_xx1x_xxxx_EXBUFB = 0x0020, REFERENCE_xxxx_xxxx_x1xx_xxxx_EXBUFA = 0x0040, REFERENCE_xxxx_xxxx_1xxx_xxxx_EXTREF = 0x0080,
  REFERENCE_xxxx_xxx1_xxxx_xxxx_PURGE0 = 0x0100, REFERENCE_xxxx_xx1x_xxxx_xxxx_PURGE1 = 0x0200, REFERENCE_xxxx_x1xx_xxxx_xxxx_PURGE2 = 0x0400, REFERENCE_xxxx_1xxx_xxxx_xxxx_PURGE3 = 0x0800,
  REFERENCE_xxx1_xxxx_xxxx_xxxx_PURGE4 = 0x1000, REFERENCE_xx1x_xxxx_xxxx_xxxx_RESERVED = 0x2000, REFERENCE_x1xx_xxxx_xxxx_xxxx_RESERVED = 0x4000, REFERENCE_1xxx_xxxx_xxxx_xxxx_RESERVED = 0x8000
}
 

CMD_0100_0000_d16_Wr10_Reference regAddr=10h ReferenceDelay: 0 0 0 PURGE[4:0] EXTREF EXBUFA EXBUFB EXBUFC EXBUFD EXBUFDAC EXBUFDACH EXBUFDACL.

More...
enum  MAX11043_ic_t
 

IC's supported with this driver.

More...
typedef enum
MAX11043::MAX11043_CMDOP_enum_t 
MAX11043_CMDOP_enum_t
 Command Operation Format (see function DecodeCommand)
typedef enum
MAX11043::MAX11043_CMD_enum_t 
MAX11043_CMD_enum_t
 Register Addresses.
typedef enum
MAX11043::MAX11043_STATUS_enum_t 
MAX11043_STATUS_enum_t
 CMD_0001_1110_d8_Rd07_Status regAddr=07h Status: x x FlashBusy BOOT OFLGA OFLGB OFLGC OFLGD.
typedef enum
MAX11043::MAX11043_CONFIG_enum_t 
MAX11043_CONFIG_enum_t
 CMD_0010_0000_d16_Wr08_Configuration regAddr=08h Config: EXTCLK CLKDIV1 CLKDIV0 PD PDA PDB PDC PDD PDDAC PDOSC 24BIT SCHANA SCHANB SCHANC SCHAND DECSEL.
typedef enum
MAX11043::MAX11043_CONFIGABCD_enum_t 
MAX11043_CONFIGABCD_enum_t
 CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN.
typedef enum
MAX11043::MAX11043_BDAC_enum_t 
MAX11043_BDAC_enum_t
 CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh.
typedef enum
MAX11043::MAX11043_REFERENCE_enum_t 
MAX11043_REFERENCE_enum_t
 CMD_0100_0000_d16_Wr10_Reference regAddr=10h ReferenceDelay: 0 0 0 PURGE[4:0] EXTREF EXBUFA EXBUFB EXBUFC EXBUFD EXBUFDAC EXBUFDACH EXBUFDACL.

Public Member Functions

 MAX11043 (SPI &spi, DigitalOut &cs_pin, DigitalOut &CONVRUN_pin, DigitalOut &SHDN_pin, DigitalOut &DACSTEP_pin, DigitalOut &UP_slash_DWNb_pin,#if MAX11043_EOC_INTERRUPT_POLLINGDigitalIn &EOC_pin,#elseInterruptIn &EOC_pin,#endifMAX11043_ic_t ic_variant)
 Constructor for MAX11043 Class.
void spi_frequency (int spi_sclk_Hz)
 set SPI SCLK frequency
int get_spi_frequency () const
 get SPI SCLK frequency
int get_spi_dataMode () const
 get SPI mode
uint8_t Init (void)
 Menu item '!' Initialize device.
double ADCVoltageOfCode_16bit (uint32_t value_u16)
 Return the physical voltage corresponding to conversion result (conversion format is Bipolar mode, 2's complement) Does not perform any offset or gain correction.
double ADCVoltageOfCode_24bit (uint32_t value_u24)
 Return the physical voltage corresponding to conversion result (conversion format is Bipolar mode, 2's complement) Does not perform any offset or gain correction.
uint8_t RegWrite (MAX11043_CMD_enum_t commandByte, uint32_t regData)
 Write a MAX11043 register.
uint8_t RegRead (MAX11043_CMD_enum_t commandByte, uint32_t *ptrRegData)
 Read an 8-bit MAX11043 register.
uint8_t RegSize (MAX11043_CMD_enum_t commandByte)
 Return the size of a MAX11043 register.
MAX11043::MAX11043_CMDOP_enum_t DecodeCommand (MAX11043_CMD_enum_t commandByte)
 Decode operation from commandByte.
uint8_t RegAddrOfCommand (MAX11043_CMD_enum_t commandByte)
 Return the address field of a MAX11043 register.
uint8_t IsRegReadCommand (MAX11043_CMD_enum_t commandByte)
 Test whether a command byte is a register read command.
const char * RegName (MAX11043_CMD_enum_t commandByte)
 Return the name of a MAX11043 register.
uint8_t Read_ADCabcd (void)
 Menu item '$' -> adca, adcb, adcc, adcd Read ADCabcd.
uint8_t Write_AGain (uint32_t gain)
 Menu item 'GA' Write AGain register.
void Configure_Demo (void)
 Menu item 'XD' Example configuration.
uint8_t Configure_XXXXX (uint8_t linef, uint8_t rate)
 Menu item 'XX'.
uint8_t Configure_XXXXY (uint8_t linef, uint8_t rate)
 Menu item 'XY'.

Data Fields

Callback< void(size_t, uint8_t
*, uint8_t *) 
onSPIprint )
 Function pointer void f(size_t byteCount, uint8_t mosiData[], uint8_t misoData[])
double VRef
 reference voltage, in Volts
uint16_t config
 shadow of register config CMD_0010_0010_d16_Rd08_Configuration
uint8_t status
 shadow of register status CMD_0001_1110_d8_Rd07_Status
int adca
 shadow of register ADCa CMD_0000_0010_d16o8_Rd00_ADCa
int adcb
 shadow of register ADCb CMD_0000_0110_d16o8_Rd01_ADCb
int adcc
 shadow of register ADCc CMD_0000_1010_d16o8_Rd02_ADCc
int adcd
 shadow of register ADCd CMD_0000_1110_d16o8_Rd03_ADCd

Detailed Description

MAX11043 200ksps, Low-Power, Serial SPI 24-Bit, 4-Channel, Differential/Single-Ended Input, Simultaneous-Sampling SD ADC.

Datasheet: https://www.maximintegrated.com/MAX11043

//---------- CODE GENERATOR: helloCppCodeList

 // CODE GENERATOR: example code includes

 // example code includes
 // 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
 #include "MAX11043.h"

 // example code board support
 //MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
 //DigitalOut rLED(LED1);
 //DigitalOut gLED(LED2);
 //DigitalOut bLED(LED3);
 //
 // Arduino "shield" connector port definitions (MAX32625MBED shown)
 #if defined(TARGET_MAX32625MBED)
 #define A0 AIN_0
 #define A1 AIN_1
 #define A2 AIN_2
 #define A3 AIN_3
 #define D0 P0_0
 #define D1 P0_1
 #define D2 P0_2
 #define D3 P0_3
 #define D4 P0_4
 #define D5 P0_5
 #define D6 P0_6
 #define D7 P0_7
 #define D8 P1_4
 #define D9 P1_5
 #define D10 P1_3
 #define D11 P1_1
 #define D12 P1_2
 #define D13 P1_0
 #endif

 // example code declare SPI interface
 #if defined(TARGET_MAX32625MBED)
 // SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13 D10
 // DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: not connected
 // Support SPI hardware-controlled CS instead of GPIO CS (mbed)
 // 2020-02-19 MAX32625MBED GPIO CS envelope is 23us (11.4us before SCLK and 8.6us after SCLK).
 // 2020-02-19 MAX32625MBED SPI controlled CS envelope 4 channel read reduced to 4.2us (24MHz SCLK), 1.2us setup, 0us hold.
 // 2020-02-19 MAX11043 slowest EOC rate is 9us.
 SPI spi(SPI1_MOSI, SPI1_MISO, SPI1_SCK, SPI1_SS); // mosi, miso, sclk spi1 TARGET_MAX32625MBED: P1_1 P1_2 P1_0 Arduino 10-pin header D11 D12 D13 D10
 DigitalOut spi_cs(NC); // TARGET_MAX32625MBED: not connected
 // PinName NC means NOT_CONNECTED; DigitalOut::is_connected() returns false
 // add m_cs_pin.is_connected() guard before writing m_cs_pin = m_SPI_cs_state
 // to avoid runtime error Assertion failed: obj->name != (PinName)NC
 #elif defined(TARGET_MAX32600MBED)
 SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(SPI2_SS); // Generic: Arduino 10-pin header D10
 #else
 SPI spi(D11, D12, D13); // mosi, miso, sclk spi1 TARGET_MAX32600MBED: Arduino 10-pin header D11 D12 D13
 DigitalOut spi_cs(D10); // Generic: Arduino 10-pin header D10
 #endif

 // example code declare GPIO interface pins
 DigitalOut CONVRUN_pin(D9); // Digital Configuration Input to MAX11043 device
 DigitalOut SHDN_pin(D8); // Digital Configuration Input to MAX11043 device
 DigitalOut DACSTEP_pin(D7); // Digital Configuration Input to MAX11043 device
 DigitalOut UP_slash_DWNb_pin(D6); // Digital Configuration Input to MAX11043 device
 DigitalIn EOC_pin(D2); // Digital Event Output from MAX11043 device
 // example code declare device instance
 MAX11043 g_MAX11043_device(spi, spi_cs, CONVRUN_pin, SHDN_pin, DACSTEP_pin, UP_slash_DWNb_pin, EOC_pin, MAX11043::MAX11043_IC);

 // CODE GENERATOR: example code for ADC: serial port declaration
 //--------------------------------------------------
 // Declare the Serial driver
 // default baud rate settings are 9600 8N1
 // install device driver from http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe
 // see docs https://docs.mbed.com/docs/mbed-os-handbook/en/5.5/getting_started/what_need/
 #if defined(TARGET_MAX32630)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 //Serial DAPLINKserial(P2_1, P2_0);     // tx, rx
 //    #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_MAX32625MBED)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 //Serial DAPLINKserial(P2_1, P2_0);     // tx, rx
 //    #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_MAX32600)
     #include "USBSerial.h"
 // Hardware serial port over DAPLink
 // The default baud rate for the DapLink UART is 9600
 Serial DAPLINKserial(P1_1, P1_0);     // tx, rx
     #define HAS_DAPLINK_SERIAL 1
 // Virtual serial port over USB
 // The baud rate does not affect the virtual USBSerial UART.
 USBSerial serial;
 //--------------------------------------------------
 #elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_NUCLEO_F401RE)
 Serial serial(SERIAL_TX, SERIAL_RX);     // tx, rx
 //--------------------------------------------------
 #else
 #if defined(SERIAL_TX)
 #warning "target not previously tested; guess serial pins are SERIAL_TX, SERIAL_RX..."
 Serial serial(SERIAL_TX, SERIAL_RX);     // tx, rx
 #elif defined(USBTX)
 #warning "target not previously tested; guess serial pins are USBTX, USBRX..."
 Serial serial(USBTX, USBRX);     // tx, rx
 #elif defined(UART_TX)
 #warning "target not previously tested; guess serial pins are UART_TX, UART_RX..."
 Serial serial(UART_TX, UART_RX);     // tx, rx
 #else
 #warning "target not previously tested; need to define serial pins..."
 #endif
 #endif
 //
 #include "CmdLine.h"
 CmdLine cmdLine(serial, "serial");

 // example code main function
 int main()
 {
     // CODE GENERATOR: example code: member function Init
     g_MAX11043_device.Init();

     while (1)
     {
         // CODE GENERATOR: example code: has no member function REF
         // CODE GENERATOR: example code for ADC: repeat-forever convert and print conversion result, one record per line
         // CODE GENERATOR: ResolutionBits = 24
         // CODE GENERATOR: FScode = None
         // CODE GENERATOR: NumChannels = 4
         while(1) { // this code repeats forever
             // this code repeats forever
             // CODE GENERATOR: example code: has no member function ScanStandardExternalClock
             // CODE GENERATOR: example code: has no member function ReadAINcode
             // wait(3.0);
             // CODE GENERATOR: print conversion result
             // Use Arduino Serial Plotter to view output: Tools | Serial Plotter
             cmdLine.serial().printf("%d", g_MAX11043_device.AINcode[0]);
             for (int index = 1; index <= channelId_0_3; index++) {
                 cmdLine.serial().printf(",%d", g_MAX11043_device.AINcode[index]);
             }
             cmdLine.serial().printf("\r\n");

         } // this code repeats forever
     }
 }

//---------- CODE GENERATOR: end helloCppCodeList

Definition at line 323 of file MAX11043.h.


Member Typedef Documentation

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh.

CONFIGABCD_xxx1_xxxx_xxxx_xxxx_BDAC3 CONFIGABCD_xxxx_1xxx_xxxx_xxxx_BDAC2 CONFIGABCD_xxxx_x1xx_xxxx_xxxx_BDAC1 CONFIGABCD_xxxx_xx1x_xxxx_xxxx_BDAC0 Sets the input bias voltage for AC-coupled signals when ENBIAS_ is set to 1. ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN

Register Addresses.

Naming convention is CMD_bitstream_WrAddr_FunctionName

  • first byte format is 0aaa_aar0
  • 0 = bitstream required 0 bit
  • aaa_aa = bitstream 5-bit register address field
  • r = bitstream read/write bit (1=read, 0=write)
  • WrAddr = Write operation to address Addr
  • RdAddr = Read operation from address Addr
  • d8 = 8-bit register data field
  • d16 = 16-bit register data field
  • d16o8 = 16-bit or 24-bit register data field
  • d24 = 24-bit register data field
  • d32 = 32-bit register data field
  • x = don't care

Command Operation Format (see function DecodeCommand)

Naming convention is CMDOP_bitstream_OPERATION_NAME

  • 0aaa_aax0 = 5-bit register address field
  • 0xxx_xxr0 = read/write bit (1=read, 0=write)
  • xxxx = don't care

CMD_0010_0000_d16_Wr08_Configuration regAddr=08h Config: EXTCLK CLKDIV1 CLKDIV0 PD PDA PDB PDC PDD PDDAC PDOSC 24BIT SCHANA SCHANB SCHANC SCHAND DECSEL.

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN.

CMD_0100_0000_d16_Wr10_Reference regAddr=10h ReferenceDelay: 0 0 0 PURGE[4:0] EXTREF EXBUFA EXBUFB EXBUFC EXBUFD EXBUFDAC EXBUFDACH EXBUFDACL.

CMD_0001_1110_d8_Rd07_Status regAddr=07h Status: x x FlashBusy BOOT OFLGA OFLGB OFLGC OFLGD.


Member Enumeration Documentation

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh.

CONFIGABCD_xxx1_xxxx_xxxx_xxxx_BDAC3 CONFIGABCD_xxxx_1xxx_xxxx_xxxx_BDAC2 CONFIGABCD_xxxx_x1xx_xxxx_xxxx_BDAC1 CONFIGABCD_xxxx_xx1x_xxxx_xxxx_BDAC0 Sets the input bias voltage for AC-coupled signals when ENBIAS_ is set to 1. ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN

Enumerator:
BDAC_0000_033pctAVDD 

8'b00000000

BDAC_0001_035pctAVDD 

8'b00000001

BDAC_0010_038pctAVDD 

8'b00000010

BDAC_0011_040pctAVDD 

8'b00000011

BDAC_0100_042pctAVDD 

8'b00000100

BDAC_0101_044pctAVDD 

8'b00000101

BDAC_0110_046pctAVDD 

8'b00000110

BDAC_0111_048pctAVDD 

8'b00000111

BDAC_1000_050pctAVDD 

8'b00001000

BDAC_1001_052pctAVDD 

8'b00001001

BDAC_1010_054pctAVDD 

8'b00001010

BDAC_1011_056pctAVDD 

8'b00001011

BDAC_1100_058pctAVDD 

8'b00001100

BDAC_1101_060pctAVDD 

8'b00001101

BDAC_1110_062pctAVDD 

8'b00001110

BDAC_1111_065pctAVDD 

8'b00001111

Definition at line 484 of file MAX11043.h.

Register Addresses.

Naming convention is CMD_bitstream_WrAddr_FunctionName

  • first byte format is 0aaa_aar0
  • 0 = bitstream required 0 bit
  • aaa_aa = bitstream 5-bit register address field
  • r = bitstream read/write bit (1=read, 0=write)
  • WrAddr = Write operation to address Addr
  • RdAddr = Read operation from address Addr
  • d8 = 8-bit register data field
  • d16 = 16-bit register data field
  • d16o8 = 16-bit or 24-bit register data field
  • d24 = 24-bit register data field
  • d32 = 32-bit register data field
  • x = don't care
Enumerator:
CMD_0000_0010_d16o8_Rd00_ADCa 

8'b00000010

CMD_0000_0110_d16o8_Rd01_ADCb 

8'b00000110

CMD_0000_1010_d16o8_Rd02_ADCc 

8'b00001010

CMD_0000_1110_d16o8_Rd03_ADCd 

8'b00001110

CMD_0001_0010_d16o8_d16o8_Rd04_ADCab 

8'b00010010

CMD_0001_0110_d16o8_d16o8_Rd05_ADCcd 

8'b00010110

CMD_0001_1010_d16o8_d16o8_d16o8_d16o8_Rd06_ADCabcd 

8'b00011010

CMD_0001_1110_d8_Rd07_Status 

8'b00011110

CMD_0010_0000_d16_Wr08_Configuration 

8'b00100000

CMD_0010_0010_d16_Rd08_Configuration 

8'b00100010

CMD_0010_0100_d16_Wr09_DAC 

8'b00100100

CMD_0010_0110_d16_Rd09_DAC 

8'b00100110

CMD_0010_1000_d16_Wr0A_DACStep 

8'b00101000

CMD_0010_1010_d16_Rd0A_DACStep 

8'b00101010

CMD_0010_1100_d16_Wr0B_DACHDACL 

8'b00101100

CMD_0010_1110_d16_Rd0B_DACHDACL 

8'b00101110

CMD_0011_0000_d16_Wr0C_ConfigA 

8'b00110000

CMD_0011_0010_d16_Rd0C_ConfigA 

8'b00110010

CMD_0011_0100_d16_Wr0D_ConfigB 

8'b00110100

CMD_0011_0110_d16_Rd0D_ConfigB 

8'b00110110

CMD_0011_1000_d16_Wr0E_ConfigC 

8'b00111000

CMD_0011_1010_d16_Rd0E_ConfigC 

8'b00111010

CMD_0011_1100_d16_Wr0F_ConfigD 

8'b00111100

CMD_0011_1110_d16_Rd0F_ConfigD 

8'b00111110

CMD_0100_0000_d16_Wr10_Reference 

8'b01000000

CMD_0100_0010_d16_Rd10_Reference 

8'b01000010

CMD_0100_0100_d16_Wr11_AGain 

8'b01000100

CMD_0100_0110_d16_Rd11_AGain 

8'b01000110

CMD_0100_1000_d16_Wr12_BGain 

8'b01001000

CMD_0100_1010_d16_Rd12_BGain 

8'b01001010

CMD_0100_1100_d16_Wr13_CGain 

8'b01001100

CMD_0100_1110_d16_Rd13_CGain 

8'b01001110

CMD_0101_0000_d16_Wr14_DGain 

8'b01010000

CMD_0101_0010_d16_Rd14_DGain 

8'b01010010

CMD_0101_0100_d8_Wr15_FilterCAddress 

8'b01010100

CMD_0101_0110_d8_Rd15_FilterCAddress 

8'b01010110

CMD_0101_1000_d32_Wr16_FilterCDataOut 

8'b01011000

CMD_0101_1010_d32_Rd16_FilterCDataOut 

8'b01011010

CMD_0101_1100_d32_Wr17_FilterCDataIn 

8'b01011100

CMD_0101_1110_d32_Rd17_FilterCDataIn 

8'b01011110

CMD_0110_0000_d8_Wr18_FlashMode 

8'b01100000

CMD_0110_0010_d8_Rd18_FlashMode 

8'b01100010

CMD_0110_0100_d16_Wr19_FlashAddr 

8'b01100100

CMD_0110_0110_d16_Rd19_FlashAddr 

8'b01100110

CMD_0110_1000_d16_Wr1A_FlashDataIn 

8'b01101000

CMD_0110_1010_d16_Rd1A_FlashDataIn 

8'b01101010

CMD_0110_1110_d16_Rd1B_FlashDataOut 

8'b01101110

Definition at line 357 of file MAX11043.h.

Command Operation Format (see function DecodeCommand)

Naming convention is CMDOP_bitstream_OPERATION_NAME

  • 0aaa_aax0 = 5-bit register address field
  • 0xxx_xxr0 = read/write bit (1=read, 0=write)
  • xxxx = don't care
Enumerator:
CMDOP_0aaa_aa00_WriteRegister 

8'b00000000

CMDOP_0aaa_aa10_ReadRegister 

8'b00000010

CMDOP_1111_1111_NoOperationMOSIidleHigh 

8'b11111111

Definition at line 334 of file MAX11043.h.

CMD_0010_0000_d16_Wr08_Configuration regAddr=08h Config: EXTCLK CLKDIV1 CLKDIV0 PD PDA PDB PDC PDD PDDAC PDOSC 24BIT SCHANA SCHANB SCHANC SCHAND DECSEL.

Enumerator:
CONFIG_xxxx_xxxx_xxxx_xxx1_DECSEL12 

16'b0000000000000001

CONFIG_xxxx_xxxx_xxxx_xx1x_SCHAND 

16'b0000000000000010

CONFIG_xxxx_xxxx_xxxx_x1xx_SCHANC 

16'b0000000000000100

CONFIG_xxxx_xxxx_xxxx_1xxx_SCHANB 

16'b0000000000001000

CONFIG_xxxx_xxxx_xxx1_xxxx_SCHANA 

16'b0000000000010000

CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT 

16'b0000000000100000

CONFIG_xxxx_xxxx_x1xx_xxxx_PDOSC 

16'b0000000001000000

CONFIG_xxxx_xxxx_1xxx_xxxx_PDDAC 

16'b0000000010000000

CONFIG_xxxx_xxx1_xxxx_xxxx_PDD 

16'b0000000100000000

CONFIG_xxxx_xx1x_xxxx_xxxx_PDC 

16'b0000001000000000

CONFIG_xxxx_x1xx_xxxx_xxxx_PDB 

16'b0000010000000000

CONFIG_xxxx_1xxx_xxxx_xxxx_PDA 

16'b0000100000000000

CONFIG_xxx1_xxxx_xxxx_xxxx_PD 

16'b0001000000000000

CONFIG_xx1x_xxxx_xxxx_xxxx_CLKDIV0 

16'b0010000000000000

CONFIG_x1xx_xxxx_xxxx_xxxx_CLKDIV1 

16'b0100000000000000

CONFIG_1xxx_xxxx_xxxx_xxxx_EXTCLK 

16'b1000000000000000

Definition at line 426 of file MAX11043.h.

CMD_0011_0000_d16_Wr0C_ConfigA regAddr=0Ch CMD_0011_0100_d16_Wr0D_ConfigB regAddr=0Dh CMD_0011_1000_d16_Wr0E_ConfigC regAddr=0Eh CMD_0011_1100_d16_Wr0F_ConfigD regAddr=0Fh ConfigABCD: x x x BDAC[3:0] DIFF EQ MODG[1:0] PDPGA FILT PGAG ENBIASP ENBIASN.

Enumerator:
CONFIGABCD_xxxx_xxxx_xxxx_xxx1_ENBIASN 

16'b0000000000000001

CONFIGABCD_xxxx_xxxx_xxxx_xx1x_ENBIASP 

16'b0000000000000010

CONFIGABCD_xxxx_xxxx_xxxx_x1xx_PGAG16 

16'b0000000000000100

CONFIGABCD_xxxx_xxxx_xxxx_1xxx_FILTLP 

16'b0000000000001000

CONFIGABCD_xxxx_xxxx_xxx1_xxxx_PDPGA 

16'b0000000000010000

CONFIGABCD_xxxx_xxxx_xx1x_xxxx_MODG0 

16'b0000000000100000

CONFIGABCD_xxxx_xxxx_x1xx_xxxx_MODG1 

16'b0000000001000000

CONFIGABCD_xxxx_xxxx_1xxx_xxxx_EQ 

16'b0000000010000000

CONFIGABCD_xxxx_xxx1_xxxx_xxxx_DIFF 

16'b0000000100000000

CONFIGABCD_xxxx_xx1x_xxxx_xxxx_BDAC0 

16'b0000001000000000

CONFIGABCD_xxxx_x1xx_xxxx_xxxx_BDAC1 

16'b0000010000000000

CONFIGABCD_xxxx_1xxx_xxxx_xxxx_BDAC2 

16'b0000100000000000

CONFIGABCD_xxx1_xxxx_xxxx_xxxx_BDAC3 

16'b0001000000000000

CONFIGABCD_xx1x_xxxx_xxxx_xxxx_RESERVED 

16'b0010000000000000

CONFIGABCD_x1xx_xxxx_xxxx_xxxx_RESERVED 

16'b0100000000000000

CONFIGABCD_1xxx_xxxx_xxxx_xxxx_RESERVED 

16'b1000000000000000

Definition at line 452 of file MAX11043.h.

IC's supported with this driver.

MAX11043

Definition at line 531 of file MAX11043.h.

CMD_0100_0000_d16_Wr10_Reference regAddr=10h ReferenceDelay: 0 0 0 PURGE[4:0] EXTREF EXBUFA EXBUFB EXBUFC EXBUFD EXBUFDAC EXBUFDACH EXBUFDACL.

Enumerator:
REFERENCE_xxxx_xxxx_xxxx_xxx1_EXBUFDACL 

16'b0000000000000001

REFERENCE_xxxx_xxxx_xxxx_xx1x_EXBUFDACH 

16'b0000000000000010

REFERENCE_xxxx_xxxx_xxxx_x1xx_EXBUFDAC 

16'b0000000000000100

REFERENCE_xxxx_xxxx_xxxx_1xxx_EXBUFD 

16'b0000000000001000

REFERENCE_xxxx_xxxx_xxx1_xxxx_EXBUFC 

16'b0000000000010000

REFERENCE_xxxx_xxxx_xx1x_xxxx_EXBUFB 

16'b0000000000100000

REFERENCE_xxxx_xxxx_x1xx_xxxx_EXBUFA 

16'b0000000001000000

REFERENCE_xxxx_xxxx_1xxx_xxxx_EXTREF 

16'b0000000010000000

REFERENCE_xxxx_xxx1_xxxx_xxxx_PURGE0 

16'b0000000100000000

REFERENCE_xxxx_xx1x_xxxx_xxxx_PURGE1 

16'b0000001000000000

REFERENCE_xxxx_x1xx_xxxx_xxxx_PURGE2 

16'b0000010000000000

REFERENCE_xxxx_1xxx_xxxx_xxxx_PURGE3 

16'b0000100000000000

REFERENCE_xxx1_xxxx_xxxx_xxxx_PURGE4 

16'b0001000000000000

REFERENCE_xx1x_xxxx_xxxx_xxxx_RESERVED 

16'b0010000000000000

REFERENCE_x1xx_xxxx_xxxx_xxxx_RESERVED 

16'b0100000000000000

REFERENCE_1xxx_xxxx_xxxx_xxxx_RESERVED 

16'b1000000000000000

Definition at line 507 of file MAX11043.h.

CMD_0001_1110_d8_Rd07_Status regAddr=07h Status: x x FlashBusy BOOT OFLGA OFLGB OFLGC OFLGD.

Enumerator:
STATUS_xxxx_xxx1_OverflowFlagOFLGD 

8'b00000001

STATUS_xxxx_xx1x_OverflowFlagOFLGC 

8'b00000010

STATUS_xxxx_x1xx_OverflowFlagOFLGB 

8'b00000100

STATUS_xxxx_1xxx_OverflowFlagOFLGA 

8'b00001000

STATUS_xxx1_xxxx_PowerOnResetBOOT 

8'b00010000

STATUS_xx1x_xxxx_FlashBusy 

8'b00100000

STATUS_x1xx_xxxx_RESERVED 

8'b01000000

STATUS_1xxx_xxxx_RESERVED 

8'b10000000

Definition at line 411 of file MAX11043.h.


Constructor & Destructor Documentation

MAX11043 ( SPI &  spi,
DigitalOut &  cs_pin,
DigitalOut &  CONVRUN_pin,
DigitalOut &  SHDN_pin,
DigitalOut &  DACSTEP_pin,
DigitalOut &  UP_slash_DWNb_pin,
#if MAX11043_EOC_INTERRUPT_POLLING DigitalIn &  EOC_pin,
#else InterruptIn &  EOC_pin,
#endif MAX11043_ic_t  ic_variant 
)

Constructor for MAX11043 Class.

Requires an existing SPI object as well as a DigitalOut object. The DigitalOut object is used for a chip enable signal

On Entry:

Parameters:
[in]spi- pointer to existing SPI object
[in]cs_pin- pointer to a DigitalOut pin object CODE GENERATOR: class constructor docstrings gpio InputPin pins
[in]CONVRUN_pin- pointer to a DigitalOut pin object
[in]SHDN_pin- pointer to a DigitalOut pin object
[in]DACSTEP_pin- pointer to a DigitalOut pin object
[in]UP_slash_DWNb_pin- pointer to a DigitalOut pin object CODE GENERATOR: class constructor docstrings gpio OutputPin pins
[in]EOC_pin- pointer to a DigitalIn pin object
[in]ic_variant- which type of MAX11043 is used

On Exit:

Returns:
None

Definition at line 164 of file MAX11043.cpp.


Member Function Documentation

double ADCVoltageOfCode_16bit ( uint32_t  value_u16 )

Return the physical voltage corresponding to conversion result (conversion format is Bipolar mode, 2's complement) Does not perform any offset or gain correction.

Precondition:
CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 0: 16-bit mode is configured
g_MAX11043_device.VRef = Voltage of REF input, in Volts
Parameters:
[in]value_u24,:raw 24-bit MAX11043 code (right justified).
Returns:
physical voltage corresponding to MAX11043 code.

Definition at line 814 of file MAX11043.cpp.

double ADCVoltageOfCode_24bit ( uint32_t  value_u24 )

Return the physical voltage corresponding to conversion result (conversion format is Bipolar mode, 2's complement) Does not perform any offset or gain correction.

Precondition:
CONFIG_xxxx_xxxx_xx1x_xxxx_24BIT is 1: 24-bit mode is configured
g_MAX11043_device.VRef = Voltage of REF input, in Volts
Parameters:
[in]value_u24,:raw 24-bit MAX11043 code (right justified).
Returns:
physical voltage corresponding to MAX11043 code.

Definition at line 864 of file MAX11043.cpp.

void Configure_Demo ( void   )

Menu item 'XD' Example configuration.

Slowest conversion rate 1:6 = 9us, Bypass PGA and filters, Gain=1V/V, AOUT = 2.0V

Definition at line 1683 of file MAX11043.cpp.

uint8_t Configure_XXXXX ( uint8_t  linef,
uint8_t  rate 
)

Menu item 'XX'.

Returns:
1 on success; 0 on failure

Definition at line 1743 of file MAX11043.cpp.

uint8_t Configure_XXXXY ( uint8_t  linef,
uint8_t  rate 
)

Menu item 'XY'.

Returns:
1 on success; 0 on failure

Definition at line 1763 of file MAX11043.cpp.

MAX11043::MAX11043_CMDOP_enum_t DecodeCommand ( MAX11043_CMD_enum_t  commandByte )

Decode operation from commandByte.

Returns:
operation such as idle, read register, write register, etc.

Definition at line 1477 of file MAX11043.cpp.

int get_spi_dataMode (  ) const

get SPI mode

Definition at line 607 of file MAX11043.h.

int get_spi_frequency (  ) const

get SPI SCLK frequency

Definition at line 603 of file MAX11043.h.

uint8_t Init ( void   )

Menu item '!' Initialize device.

Returns:
1 on success; 0 on failure

Definition at line 705 of file MAX11043.cpp.

uint8_t IsRegReadCommand ( MAX11043_CMD_enum_t  commandByte )

Test whether a command byte is a register read command.

Returns:
true if command byte is a register read command

Definition at line 1509 of file MAX11043.cpp.

uint8_t Read_ADCabcd ( void   )

Menu item '$' -> adca, adcb, adcc, adcd Read ADCabcd.

Returns:
1 on success; 0 on failure

Definition at line 1589 of file MAX11043.cpp.

uint8_t RegAddrOfCommand ( MAX11043_CMD_enum_t  commandByte )

Return the address field of a MAX11043 register.

Returns:
register address field as given in datasheet

Definition at line 1497 of file MAX11043.cpp.

const char * RegName ( MAX11043_CMD_enum_t  commandByte )

Return the name of a MAX11043 register.

Returns:
null-terminated constant C string containing register name or empty string

Definition at line 1521 of file MAX11043.cpp.

uint8_t RegRead ( MAX11043_CMD_enum_t  commandByte,
uint32_t *  ptrRegData 
)

Read an 8-bit MAX11043 register.

CMDOP_1aaa_aaaa_ReadRegister bit is set 1 indicating a read operation.

MAX11043 register length can be determined by function RegSize.

For 8-bit register size:

SPI 16-bit transfer

SPI MOSI = 1aaa_aaaa_0000_0000

SPI MISO = xxxx_xxxx_dddd_dddd

For 16-bit register size:

SPI 24-bit or 32-bit transfer

SPI MOSI = 1aaa_aaaa_0000_0000_0000_0000

SPI MISO = xxxx_xxxx_dddd_dddd_dddd_dddd

For 24-bit register size:

SPI 32-bit transfer

SPI MOSI = 1aaa_aaaa_0000_0000_0000_0000_0000_0000

SPI MISO = xxxx_xxxx_dddd_dddd_dddd_dddd_dddd_dddd

Returns:
1 on success; 0 on failure

Definition at line 1047 of file MAX11043.cpp.

uint8_t RegSize ( MAX11043_CMD_enum_t  commandByte )

Return the size of a MAX11043 register.

Returns:
8 for 8-bit, 16 for 16-bit, 24 for 24-bit, else 0 for undefined register size

Definition at line 1377 of file MAX11043.cpp.

uint8_t RegWrite ( MAX11043_CMD_enum_t  commandByte,
uint32_t  regData 
)

Write a MAX11043 register.

CMDOP_1aaa_aaaa_ReadRegister bit is cleared 0 indicating a write operation.

MAX11043 register length can be determined by function RegSize.

For 8-bit register size:

SPI 16-bit transfer

SPI MOSI = 0aaa_aaaa_dddd_dddd

SPI MISO = xxxx_xxxx_xxxx_xxxx

For 16-bit register size:

SPI 24-bit or 32-bit transfer

SPI MOSI = 0aaa_aaaa_dddd_dddd_dddd_dddd

SPI MISO = xxxx_xxxx_xxxx_xxxx_xxxx_xxxx

For 24-bit register size:

SPI 32-bit transfer

SPI MOSI = 0aaa_aaaa_dddd_dddd_dddd_dddd_dddd_dddd

SPI MISO = xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx

Returns:
1 on success; 0 on failure

Definition at line 913 of file MAX11043.cpp.

void spi_frequency ( int  spi_sclk_Hz )

set SPI SCLK frequency

Definition at line 506 of file MAX11043.cpp.

uint8_t Write_AGain ( uint32_t  gain )

Menu item 'GA' Write AGain register.

Parameters:
[in]gain2's complement, 0x800=0.25V/V, 0x1000=0.5V/V, 0x2000=1V/V, 0x4000=2V/V, default=0x2000
Returns:
1 on success; 0 on failure

Definition at line 1660 of file MAX11043.cpp.


Field Documentation

int adca

shadow of register ADCa CMD_0000_0010_d16o8_Rd00_ADCa

Definition at line 623 of file MAX11043.h.

int adcb

shadow of register ADCb CMD_0000_0110_d16o8_Rd01_ADCb

Definition at line 626 of file MAX11043.h.

int adcc

shadow of register ADCc CMD_0000_1010_d16o8_Rd02_ADCc

Definition at line 629 of file MAX11043.h.

int adcd

shadow of register ADCd CMD_0000_1110_d16o8_Rd03_ADCd

Definition at line 632 of file MAX11043.h.

uint16_t config

shadow of register config CMD_0010_0010_d16_Rd08_Configuration

Definition at line 617 of file MAX11043.h.

Callback<void(size_t, uint8_t*, uint8_t*) onSPIprint)

Function pointer void f(size_t byteCount, uint8_t mosiData[], uint8_t misoData[])

optional onSPIprint SPI diagnostic function

Definition at line 595 of file MAX11043.h.

uint8_t status

shadow of register status CMD_0001_1110_d8_Rd07_Status

Definition at line 620 of file MAX11043.h.

double VRef

reference voltage, in Volts

Definition at line 614 of file MAX11043.h.