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.
Diff: DS4424.h
- Revision:
- 3:c40703da0faf
- Parent:
- 2:cead66dd3647
diff -r cead66dd3647 -r c40703da0faf DS4424.h --- 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