Class library for internal ADC and DAC connected by SPI. ADC is triggered by TIM2. 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. Slave select of SPI for DAC is generated using TIM4. Validated for ST Nucleo F401RE, F411RE. New version. 内蔵 ADC と,SPI 接続の DAC のためのクラスライブラリ.ADC の変換開始トリガは TIM2 で発生.DAC の出力信号を平滑化するためのスイッチトキャパシタフィルタ用のクロックは TIM3 を使用.DAC の SPI 用スレーブ選択信号は TIM4 で発生.ST Nucleo F401RE,F411RE で動作を確認.新バージョン
Dependents: UIT2_MovingAverage UIT2_AllpassReverb UIT2_CombReverb UIT2_FIR_LPF_Symmetry ... more
Diff: DAC_MCP4922Dual.hpp
- Revision:
- 19:900efc6796d4
- Parent:
- 10:c326d04aa6b8
- Child:
- 21:3731753ebf24
diff -r 0bfced9d5526 -r 900efc6796d4 DAC_MCP4922Dual.hpp --- a/DAC_MCP4922Dual.hpp Thu Jan 29 07:55:04 2015 +0000 +++ b/DAC_MCP4922Dual.hpp Fri Jan 30 07:22:28 2015 +0000 @@ -1,13 +1,16 @@ //------------------------------------------------------ // Class for dual channel DAC in MCP4922 -// 2014/11/13, Copyright (c) 2014 MIKAMI, Naoki +// This class does not support clock for SCF +// 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 { @@ -19,8 +22,8 @@ void Write(float valA, float valB) { myDac1_.Write(valA); // Write to DAC A - while (myDac1_.IsBusy()) {} myDac2_.Write(valB); // Write to DAC B + myDac2_.Wait(); while (myDac2_.IsBusy()) {} myDac1_.Ldac(); } @@ -28,8 +31,8 @@ void Write(uint16_t valA, uint16_t valB) { myDac1_.Write(valA); // Write to DAC A - while (myDac1_.IsBusy()) {} myDac2_.Write(valB); // Write to DAC B + myDac2_.Wait(); while (myDac2_.IsBusy()) {} myDac1_.Ldac(); // dual load }