dac subsystem

Dependencies:   mbed MCP4725

Revision:
0:c7adfe979a5b
diff -r 000000000000 -r c7adfe979a5b DAC/DAC.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DAC/DAC.h	Tue Apr 01 04:45:24 2014 +0000
@@ -0,0 +1,39 @@
+
+#ifndef DAC_H
+#define DAC_H
+
+#include "mbed.h"
+#include "mcp4725.h"
+
+//pins for connection
+#define PIN_SDA p9
+#define PIN_SCL p10
+#define DEVICE_ADDR_BIT 0
+//ref voltage
+#define VDD_VOLTAGE 5.04
+
+enum FREQ { FREQ_10HZ, FREQ_1HZ};
+enum FORM { FORM_SQUARE, FORM_SIN};
+
+/**
+    Funciton: DAC_start
+    Description: start generating the analog signal
+*/
+void DAC_start();
+/**
+    Funciton: DAC_stop
+    Description: stop generating the analog signal
+*/
+void DAC_stop();
+/**
+    Funciton: DAC_generate
+    Description: calculate the Vout accoding to the configuration and send command to DAC chip
+*/
+void DAC_generate();
+/**
+    Funciton: DAC_set
+    Description: set the configuration( amplitude, frequency and form of the signal)
+*/
+void DAC_set(float range, enum FREQ freq, enum FORM form);
+
+#endif
\ No newline at end of file