Driver C++ source code for MAX5216/MAX5214 16-bit/14-bit DAC SPI (50MHz) bus ICs. Low power Digital-to_Analog Converter chips which accept supply voltages of 2.7V to 5.5V. Features Rail-to-Rail Buffered Output Operation and Safe Power-On Reset (POR) to Zero DAC Output.
Dependents: MAX5216_16_Bit_DAC_Hello_Code
Fork of MAX5487_Digital_Pot_Potentiometer_Rheostat_Resistor_Wiper by
Diff: MAX5487.cpp
- Revision:
- 1:bc368afe2ec8
- Parent:
- 0:3d525ab09933
diff -r 3d525ab09933 -r bc368afe2ec8 MAX5487.cpp --- a/MAX5487.cpp Tue Jul 10 05:28:12 2018 +0000 +++ b/MAX5487.cpp Sat Jul 14 04:25:25 2018 +0000 @@ -0,0 +1,28 @@ +#include "MAX5487.h" + +MAX5487::MAX5487(SPI &spi, DigitalOut &pin) : m_spi(spi), m_pin(pin) +{ + m_pin = 1; +} + + +void MAX5487::writeCommand(MAX5487::setting_t setting, int value) +{ + if((value >> 8) > 0) { + printf("value in writeCommand > 8 bits!\r\n"); + return; + } + m_pin = 0; + m_spi.write(setting); + m_spi.write(value); + m_pin = 1; +} + + +void MAX5487::writeCommand(MAX5487::setting_t setting) +{ + m_pin = 0; + m_spi.write(setting); + m_pin = 1; +} + \ No newline at end of file