Class library for internal ADC and DAC connected by SPI. This library support clock generator using TIM3 for switched-capacitor filter to smooth output signal of DAC. This library includes derivative class to support interrupt occured in end of AD conversion. Validated for ST Nucleo F401RE, F411RE. 内蔵 ADC と,SPI 接続の DAC のためのクラスライブラリ.DAC の出力信号を平滑化するためのスイッチトキャパシタフィルタ用のクロックは TIM3 を使用.ST Nucleo F401RE,F411RE で動作を確認.

Dependents:   UITDSP_ADDA_Example UIT2_MovingAv_Intr UIT2_VariableFIR UIT2_VowelSynthesizer ... more

Revision:
0:2cdd5c91d975
Child:
2:0cf4cc40ee02
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DAC_MCP4922Dual.hpp	Fri Feb 20 05:52:03 2015 +0000
@@ -0,0 +1,44 @@
+//------------------------------------------------------
+//  Class for dual-channel DAC in MCP4922
+//  2015/01/30, Copyright (c) 2015 MIKAMI, Naoki
+//------------------------------------------------------
+
+#ifndef DAC_MCP4922_DUAL_HPP
+#define DAC_MCP4922_DUAL_HPP
+
+#include "DAC_MCP4922.hpp"
+
+namespace Mikami
+{
+    class DAC_MCP4922Dual
+    {
+    public:
+        DAC_MCP4922Dual()
+            : myDac1_(DAC_MCP4922::DAC_A),
+              myDac2_(DAC_MCP4922::DAC_B) {}
+        
+        void Write(float valA, float valB)
+        {
+            myDac1_.Write(valA);    // Write to DAC A
+            myDac2_.Write(valB);    // Write to DAC B
+            myDac2_.Wait();
+            while (myDac2_.IsBusy()) {}
+            myDac1_.Ldac();
+        }
+
+        void Write(uint16_t valA, uint16_t valB)
+        {
+            myDac1_.Write(valA);    // Write to DAC A
+            myDac2_.Write(valB);    // Write to DAC B
+            myDac2_.Wait();
+            while (myDac2_.IsBusy()) {}
+            myDac1_.Ldac();         // dual load
+        }
+
+    private:
+        DAC_MCP4922 myDac1_;
+        DAC_MCP4922 myDac2_;
+    };
+}
+#endif  // DAC_MCP4922_DUAL_HPP
+