Maxim Integrated / DS4424_SINK_SOURCE_CURRENT_DAC

Files at this revision

API Documentation at this revision

Comitter:
phonemacro
Date:
Thu Sep 06 21:43:36 2018 +0000
Parent:
2:cead66dd3647
Commit message:
Updated method names to comply with Mbed coding style.; Corrected online API documentation (Doxygen) not being generated.

Changed in this revision

DS4424.cpp Show annotated file Show diff for this revision Revisions of this file
DS4424.h Show annotated file Show diff for this revision Revisions of this file
--- a/DS4424.cpp	Fri May 11 23:58:29 2018 +0000
+++ b/DS4424.cpp	Thu Sep 06 21:43:36 2018 +0000
@@ -79,14 +79,14 @@
  
  
 //******************************************************************************
-int DS4424::readRaw(int32_t &result, ChannelRegAddr_e chan_addr) 
+int DS4424::read_raw(int32_t &result, ChannelRegAddr_e chan_addr) 
 {
     uint8_t value;
     int ret = DS4424_ERROR;
     union ds4424_raw_data raw;
     
     if (chan_addr >= REG_OUT0 && chan_addr <=  m_max_ch_reg_addr)
-        ret = readRegister(chan_addr, value);
+        ret = read_register(chan_addr, value);
     if (ret != 0)
         return DS4424_ERROR;
     
@@ -101,7 +101,7 @@
 
 
 //******************************************************************************
-int DS4424::writeRaw(int32_t value, ChannelRegAddr_e chan_addr) 
+int DS4424::write_raw(int32_t value, ChannelRegAddr_e chan_addr) 
 {
     #define U8_MAX     ((uint8_t)~0U)
     #define S8_MAX     ((int8_t)(U8_MAX>>1))
@@ -118,7 +118,7 @@
             raw.source_bit = DS4424_SINK_I;
             raw.dx = -value;
         }
-        ret = writeRegister(chan_addr, raw.bits);
+        ret = write_register(chan_addr, raw.bits);
  
         if (ret != 0)
             return DS4424_ERROR;
@@ -130,7 +130,7 @@
 
  
 //******************************************************************************
-int DS4424::readRegister(ChannelRegAddr_e reg, uint8_t &value) 
+int DS4424::read_register(ChannelRegAddr_e reg, uint8_t &value) 
 {
     int32_t ret;
  
@@ -155,7 +155,7 @@
 
 
 //******************************************************************************
-int DS4424::writeRegister(ChannelRegAddr_e reg, uint8_t value)
+int DS4424::write_register(ChannelRegAddr_e reg, uint8_t value)
 {
     
     int32_t ret;
--- a/DS4424.h	Fri May 11 23:58:29 2018 +0000
+++ b/DS4424.h	Thu Sep 06 21:43:36 2018 +0000
@@ -36,8 +36,19 @@
  
 #include "mbed.h"
 
+#define DS4424_NO_ERROR   0
+#define DS4424_ERROR      -1
+
+#define DS4424_MAX_DAC_CHANNELS 4
+#define DS4422_MAX_DAC_CHANNELS 2
+
+#define DS4424_DAC_ADDR(chan)   ((chan) + 0xf8)
+#define DS4424_SOURCE_I     1
+#define DS4424_SINK_I       0
+
 /**
 * @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
@@ -60,25 +71,13 @@
 *    i2cBus.frequency(400000);
 *
 *    // read channel 0 register
-*    ret = ds4424_dac.readRaw(value[0], DS4424::REG_OUT0); 
+*    ret = ds4424_dac.read_raw(value[0], DS4424::REG_OUT0); 
 *
 *      //... rest of application
 * }
 * @endcode
 */
 
-#define DS4424_NO_ERROR   0
-#define DS4424_ERROR      -1
-
-#define DS4424_MAX_DAC_CHANNELS 4
-#define DS4422_MAX_DAC_CHANNELS 2
-
-#define DS4424_DAC_ADDR(chan)   ((chan) + 0xf8)
-#define DS4424_SOURCE_I     1
-#define DS4424_SINK_I       0
-
-
-
 class DS4424
 {
     public:
@@ -158,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.
@@ -166,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:
 
@@ -176,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
@@ -184,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