Example host software for the Maxim Integrated DS4424/DS4422 I2C Sink/Source Current DAC. Hosted on the MAX32630FTHR.

Dependencies:   max32630fthr DS4424_SINK_SOURCE_CURRENT_DAC_INPUT_OUTPUT_DAC USBDevice

Files at this revision

API Documentation at this revision

Comitter:
phonemacro
Date:
Thu Sep 06 21:43:55 2018 +0000
Parent:
1:a7990c969d1a
Child:
3:dd7271a8cf09
Commit message:
Updated method names to comply with Mbed coding style.

Changed in this revision

DS4424.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/DS4424.lib	Sat May 12 03:59:43 2018 +0000
+++ b/DS4424.lib	Thu Sep 06 21:43:55 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/MaximIntegrated/code/DS4424_SINK_SOURCE_CURRENT_DAC/#cead66dd3647
+https://os.mbed.com/teams/MaximIntegrated/code/DS4424_SINK_SOURCE_CURRENT_DAC/#c40703da0faf
--- a/main.cpp	Sat May 12 03:59:43 2018 +0000
+++ b/main.cpp	Thu Sep 06 21:43:55 2018 +0000
@@ -48,6 +48,21 @@
     
 // main() runs in its own thread in the OS
 // (note the calls to Thread::wait below for delays)
+/**
+* @brief Sample main program for Maxim Integrated DS4424, DS4422
+* @version 1.0000.2
+*
+* @details Sample main program for DS4424, DS4422
+* The prints are sent to the terminal window (9600, 8n1).
+* The program sets the output DAC registers to various values.
+* These registers are then read back and printed out.
+* The program then blinks the blue-green LED.
+* To run the program, drag and drop the .bin file into the 
+* DAPLINK folder. After it finishes flashing, cycle the power or 
+* reset the Pegasus (MAX32630FTHR) after flashing by pressing the button on
+* the Pegasus next to the battery connector or the button
+* on the MAXREFDES100HDK.
+*/
 int main()
 {
     int32_t value[4]={0,0,0,0};
@@ -64,15 +79,15 @@
     i2cBus.frequency(400000);
 
     // read each channel
-    ret = ds4424_dac.writeRaw(127, DS4424::REG_OUT0); 
-    ret = ds4424_dac.writeRaw(2, DS4424::REG_OUT1); 
-    ret = ds4424_dac.writeRaw(-127, DS4424::REG_OUT2); 
-    ret = ds4424_dac.writeRaw(-2, DS4424::REG_OUT3); 
+    ret = ds4424_dac.write_raw(127, DS4424::REG_OUT0); 
+    ret = ds4424_dac.write_raw(2, DS4424::REG_OUT1); 
+    ret = ds4424_dac.write_raw(-127, DS4424::REG_OUT2); 
+    ret = ds4424_dac.write_raw(-2, DS4424::REG_OUT3); 
 
-    ret = ds4424_dac.readRaw(value[0], DS4424::REG_OUT0); 
-    ret = ds4424_dac.readRaw(value[1], DS4424::REG_OUT1); 
-    ret = ds4424_dac.readRaw(value[2], DS4424::REG_OUT2); 
-    ret = ds4424_dac.readRaw(value[3], DS4424::REG_OUT3); 
+    ret = ds4424_dac.read_raw(value[0], DS4424::REG_OUT0); 
+    ret = ds4424_dac.read_raw(value[1], DS4424::REG_OUT1); 
+    ret = ds4424_dac.read_raw(value[2], DS4424::REG_OUT2); 
+    ret = ds4424_dac.read_raw(value[3], DS4424::REG_OUT3); 
     for (i = 0; i < 4; i++) {
         printf("Out%d = %d\r\n", i, value[i]);
     }