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
DAC_MCP4922Dual.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-03-26
- Revision:
- 5:ff25db28bc64
- Parent:
- 2:0cf4cc40ee02
- Child:
- 7:14cdca8b48f8
File content as of revision 5:ff25db28bc64:
//------------------------------------------------------ // Class for dual channel DAC in MCP4922 // 2015/03/26, 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_MCP4922 { public: DAC_MCP4922Dual( PinName mosi = SPI_MOSI, // D11 PinName sclk = SPI_SCK, // D13 PinName cs = SPI_CS, // D10 PinName ldac = SPI_MISO) // D12 : DAC_MCP4922(DAC_A, mosi, sclk, cs, ldac) {} void Write(float valA, float valB) { SetCR(DAC_A); DAC_MCP4922::Write(valA); // Write to DAC A SetCR(DAC_B); DAC_MCP4922::Write(valB); // Write to DAC B Wait(); while (IsBusy()) {} Ldac(); } void Write(uint16_t valA, uint16_t valB) { SetCR(DAC_A); DAC_MCP4922::Write(valA); // Write to DAC A SetCR(DAC_B); DAC_MCP4922::Write(valB); // Write to DAC B Wait(); while (IsBusy()) {} Ldac(); } private: void Wait() // Little wait { __NOP(); __NOP(); __NOP(); } }; } #endif // DAC_MCP4922_DUAL_HPP