AM中波放送用SDR.CICフィルタのみを使用.CQ出版社「トランジスタ技術」誌,2021年5月号に掲載

Dependencies:   mbed

Committer:
MikamiUitOpen
Date:
Sat Aug 29 11:26:29 2020 +0000
Revision:
0:7a653530c8ce
1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:7a653530c8ce 1 //-------------------------------------------------------------
MikamiUitOpen 0:7a653530c8ce 2 // F446 内蔵 ADC を割込み方式で使うための派生クラス
MikamiUitOpen 0:7a653530c8ce 3 // 基底クラス: AdcF446_Base
MikamiUitOpen 0:7a653530c8ce 4 //
MikamiUitOpen 0:7a653530c8ce 5 // 2020/07/24, Copyright (c) 2020 MIKAMI, Naoki
MikamiUitOpen 0:7a653530c8ce 6 //-------------------------------------------------------------
MikamiUitOpen 0:7a653530c8ce 7
MikamiUitOpen 0:7a653530c8ce 8 #include "F446_ADC_Base.hpp"
MikamiUitOpen 0:7a653530c8ce 9
MikamiUitOpen 0:7a653530c8ce 10 #ifndef ADC_F446_INTERRUPT_HPP
MikamiUitOpen 0:7a653530c8ce 11 #define ADC_F446_INTERRUPT_HPP
MikamiUitOpen 0:7a653530c8ce 12
MikamiUitOpen 0:7a653530c8ce 13 namespace Mikami
MikamiUitOpen 0:7a653530c8ce 14 {
MikamiUitOpen 0:7a653530c8ce 15 class AdcF446_Intr : public AdcF446_Base
MikamiUitOpen 0:7a653530c8ce 16 {
MikamiUitOpen 0:7a653530c8ce 17 public:
MikamiUitOpen 0:7a653530c8ce 18 // コンストラクタ
MikamiUitOpen 0:7a653530c8ce 19 // fSampling 標本化周波数 [kHz]
MikamiUitOpen 0:7a653530c8ce 20 // pin 入力ピンの名前
MikamiUitOpen 0:7a653530c8ce 21 AdcF446_Intr(float fSampling, PinName pin)
MikamiUitOpen 0:7a653530c8ce 22 : AdcF446_Base(fSampling, pin)
MikamiUitOpen 0:7a653530c8ce 23 { myAdc_->CR1 |= ADC_CR1_EOCIE; } // AD 変換終了割り込みを許可
MikamiUitOpen 0:7a653530c8ce 24
MikamiUitOpen 0:7a653530c8ce 25 virtual ~AdcF446_Intr() {}
MikamiUitOpen 0:7a653530c8ce 26
MikamiUitOpen 0:7a653530c8ce 27 // 割込みベクタの設定と AD 変換割込みを有効にする
MikamiUitOpen 0:7a653530c8ce 28 void SetIntrVec(void (*Func)())
MikamiUitOpen 0:7a653530c8ce 29 {
MikamiUitOpen 0:7a653530c8ce 30 NVIC_SetVector(ADC_IRQn, (uint32_t)Func); // "core_cm4.h" 参照
MikamiUitOpen 0:7a653530c8ce 31 NVIC_EnableIRQ(ADC_IRQn); // "core_cm4.h" 参照
MikamiUitOpen 0:7a653530c8ce 32 }
MikamiUitOpen 0:7a653530c8ce 33
MikamiUitOpen 0:7a653530c8ce 34 // AD 変換された値を読み込む
MikamiUitOpen 0:7a653530c8ce 35 // -1.0f <= AD変換された値 < 1.0f
MikamiUitOpen 0:7a653530c8ce 36 virtual float Read() { return ToFloat(myAdc_->DR); }
MikamiUitOpen 0:7a653530c8ce 37
MikamiUitOpen 0:7a653530c8ce 38 private:
MikamiUitOpen 0:7a653530c8ce 39 // コピー・コンストラクタ,代入演算子禁止の禁止のため
MikamiUitOpen 0:7a653530c8ce 40 AdcF446_Intr(const AdcF446_Intr&);
MikamiUitOpen 0:7a653530c8ce 41 AdcF446_Intr& operator=(const AdcF446_Intr&);
MikamiUitOpen 0:7a653530c8ce 42 };
MikamiUitOpen 0:7a653530c8ce 43 }
MikamiUitOpen 0:7a653530c8ce 44 #endif // ADC_F446_INTERRUPT_HPP