Simple driver for the 12-bit DAC DAC7311 from TI

Revision:
0:ca49770e05b5
Child:
1:5497575badba
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DAC7311.cpp	Fri Oct 12 18:31:18 2012 +0000
@@ -0,0 +1,21 @@
+#include "DAC7311.h"
+
+void DAC7311::set_mode (unsigned short mode)
+{
+    this->mode = mode;
+    
+    spi->format (16, DAC7311_SPI_MODE);
+    *sync = 0;
+    spi->write (mode | conf_data_12(value));
+    *sync = 1;
+}
+
+void DAC7311::set_value (unsigned short value)
+{
+    this->value = value;
+    
+    spi->format (16, DAC7311_SPI_MODE);
+    *sync = 0;
+    spi->write (mode | conf_data_12(value));
+    *sync = 1;
+}
\ No newline at end of file