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
Diff: DS4424.cpp
- Revision:
- 4:3824afaf0d61
- Parent:
- 2:b7a81b724561
- Child:
- 5:fc75fced724f
--- a/DS4424.cpp Sun Oct 07 22:05:53 2018 +0000 +++ b/DS4424.cpp Sun Oct 07 22:13:14 2018 +0000 @@ -1,36 +1,35 @@ /******************************************************************************* -* Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included -* in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES -* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -* -* Except as contained in this notice, the name of Maxim Integrated -* Products, Inc. shall not be used except as stated in the Maxim Integrated -* Products, Inc. Branding Policy. -* -* The mere transfer of this software does not imply any licenses -* of trade secrets, proprietary technology, copyrights, patents, -* trademarks, maskwork rights, or any other form of intellectual -* property whatsoever. Maxim Integrated Products, Inc. retains all -* ownership rights. -******************************************************************************* -*/ - + * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of Maxim Integrated + * Products, Inc. shall not be used except as stated in the Maxim Integrated + * Products, Inc. Branding Policy. + * + * The mere transfer of this software does not imply any licenses + * of trade secrets, proprietary technology, copyrights, patents, + * trademarks, maskwork rights, or any other form of intellectual + * property whatsoever. Maxim Integrated Products, Inc. retains all + * ownership rights. + ******************************************************************************* + */ #include "DS4424.h" @@ -50,8 +49,7 @@ uint8_t bits; }; -//****************************************************************************** - +/******************************************************************************/ DS4424::DS4424(I2C &i2c_bus, DS4424_i2c_adrs_t slaveAddress, DS4424_ic_t ic_variant): m_i2c(i2c_bus), m_writeAddress(slaveAddress <<1), @@ -71,14 +69,14 @@ } -//****************************************************************************** +/******************************************************************************/ DS4424::~DS4424(void) { - //empty block + /** empty block */ } -//****************************************************************************** +/******************************************************************************/ int DS4424::read_raw(int32_t &result, ChannelRegAddr_e chan_addr) { uint8_t value; @@ -100,7 +98,7 @@ } -//****************************************************************************** +/******************************************************************************/ int DS4424::write_raw(int32_t value, ChannelRegAddr_e chan_addr) { #define U8_MAX ((uint8_t)~0U) @@ -129,7 +127,7 @@ } -//****************************************************************************** +/******************************************************************************/ int DS4424::read_register(ChannelRegAddr_e reg, uint8_t &value) { int32_t ret; @@ -154,7 +152,7 @@ } -//****************************************************************************** +/******************************************************************************/ int DS4424::write_register(ChannelRegAddr_e reg, uint8_t value) {