Added one channel mode
Dependents: CW_Decoder_using_FFT_on_F446
Fork of F446_AD_DA by
Diff: F446_DAC.cpp
- Revision:
- 0:c945b4fe9a48
- Child:
- 1:6b9f2af6613d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/F446_DAC.cpp Fri Nov 11 06:28:48 2016 +0000 @@ -0,0 +1,30 @@ +//-------------------------------------------------------- +// Class for buit-in dual DAC on STM32F446 +// +// STM32F446 内蔵の DAC 用のクラス +// Analog Out1: A2 (PA_4) +// Analog Out2: D13 (PA_5) +// +// 2016/11/11, Copyright (c) 2016 MIKAMI, Naoki +//-------------------------------------------------------- + +#include "F446_DAC.hpp" + +namespace Mikami +{ + void DacDual::ScfClock(uint32_t clock) + { + PwmOut clockSCF(D12); // PA6 + + uint32_t arr; + if ((RCC->DCKCFGR & RCC_DCKCFGR_TIMPRE) == RCC_DCKCFGR_TIMPRE) + arr = SystemCoreClock/clock - 1; + else + arr = SystemCoreClock/(2*clock) - 1; + TIM3->ARR = arr; + TIM3->PSC = 0; + + // Set capture/compare register 1 + TIM3->CCR1 = (TIM3->ARR + 1)/2; + } +} \ No newline at end of file