A wrapper library for easy access to DACs using the SPI interface. Individual devices will receive their own libraries.

Dependents:   MAX500 MCP4922 MCP4822

Revision:
0:bce9b1450b19
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DAC.cpp	Wed Jun 13 23:41:08 2012 +0000
@@ -0,0 +1,16 @@
+#include "DAC.h"
+
+/*SPI Channels */
+SPI SPI_A(p5, NC, p7);  //since we only have two SPI channels, which must be shared, define them here.
+SPI SPI_B(p11, NC, p13);
+
+/*Initialize DAC */
+DAC::DAC(int SPIchannelNum, PinName _CS, PinName _LDAC) : CS(_CS), LDAC(_LDAC){  
+    if (SPIchannelNum ==1){
+        DACspi = &SPI_B;
+    }  
+    else{
+        DACspi = &SPI_A;
+    }
+    (*DACspi).format(16,0);
+}
\ No newline at end of file