Maxim Integrated / Mbed OS MAX5715BOB_12bit_4ch_SPI_DAC

Dependencies:   MAX5715

Files at this revision

API Documentation at this revision

Comitter:
whismanoid
Date:
Fri Sep 27 10:41:44 2019 +0000
Parent:
13:9fdbd02b6e46
Child:
15:05fcfe4a910d
Commit message:
clean up diagnostic messages

Changed in this revision

Hello_MAX5715.cpp Show annotated file Show diff for this revision Revisions of this file
MAX5715.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
diff -r 9fdbd02b6e46 -r fb5b0ac0426e Hello_MAX5715.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Hello_MAX5715.cpp	Fri Sep 27 10:41:44 2019 +0000
@@ -0,0 +1,153 @@
+// /*******************************************************************************
+// * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
+// *
+// * Permission is hereby granted, free of charge, to any person obtaining a
+// * copy of this software and associated documentation files (the "Software"),
+// * to deal in the Software without restriction, including without limitation
+// * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// * and/or sell copies of the Software, and to permit persons to whom the
+// * Software is furnished to do so, subject to the following conditions:
+// *
+// * The above copyright notice and this permission notice shall be included
+// * in all copies or substantial portions of the Software.
+// *
+// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
+// * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+// * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// * OTHER DEALINGS IN THE SOFTWARE.
+// *
+// * Except as contained in this notice, the name of Maxim Integrated
+// * Products, Inc. shall not be used except as stated in the Maxim Integrated
+// * Products, Inc. Branding Policy.
+// *
+// * The mere transfer of this software does not imply any licenses
+// * of trade secrets, proprietary technology, copyrights, patents,
+// * trademarks, maskwork rights, or any other form of intellectual
+// * property whatsoever. Maxim Integrated Products, Inc. retains all
+// * ownership rights.
+// *******************************************************************************
+// */
+// 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 "MAX5715.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
+DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
+#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 LDACb_pin(D9); // Digital Trigger Input to MAX5715 device
+DigitalOut CLRb_pin(D8); // Digital Trigger Input to MAX5715 device
+// AnalogOut REF_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX5715 device
+// AnalogIn OUTA_pin(A0); // Analog Output from MAX5715 device
+// AnalogIn OUTB_pin(A1); // Analog Output from MAX5715 device
+// AnalogIn OUTC_pin(A2); // Analog Output from MAX5715 device
+// AnalogIn OUTD_pin(A3); // Analog Output from MAX5715 device
+// DigitalIn RDYb_pin(Px_x_PortName_To_Be_Determined); // Digital MAX5715 Output from MAX5715 device
+// example code declare device instance
+MAX5715 g_MAX5715_device(spi, spi_cs, LDACb_pin, CLRb_pin, MAX5715::MAX5715_IC);
+
+// example code main function
+int main()
+{
+    while (1)
+    {
+        g_MAX5715_device.Init();
+
+        g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V500);
+
+        uint16_t ch;
+        uint16_t code;
+        //
+        ch = 0;
+        code = 0x0ccc; // 80.0% of full scale REF(2.50V) = 2.00V
+        g_MAX5715_device.CODEnLOADn(ch, code);
+        //
+        ch = 1;
+        code = 0x07ff; // 50.0% of full scale REF(2.50V) = 1.25V
+        g_MAX5715_device.CODEnLOADn(ch, code);
+        //
+        ch = 2;
+        code = 0x0666; // 40.0% of full scale REF(2.50V) = 1.00V
+        g_MAX5715_device.CODEnLOADn(ch, code);
+        //
+        ch = 3;
+        code = 0x0fff; // 100.0% of full scale REF(2.50V) = 2.50V
+        g_MAX5715_device.CODEnLOADn(ch, code);
+
+        wait(3.0);
+    }
+}
diff -r 9fdbd02b6e46 -r fb5b0ac0426e MAX5715.lib
--- a/MAX5715.lib	Sun Aug 04 01:47:56 2019 -0700
+++ b/MAX5715.lib	Fri Sep 27 10:41:44 2019 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/MaximIntegrated/code/MAX5715/#9d395fe10dbe
+https://os.mbed.com/teams/MaximIntegrated/code/MAX5715/#7894decf9375
diff -r 9fdbd02b6e46 -r fb5b0ac0426e main.cpp
--- a/main.cpp	Sun Aug 04 01:47:56 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-// /*******************************************************************************
-// * Copyright (C) 2019 Maxim Integrated Products, Inc., All Rights Reserved.
-// *
-// * Permission is hereby granted, free of charge, to any person obtaining a
-// * copy of this software and associated documentation files (the "Software"),
-// * to deal in the Software without restriction, including without limitation
-// * the rights to use, copy, modify, merge, publish, distribute, sublicense,
-// * and/or sell copies of the Software, and to permit persons to whom the
-// * Software is furnished to do so, subject to the following conditions:
-// *
-// * The above copyright notice and this permission notice shall be included
-// * in all copies or substantial portions of the Software.
-// *
-// * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-// * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
-// * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-// * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// * OTHER DEALINGS IN THE SOFTWARE.
-// *
-// * Except as contained in this notice, the name of Maxim Integrated
-// * Products, Inc. shall not be used except as stated in the Maxim Integrated
-// * Products, Inc. Branding Policy.
-// *
-// * The mere transfer of this software does not imply any licenses
-// * of trade secrets, proprietary technology, copyrights, patents,
-// * trademarks, maskwork rights, or any other form of intellectual
-// * property whatsoever. Maxim Integrated Products, Inc. retains all
-// * ownership rights.
-// *******************************************************************************
-// */
-// CODE GENERATOR: example code includes
-// example code includes
-// standard include for target platform
-#include "mbed.h"
-//#include "max32625.h"
-#include "MAX5715.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
-DigitalOut spi_cs(SPI1_SS); // TARGET_MAX32625MBED: P1_3 Arduino 10-pin header D10
-#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 LDACb_pin(D9); // Digital Trigger Input to MAX5715 device
-DigitalOut CLRb_pin(D8); // Digital Trigger Input to MAX5715 device
-// AnalogOut REF_pin(Px_x_PortName_To_Be_Determined); // Reference Input to MAX5715 device
-// AnalogIn OUTA_pin(A0); // Analog Output from MAX5715 device
-// AnalogIn OUTB_pin(A1); // Analog Output from MAX5715 device
-// AnalogIn OUTC_pin(A2); // Analog Output from MAX5715 device
-// AnalogIn OUTD_pin(A3); // Analog Output from MAX5715 device
-// DigitalIn RDYb_pin(Px_x_PortName_To_Be_Determined); // Digital MAX5715 Output from MAX5715 device
-// example code declare device instance
-MAX5715 g_MAX5715_device(spi, spi_cs, LDACb_pin, CLRb_pin, MAX5715::MAX5715_IC);
-
-// example code main function
-int main()
-{
-    while (1)
-    {
-        // CODE GENERATOR: example code: member function Init
-        g_MAX5715_device.Init();
-
-        // CODE GENERATOR: example code: member function REF
-        // CODE GENERATOR: example code: device has enumType 'MAX5715_REF_enum_t'
-        // CODE GENERATOR: TypedefEnum_MAXxxxxx_REF_enum_t_NamesList: REF_EXT, REF_2V500, REF_2V048, REF_4V096, REF_AlwaysOn_EXT, REF_AlwaysOn_2V500, REF_AlwaysOn_2V048, REF_AlwaysOn_4V096
-        g_MAX5715_device.REF(MAX5715::REF_AlwaysOn_2V500);
-
-        // CODE GENERATOR: example code: has no member function CODE_LOAD
-        // CODE GENERATOR: example code: member function CODEallLOADall
-        //uint16_t code = 4095;
-        //g_MAX5715_device.CODEallLOADall(code);
-
-        // CODE GENERATOR: example code: member function CODEnLOADn
-        uint16_t ch;
-        uint16_t code;
-        //
-        ch = 0;
-        code = 0x0ccc; // 80.0% 2.00V (REF=2.50V)
-        g_MAX5715_device.CODEnLOADn(ch, code);
-        //
-        ch = 1;
-        code = 0x07ff; // 50.0% 1.25V (REF=2.50V)
-        g_MAX5715_device.CODEnLOADn(ch, code);
-        //
-        ch = 2;
-        code = 0x0666; // 40.0% 1.00V (REF=2.50V)
-        g_MAX5715_device.CODEnLOADn(ch, code);
-        //
-        ch = 3;
-        code = 0x0fff; // 100.0% 2.50V (REF=2.50V)
-        g_MAX5715_device.CODEnLOADn(ch, code);
-
-        // CODE GENERATOR: example code: has no member function ScanManual
-        // CODE GENERATOR: example code: has no member function ReadAINcode
-        wait(3.0);
-    }
-}