Driver, C++ code, and library for the MAX5487, MAX5488, MAX5489. dual channel, SPI bus, 256-tap digital potentiometer. Non-volatile memory (EEPROM) is available for returning the wipers to their previously stored positions upon power-up.

Dependents:   MAX5487_Digital_Potentiometer_Resistor_MAX32630FTHR_Host

MAX5487.cpp

Committer:
jungkeviny
Date:
2018-07-15
Revision:
3:4d4053c4c29e
Parent:
1:bc368afe2ec8

File content as of revision 3:4d4053c4c29e:

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