Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: F446_DSP_Oscilloscope Demo_DSP_ADDA_Dual TrG_Oscilloscope
DSP_AdcDualIntr.hpp
00001 //------------------------------------------------------------- 00002 // STM32F446 内蔵 ADC を割り込み方式で使うための派生クラス 00003 // 基底クラス: DspAdcDualBase 00004 // 00005 // 2021/06/29, Copyright (c) 2021 MIKAMI, Naoki 00006 //------------------------------------------------------------- 00007 00008 #include "DSP_AdcDualBase.hpp" 00009 00010 #ifndef DSP_ADC_DUAL_INTERRUPT_HPP 00011 #define DSP_ADC_DUAL_INTERRUPT_HPP 00012 00013 namespace Mikami 00014 { 00015 class DspAdcDualIntr : public DspAdcDualBase 00016 { 00017 public: 00018 // コンストラクタ 00019 // fSampling 標本化周波数 [kHz] 00020 // pinCh1 チャンネル 1 に対応する入力ピンの名前 00021 // pinCh2 チャンネル 2 に対応する入力ピンの名前 00022 DspAdcDualIntr(float fSampling, PinName pinCh1, PinName pinCh2) 00023 : DspAdcDualBase(fSampling, pinCh1, pinCh2) 00024 { adcCh1_->CR1 |= ADC_CR1_EOCIE; } 00025 00026 virtual ~DspAdcDualIntr() {} 00027 00028 // AD 変換された値を読み込む 00029 // -1.0f <= AD変換された値 < 1.0f 00030 virtual void Read(float &ad1, float &ad2) const 00031 { 00032 ad1 = ToFloat(adcCh1_->DR); 00033 ad2 = ToFloat(adcCh2_->DR); 00034 } 00035 00036 // 割り込みベクタの設定と ADC 割り込みの有効化 00037 void SetIntrVec(void (*Func)()) 00038 { 00039 NVIC_SetVector(ADC_IRQn, (uint32_t)Func); // See "cmsis_nvic.h" 00040 NVIC_EnableIRQ(ADC_IRQn); // See "core_cm4.h" 00041 } 00042 00043 // ADC 割込みを有効にする 00044 void EnableIntr() { NVIC_EnableIRQ(ADC_IRQn); } 00045 00046 // ADC 割込みを無効にする 00047 void DisableIntr() { NVIC_DisableIRQ(ADC_IRQn); } 00048 00049 private: 00050 // コピー・コンストラクタ,代入演算子の禁止のため 00051 DspAdcDualIntr(const DspAdcDualIntr&); 00052 DspAdcDualIntr& operator=(const DspAdcDualIntr&); 00053 }; 00054 } 00055 #endif // DSP_ADC_DUAL_INTERRUPT_HPP
Generated on Tue Jul 19 2022 03:14:12 by
