Maxim Integrated MAX11131 SPI 12-bit 16-channel ADC with SampleSet
Dependents: MAX11131BOB_Tester MAX11131BOB_12bit_16ch_SampleSet_SPI_ADC MAX11131BOB_Serial_Tester
Diff: MAX11131.h
- Revision:
- 8:2171c1889a84
- Parent:
- 6:cb7bdeb185d0
- Child:
- 9:8d47cb713984
--- a/MAX11131.h Fri Sep 27 21:14:38 2019 -0700 +++ b/MAX11131.h Wed Oct 30 15:36:07 2019 -0700 @@ -1128,6 +1128,62 @@ * // example code declare device instance * MAX11131 g_MAX11131_device(spi, spi_cs, CNVST_pin, EOC_pin, MAX11131::MAX11131_IC); * + * //-------------------------------------------------- + * // 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() * { @@ -1153,13 +1209,13 @@ * // @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"); + * cmdLine.serial().printf("\r\n"); * * } // this code repeats forever * }