Library for build-in ADC and DAC in STM32F446 mounted on Nucleo F446RE. Nucleo F446RE に搭載されている STM32F446 の内蔵 ADC, DAC 用のライブラリ.
Dependents: Demo_F446_AD_DA F446_MySoundMachine F446_ADF_Nlms F446_Spectrogram
F446_DAC.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-11-11
- Revision:
- 0:c945b4fe9a48
- Child:
- 1:6b9f2af6613d
File content as of revision 0:c945b4fe9a48:
//-------------------------------------------------------- // 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; } }