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 Kevin Jung

MAX5487.cpp

Committer:
jungkeviny
Date:
2018-07-14
Revision:
1:bc368afe2ec8
Parent:
0:3d525ab09933

File content as of revision 1:bc368afe2ec8:

#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;
}