A simple library for controlling an MCP4241 digital potentiometer
Diff: DigiPot.h
- Revision:
- 0:f547d674e543
- Child:
- 2:54e9d9ddc350
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DigiPot.h Fri Sep 13 11:09:41 2013 +0000 @@ -0,0 +1,22 @@ +#ifndef DIGIPOT_H +#define DIGIPOT_H + +#include <mbed.h> + +class DigiPot { + + public: + DigiPot(PinName miso, PinName mosi, PinName clk, PinName cs); + void increment(); + void decrement(); + void setLevel(unsigned char); + void mute(); + void unmute(); + unsigned char getLevel(); + private: + SPI *spi; + DigitalOut *chsel; + unsigned char level; +}; + +#endif \ No newline at end of file