Library for AD5206 digital potentiometer from Analog Devices
Dependents: AD5206_demo USB_speaker 4180_proj_approach_2 4180_proj ... more
Revision 0:d2adf1f7e548, committed 2015-10-17
- Comitter:
- taoqiuyang
- Date:
- Sat Oct 17 20:02:13 2015 +0000
- Commit message:
- Library for AD5206 from Analog Devices
Changed in this revision
AD5206.cpp | Show annotated file Show diff for this revision Revisions of this file |
AD5206.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r d2adf1f7e548 AD5206.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AD5206.cpp Sat Oct 17 20:02:13 2015 +0000 @@ -0,0 +1,12 @@ +#include <AD5206.h> + +AD5206::AD5206(PinName mosi, PinName miso, PinName sclk, PinName cs): _spi(mosi, miso, sclk), _cs(cs) { + _cs = 1; +} + +void AD5206::write_AD5206(int addr,int val){ + _cs=0; + _spi.write(addr); + _spi.write(val); + _cs=1; +} \ No newline at end of file
diff -r 000000000000 -r d2adf1f7e548 AD5206.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AD5206.h Sat Oct 17 20:02:13 2015 +0000 @@ -0,0 +1,13 @@ +//Library for AD5206 from Analog Device + +#include <mbed.h> + +class AD5206{ + public: + AD5206(PinName mosi, PinName miso, PinName sclk, PinName cs); + + void write_AD5206(int addr,int val); + + SPI _spi; + DigitalOut _cs; +};