STM32F446 の内蔵 ADC, DAC 用のライブラリ.このライブラリを登録した際のプログラム: Demo_DSP_ADDA. Library for build-in ADC and DAC in STM32F446.

Dependents:   Demo_DSP_ADDA F446_DSP_FFT_Analyzer TrG_FFT_Analyzer DSP_MultirateLinearphase ... more

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Sun Dec 20 08:04:35 2020 +0000
Parent:
2:7d58c617d76a
Commit message:
4

Changed in this revision

DSP_AdcBase.cpp Show annotated file Show diff for this revision Revisions of this file
DSP_AdcBase.hpp Show annotated file Show diff for this revision Revisions of this file
DSP_AdcIntr.cpp Show annotated file Show diff for this revision Revisions of this file
DSP_AdcIntr.hpp Show annotated file Show diff for this revision Revisions of this file
DSP_AdcPolling.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/DSP_AdcBase.cpp	Sat Nov 07 02:12:24 2020 +0000
+++ b/DSP_AdcBase.cpp	Sun Dec 20 08:04:35 2020 +0000
@@ -1,7 +1,7 @@
 //-------------------------------------------------------------
 //  STM32F446 内蔵 ADC のための抽象基底クラス
 //
-//  2020/11/07, Copyright (c) 2020 MIKAMI, Naoki
+//  2020/12/20, Copyright (c) 2020 MIKAMI, Naoki
 //-------------------------------------------------------------
 
 #include "DSP_AdcBase.hpp"
@@ -10,7 +10,7 @@
 namespace Mikami
 {
     // コンストラクタ
-    DspAdc_Base::DspAdc_Base(float fSampling, PinName pin,
+    DspAdcBase::DspAdcBase(float fSampling, PinName pin,
                              ADC_TypeDef* const adc)
     {
         // このクラスのオブジェクトの複数生成禁止のため
@@ -61,7 +61,7 @@
 
     // AD 変換器の外部トリガに使うタイマ (TIM8) の設定
     //      fSampling   標本化周波数 [kHz]
-    void DspAdc_Base::SetFs(float fSampling)
+    void DspAdcBase::SetFs(float fSampling)
     {
         __HAL_RCC_TIM8_CLK_ENABLE();    // クロック供給. "stm32f4xx_hal_rcc.h" 参照
         TIM_TypeDef* const TIM = TIM8;
@@ -88,7 +88,7 @@
     //  pin に対応する AD 変換器が存在することを確認する
     //      pin     A0, PA_0 など
     //      adc     ADC1 など
-    bool DspAdc_Base::PinmapMatch(PinName pin, ADC_TypeDef* const adc)
+    bool DspAdcBase::PinmapMatch(PinName pin, ADC_TypeDef* const adc)
     {
         for (int n=0; PinMap_ADC[n].pin != NC; n++)
             if ( ((PinMap_ADC[n].pin & 0xFF) == pin) &
@@ -97,6 +97,6 @@
     }
 
     // static メンバの実体
-    ADC_TypeDef* DspAdc_Base::myAdc_;
-    bool DspAdc_Base::created_ = false;
+    ADC_TypeDef* DspAdcBase::myAdc_;
+    bool DspAdcBase::created_ = false;
 }
\ No newline at end of file
--- a/DSP_AdcBase.hpp	Sat Nov 07 02:12:24 2020 +0000
+++ b/DSP_AdcBase.hpp	Sun Dec 20 08:04:35 2020 +0000
@@ -1,7 +1,7 @@
 //-------------------------------------------------------------
 //  STM32F446 内蔵 ADC のための抽象基底クラス(ヘッダ)
 //
-//  2020/11/07, Copyright (c) 2020 MIKAMI, Naoki
+//  2020/12/20, Copyright (c) 2020 MIKAMI, Naoki
 //-------------------------------------------------------------
 
 #include "mbed.h"
@@ -15,17 +15,17 @@
 
 namespace Mikami
 {
-    class DspAdc_Base
+    class DspAdcBase
     {
     public:
         // コンストラクタ
         //      fSampling   標本化周波数 [kHz]
         //      pin         入力ピンの名前
         //      adc         AD 変換器: ADC1, ADC2, ADC3 のいずれか
-        DspAdc_Base(float fSampling, PinName pin,
+        DspAdcBase(float fSampling, PinName pin,
                     ADC_TypeDef* const adc = ADC2);
 
-        virtual ~DspAdc_Base() {}
+        virtual ~DspAdcBase() {}
 
         // AD 変換された値を読み込む
         //      -1.0f <= AD変換された値 < 1.0f
@@ -47,8 +47,8 @@
         bool PinmapMatch(PinName pin, ADC_TypeDef* const adc);
 
         // コピー・コンストラクタ,代入演算子の禁止のため
-        DspAdc_Base(const DspAdc_Base&);
-        DspAdc_Base& operator=(const DspAdc_Base&);
+        DspAdcBase(const DspAdcBase&);
+        DspAdcBase& operator=(const DspAdcBase&);
     };
 }
 #endif  // DSP_ADC_BASE_HPP
\ No newline at end of file
--- a/DSP_AdcIntr.cpp	Sat Nov 07 02:12:24 2020 +0000
+++ b/DSP_AdcIntr.cpp	Sun Dec 20 08:04:35 2020 +0000
@@ -2,7 +2,7 @@
 //  STM32F446 内蔵 ADC を割込み方式で使うための派生クラス
 //      基底クラス: DspAdc_Base
 //
-//  2020/05/22, Copyright (c) 2020 MIKAMI, Naoki
+//  2020/12/20, Copyright (c) 2020 MIKAMI, Naoki
 //-------------------------------------------------------------
 
 #include "DSP_AdcIntr.hpp"
@@ -10,7 +10,7 @@
 namespace Mikami
 {
     // 割込みベクタの設定と AD 変換割込みを有効にする
-    void DspAdc_Intr::SetIntrVec(void (*Func)())
+    void DspAdcIntr::SetIntrVec(void (*Func)())
     {
         fp_ = Func;         // 引数として渡された処理を割り当てる
         NVIC_SetVector(ADC_IRQn, (uint32_t)Isr);    // "core_cm4.h" 参照
@@ -18,5 +18,5 @@
     }    
 
     // static メンバの実体
-    void (*DspAdc_Intr::fp_)();
+    void (*DspAdcIntr::fp_)();
 }
\ No newline at end of file
--- a/DSP_AdcIntr.hpp	Sat Nov 07 02:12:24 2020 +0000
+++ b/DSP_AdcIntr.hpp	Sun Dec 20 08:04:35 2020 +0000
@@ -2,7 +2,7 @@
 //  STM32F446 内蔵 ADC を割込み方式で使うための派生クラス(ヘッダ)
 //      基底クラス: DspAdc_Base
 //
-//  2020/05/22, Copyright (c) 2020 MIKAMI, Naoki
+//  2020/12/20, Copyright (c) 2020 MIKAMI, Naoki
 //-----------------------------------------------------------------
 
 #include "DSP_AdcBase.hpp"
@@ -12,18 +12,18 @@
 
 namespace Mikami
 {
-    class DspAdc_Intr : public DspAdc_Base
+    class DspAdcIntr : public DspAdcBase
     {
     public:
         // コンストラクタ
         //      fSampling   標本化周波数 [kHz]
         //      pin         入力ピンの名前
         //      adc         AD 変換器: ADC1, ADC2, ADC3 のいずれか
-        DspAdc_Intr(float fSampling, PinName pin, ADC_TypeDef* const adc = ADC2)
-            : DspAdc_Base(fSampling, pin, adc)
+        DspAdcIntr(float fSampling, PinName pin, ADC_TypeDef* const adc = ADC2)
+            : DspAdcBase(fSampling, pin, adc)
         {   myAdc_->CR1 |= ADC_CR1_EOCIE; }     // AD 変換終了割込みを許可
 
-        virtual ~DspAdc_Intr() {}
+        virtual ~DspAdcIntr() {}
 
         // 割込みベクタの設定と AD 変換割込みを有効にする
         void SetIntrVec(void (*Func)());
--- a/DSP_AdcPolling.hpp	Sat Nov 07 02:12:24 2020 +0000
+++ b/DSP_AdcPolling.hpp	Sun Dec 20 08:04:35 2020 +0000
@@ -12,18 +12,18 @@
 
 namespace Mikami
 {
-    class DspAdc_Polling : public DspAdc_Base
+    class DspAdcPolling : public DspAdcBase
     {
     public:
         // コンストラクタ
         //      fSampling   標本化周波数 [kHz]
         //      pin         入力ピンの名前
         //      adc         AD 変換器: ADC1, ADC2, ADC3 のいずれか
-        DspAdc_Polling(float fSampling, PinName pin,
+        DspAdcPolling(float fSampling, PinName pin,
                        ADC_TypeDef* const adc = ADC2)
-            : DspAdc_Base(fSampling, pin, adc) {}
+            : DspAdcBase(fSampling, pin, adc) {}
 
-        virtual ~DspAdc_Polling() {}
+        virtual ~DspAdcPolling() {}
 
         // AD 変換された値を読み込む
         //      -1.0f <= AD変換された値 < 1.0f