A wrapper library for easy access to DACs using the SPI interface. Individual devices will receive their own libraries.
Dependents: MAX500 MCP4922 MCP4822
Diff: DAC.h
- Revision:
- 0:bce9b1450b19
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DAC.h Wed Jun 13 23:41:08 2012 +0000 @@ -0,0 +1,21 @@ +#ifndef DAC_H +#define DAC_H +#include "mbed.h" + +//a basic parent library for use with DACs controlled via SPI. Individual hardware implementations will need their own libraries. +class DAC +{ + public: + DAC(int SPIchannelNum, PinName CS, PinName LDAC); + virtual void write(int millivolts) =0; //write a value to the Digital Analog Converter + + //DigitalOut SCK; + DigitalOut CS; //serial chip select pin + DigitalOut LDAC; //synchronize pin to update both DACs together + SPI * DACspi; +}; + +extern SPI SPI_A; //channel A SPI (pins 5,7) +extern SPI SPI_B; //channel B SPI (pins 11,13) + +#endif //DAC_H \ No newline at end of file