Maxim Integrated 7-bit Sink/Source Current DAC. DS4424, DS4422 input/output current Digital-to-Analog Converter Driver/library code.

Dependents:   DS4424_Hello_Current_DAC_on_MAX32630FTHR

Revision:
1:a5d963a3c298
Parent:
0:8002303900e6
Child:
2:b7a81b724561
diff -r 8002303900e6 -r a5d963a3c298 DS4424.h
--- a/DS4424.h	Tue Jul 03 20:09:09 2018 +0000
+++ b/DS4424.h	Mon Sep 10 21:53:18 2018 +0000
@@ -31,7 +31,7 @@
 * ownership rights.
 *******************************************************************************
 */
-#ifndef DS4424_H
+ #ifndef DS4424_H
 #define DS4424_H
  
 #include "mbed.h"
@@ -47,35 +47,36 @@
 #define DS4424_SINK_I       0
 
 /**
- * @brief DS4424 Four/two Channel I2C Sink/Source Current DAC
- * @details The DS4424/DS422 contains four/two I2C
- * programmable current DACs. This driver enables
- * the writing of source/since values to the channel
- * registers.
- * <br>https://www.maximintegrated.com/en/products/analog/data-converters/digital-to-analog-converters/DS4424.html
- *  @version 1.0000.0
- * @code 
- * #include "mbed.h"
- * #include "DS4424.h"
- * #include "max32630fthr.h"
- * MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
- * I2C i2cBus(P3_4, P3_5);
- * DS4424 ds4424_dac(i2cBus, DS4424::DS4424_I2C_SLAVE_ADRS0, DS4424::DS4424_IC);
+* @brief Four/two Channel I2C Sink/Source Current DAC
+* @version 1.0000.2
+*
+* @details The DS4424/DS422 contains four/two I2C
+* programmable current DACs. This driver enables
+* the writing of source/since values to the channel
+* registers.
+*
+* @code 
+* #include "mbed.h"
+* #include "DS4424.h"
+* #include "max32630fthr.h"
+* MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
+* I2C i2cBus(P3_4, P3_5);
+* DS4424 ds4424_dac(i2cBus, DS4424::DS4424_I2C_SLAVE_ADRS0, DS4424::DS4424_IC);
     
- * int main()
- * {
- *    int32_t value[4]={0,0,0,0};
- *    int ret;
- *    
- *    i2cBus.frequency(400000);
- *
- *    // read channel 0 register
- *    ret = ds4424_dac.readRaw(value[0], DS4424::REG_OUT0); 
- *
- *      //... rest of application
- * }
- * @endcode
- */
+* int main()
+* {
+*    int32_t value[4]={0,0,0,0};
+*    int ret;
+*    
+*    i2cBus.frequency(400000);
+*
+*    // read channel 0 register
+*    ret = ds4424_dac.read_raw(value[0], DS4424::REG_OUT0); 
+*
+*      //... rest of application
+* }
+* @endcode
+*/
 
 class DS4424
 {
@@ -156,7 +157,7 @@
     * @param chan_addr - Channel 0 to 3
     * @return 0 on success, non-zero on failure
     */
-    int readRaw(int32_t &result, ChannelRegAddr_e chan_addr);
+    int read_raw(int32_t &result, ChannelRegAddr_e chan_addr);
     
  /** 
     * @brief Write raw value to a channel.
@@ -164,7 +165,7 @@
     * @param chan_addr - Channel 0 to 3
     * @return 0 on success, non-zero on failure
     */
-    int writeRaw(int32_t value, ChannelRegAddr_e chan_addr);
+    int write_raw(int32_t value, ChannelRegAddr_e chan_addr);
 
 protected:
 
@@ -174,7 +175,7 @@
     * @param[out] value - Read data on success
     * @return 0 on success, non-zero on failure
     */
-    int readRegister(ChannelRegAddr_e reg, uint8_t &value);
+    int read_register(ChannelRegAddr_e reg, uint8_t &value);
 
     /** 
     * @brief Write register of device at slave address
@@ -182,7 +183,7 @@
     * @param value - Value to write
     * @return 0 on success, non-zero on failure
     */
-    int writeRegister(ChannelRegAddr_e reg, uint8_t value);
+    int write_register(ChannelRegAddr_e reg, uint8_t value);
  
 private:
     /// I2C object