不韋 呂
/
SDR_FM_Tx
AM中波放送用SDR.CICフィルタのみを使用.CQ出版社「トランジスタ技術」誌,2021年5月号に掲載
SDR_Library/F446_ADC_Base.hpp@0:7a653530c8ce, 2020-08-29 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Sat Aug 29 11:26:29 2020 +0000
- Revision:
- 0:7a653530c8ce
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:7a653530c8ce | 1 | //------------------------------------------------------------- |
MikamiUitOpen | 0:7a653530c8ce | 2 | // F446 内蔵 ADC 用抽象基底クラス(ヘッダ) |
MikamiUitOpen | 0:7a653530c8ce | 3 | // |
MikamiUitOpen | 0:7a653530c8ce | 4 | // 2020/07/24, Copyright (c) 2020 MIKAMI, Naoki |
MikamiUitOpen | 0:7a653530c8ce | 5 | //------------------------------------------------------------- |
MikamiUitOpen | 0:7a653530c8ce | 6 | |
MikamiUitOpen | 0:7a653530c8ce | 7 | #include "mbed.h" |
MikamiUitOpen | 0:7a653530c8ce | 8 | |
MikamiUitOpen | 0:7a653530c8ce | 9 | #ifndef ADC_F446_POLLING_HPP |
MikamiUitOpen | 0:7a653530c8ce | 10 | #define ADC_F446_POLLING_HPP |
MikamiUitOpen | 0:7a653530c8ce | 11 | |
MikamiUitOpen | 0:7a653530c8ce | 12 | namespace Mikami |
MikamiUitOpen | 0:7a653530c8ce | 13 | { |
MikamiUitOpen | 0:7a653530c8ce | 14 | class AdcF446_Base |
MikamiUitOpen | 0:7a653530c8ce | 15 | { |
MikamiUitOpen | 0:7a653530c8ce | 16 | public: |
MikamiUitOpen | 0:7a653530c8ce | 17 | // コンストラクタ |
MikamiUitOpen | 0:7a653530c8ce | 18 | // fSampling 標本化周波数 [kHz] |
MikamiUitOpen | 0:7a653530c8ce | 19 | // pin 入力ピンの名前 |
MikamiUitOpen | 0:7a653530c8ce | 20 | AdcF446_Base(float fSampling, PinName pin); |
MikamiUitOpen | 0:7a653530c8ce | 21 | |
MikamiUitOpen | 0:7a653530c8ce | 22 | virtual ~AdcF446_Base() {} |
MikamiUitOpen | 0:7a653530c8ce | 23 | |
MikamiUitOpen | 0:7a653530c8ce | 24 | // AD 変換された値を読み込む(純粋仮想関数) |
MikamiUitOpen | 0:7a653530c8ce | 25 | virtual float Read() = 0; |
MikamiUitOpen | 0:7a653530c8ce | 26 | |
MikamiUitOpen | 0:7a653530c8ce | 27 | protected: |
MikamiUitOpen | 0:7a653530c8ce | 28 | ADC_TypeDef* const myAdc_; // AD 変換器に対応するポインタ |
MikamiUitOpen | 0:7a653530c8ce | 29 | |
MikamiUitOpen | 0:7a653530c8ce | 30 | float ToFloat(uint16_t x) { return AMP_*(x - 2048); } |
MikamiUitOpen | 0:7a653530c8ce | 31 | |
MikamiUitOpen | 0:7a653530c8ce | 32 | private: |
MikamiUitOpen | 0:7a653530c8ce | 33 | static const float AMP_ = 1.0f/2048.0f; |
MikamiUitOpen | 0:7a653530c8ce | 34 | |
MikamiUitOpen | 0:7a653530c8ce | 35 | // AD 変換器の外部トリガに使うタイマ (TIM8) の設定 |
MikamiUitOpen | 0:7a653530c8ce | 36 | // fSampling 標本化周波数 [kHz] |
MikamiUitOpen | 0:7a653530c8ce | 37 | void SetTim8(float fSampling); |
MikamiUitOpen | 0:7a653530c8ce | 38 | |
MikamiUitOpen | 0:7a653530c8ce | 39 | // コピー・コンストラクタ,代入演算子の禁止のため |
MikamiUitOpen | 0:7a653530c8ce | 40 | AdcF446_Base(const AdcF446_Base&); |
MikamiUitOpen | 0:7a653530c8ce | 41 | AdcF446_Base& operator=(const AdcF446_Base&); |
MikamiUitOpen | 0:7a653530c8ce | 42 | }; |
MikamiUitOpen | 0:7a653530c8ce | 43 | } |
MikamiUitOpen | 0:7a653530c8ce | 44 | #endif // ADC_F446_POLLING_HPP |