Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: max32630fthr DS4424_SINK_SOURCE_CURRENT_DAC_INPUT_OUTPUT_DAC USBDevice
Diff: main.cpp
- Revision:
- 2:07fde4ba8e91
- Parent:
- 1:a7990c969d1a
- Child:
- 4:51c1a4c4f762
--- 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]);
}