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:
2:b7a81b724561
Parent:
1:a5d963a3c298
Child:
3:5070d2f614d5
diff -r a5d963a3c298 -r b7a81b724561 DS4424.h
--- a/DS4424.h	Mon Sep 10 21:53:18 2018 +0000
+++ b/DS4424.h	Sun Oct 07 21:31:57 2018 +0000
@@ -47,36 +47,36 @@
 #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
-* 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);
+ * @brief Four/two Channel I2C Sink/Source Current DAC
+ * @version 1.0000.3
+ *
+ * @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.read_raw(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
 {
@@ -109,9 +109,9 @@
 
     
     /**
-    * @brief   Register Addresses
-    * @details Enumerated MAX20303 register addresses
-    */
+     * @brief   Register Addresses
+     * @details Enumerated MAX20303 register addresses
+     */
     enum ChannelRegAddr_e {
         REG_OUT0            = 0xF8,  // channel 0
         REG_OUT1            = 0xF9,
@@ -121,76 +121,76 @@
 
     
     /**********************************************************//**
-    * @brief Constructor for DS4424 Class.  
-    * 
-    * @details Allows user to use existing I2C object
-    *
-    * On Entry:
-    *     @param[in] i2c_bus - pointer to existing I2C object
-    *     @param[in] i2c_adrs - 7-bit slave address of DS4424
-    *     @param[in] ic_variant - which type of DS44xx is used
-    *
-    * On Exit:
-    *
-    * @return None
-    **************************************************************/
+     * @brief Constructor for DS4424 Class.  
+     * 
+     * @details Allows user to use existing I2C object
+     *
+     * On Entry:
+     *     @param[in] i2c_bus - pointer to existing I2C object
+     *     @param[in] i2c_adrs - 7-bit slave address of DS4424
+     *     @param[in] ic_variant - which type of DS44xx is used
+     *
+     * On Exit:
+     *
+     * @return None
+     **************************************************************/
     DS4424(I2C &i2c_bus, DS4424_i2c_adrs_t slaveAddress, DS4424_ic_t ic_variant);
     
     
  
     /**********************************************************//**
-    * @brief Default destructor for DS4424 Class.  
-    *
-    * @details Destroys I2C object if owner 
-    *
-    * On Entry:
-    *
-    * On Exit:
-    *
-    * @return None
-    **************************************************************/
+     * @brief Default destructor for DS4424 Class.  
+     *
+     * @details Destroys I2C object if owner 
+     *
+     * On Entry:
+     *
+     * On Exit:
+     *
+     * @return None
+     **************************************************************/
     ~DS4424();
     
-/** 
-    * @brief Read raw value of a channel. Negative values are sink; Positive values are source.
-    * @param result - Value that is read from the register
-    * @param chan_addr - Channel 0 to 3
-    * @return 0 on success, non-zero on failure
-    */
+    /** 
+     * @brief Read raw value of a channel. Negative values are sink; Positive values are source.
+     * @param result - Value that is read from the register
+     * @param chan_addr - Channel 0 to 3
+     * @return 0 on success, negative number on failure
+     */
     int read_raw(int32_t &result, ChannelRegAddr_e chan_addr);
     
- /** 
-    * @brief Write raw value to a channel.
-    * @param value - Value that is stored to the register
-    * @param chan_addr - Channel 0 to 3
-    * @return 0 on success, non-zero on failure
-    */
+    /** 
+     * @brief Write raw value to a channel.
+     * @param value - Value that is stored to the register
+     * @param chan_addr - Channel 0 to 3
+     * @return 0 on success, negative number on failure
+     */
     int write_raw(int32_t value, ChannelRegAddr_e chan_addr);
 
 protected:
 
     /**
-    * @brief  Read register of device at slave address
-    * @param reg - Register address
-    * @param[out] value - Read data on success
-    * @return 0 on success, non-zero on failure
-    */
+     * @brief  Read register of device at slave address
+     * @param reg - Register address
+     * @param[out] value - Read data on success
+     * @return 0 on success, negative number on failure
+     */
     int read_register(ChannelRegAddr_e reg, uint8_t &value);
 
     /** 
-    * @brief Write register of device at slave address
-    * @param reg - Register address
-    * @param value - Value to write
-    * @return 0 on success, non-zero on failure
-    */
+     * @brief Write register of device at slave address
+     * @param reg - Register address
+     * @param value - Value to write
+     * @return 0 on success, negative number on failure
+     */
     int write_register(ChannelRegAddr_e reg, uint8_t value);
  
 private:
-    /// I2C object
+    /** I2C object */
     I2C &m_i2c;
-    /// Device slave addresses
+    /** Device slave addresses */
     uint8_t m_writeAddress, m_readAddress;
-    /// Address of the Maximum Register for this device
+    /** Address of the Maximum Register for this device */
     ChannelRegAddr_e m_max_ch_reg_addr;
 };