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

Committer:
jungkeviny
Date:
Sun Jul 15 03:49:41 2018 +0000
Revision:
3:4d4053c4c29e
Parent:
1:bc368afe2ec8
Updated docs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jungkeviny 1:bc368afe2ec8 1 #include "MAX5487.h"
jungkeviny 1:bc368afe2ec8 2
jungkeviny 1:bc368afe2ec8 3 MAX5487::MAX5487(SPI &spi, DigitalOut &pin) : m_spi(spi), m_pin(pin)
jungkeviny 1:bc368afe2ec8 4 {
jungkeviny 1:bc368afe2ec8 5 m_pin = 1;
jungkeviny 1:bc368afe2ec8 6 }
jungkeviny 1:bc368afe2ec8 7
jungkeviny 1:bc368afe2ec8 8
jungkeviny 1:bc368afe2ec8 9 void MAX5487::writeCommand(MAX5487::setting_t setting, int value)
jungkeviny 1:bc368afe2ec8 10 {
jungkeviny 1:bc368afe2ec8 11 if((value >> 8) > 0) {
jungkeviny 1:bc368afe2ec8 12 printf("value in writeCommand > 8 bits!\r\n");
jungkeviny 1:bc368afe2ec8 13 return;
jungkeviny 1:bc368afe2ec8 14 }
jungkeviny 1:bc368afe2ec8 15 m_pin = 0;
jungkeviny 1:bc368afe2ec8 16 m_spi.write(setting);
jungkeviny 1:bc368afe2ec8 17 m_spi.write(value);
jungkeviny 1:bc368afe2ec8 18 m_pin = 1;
jungkeviny 1:bc368afe2ec8 19 }
jungkeviny 1:bc368afe2ec8 20
jungkeviny 1:bc368afe2ec8 21
jungkeviny 1:bc368afe2ec8 22 void MAX5487::writeCommand(MAX5487::setting_t setting)
jungkeviny 1:bc368afe2ec8 23 {
jungkeviny 1:bc368afe2ec8 24 m_pin = 0;
jungkeviny 1:bc368afe2ec8 25 m_spi.write(setting);
jungkeviny 1:bc368afe2ec8 26 m_pin = 1;
jungkeviny 1:bc368afe2ec8 27 }
jungkeviny 1:bc368afe2ec8 28