CQ出版社セミナ,2021/12/07開催「実習・C++言語によるArmマイコンのプログラミング」で使うプログラム.

Dependencies:   Array_Matrix mbed SerialTxRxIntr UIT_FFT_Real

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Fri Jan 17 02:04:09 2020 +0000
Parent:
0:a80f730d32a8
Child:
2:d28a3f741217
Commit message:
2

Changed in this revision

ADDA_BasePolling/F446_ADC_Intr.cpp Show annotated file Show diff for this revision Revisions of this file
ADDA_BasePolling/F446_ADC_Intr.hpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ADDA_BasePolling/F446_ADC_Intr.cpp	Fri Jan 17 02:04:09 2020 +0000
@@ -0,0 +1,22 @@
+//-------------------------------------------------------------
+//  F446 内蔵 ADC2 を割込み方式で使うための派生クラス
+//      基底クラス: AdcF446_Polling
+//
+//  2020/01/12, Copyright (c) 2020 MIKAMI, Naoki
+//-------------------------------------------------------------
+
+#include "F446_ADC_Intr.hpp"
+
+namespace Mikami
+{
+    // 割込みベクタの設定と AD 変換割込みを有効にする
+    void AdcF446_Intr::SetIntrVec(void (*Func)())
+    {
+        fp = Func;          // 引数として渡された処理を割り当てる
+        NVIC_SetVector(ADC_IRQn, (uint32_t)Isr);    // "core_cm4.h" 参照
+        NVIC_EnableIRQ(ADC_IRQn);                   // "core_cm4.h" 参照
+    }    
+
+    // static メンバの実体
+    void (*AdcF446_Intr::fp)();
+}
--- a/ADDA_BasePolling/F446_ADC_Intr.hpp	Wed Jan 15 12:43:11 2020 +0000
+++ b/ADDA_BasePolling/F446_ADC_Intr.hpp	Fri Jan 17 02:04:09 2020 +0000
@@ -1,5 +1,5 @@
 //-------------------------------------------------------------
-//  F446 内蔵 ADC2 を割込み方式で使うための派生クラス
+//  F446 内蔵 ADC2 を割込み方式で使うための派生クラス(ヘッダ)
 //      基底クラス: AdcF446_Polling
 //
 //  2020/01/12, Copyright (c) 2020 MIKAMI, Naoki
@@ -25,16 +25,12 @@
         virtual ~AdcF446_Intr() {}
 
         // 割込みベクタの設定と AD 変換割込みを有効にする
-        void SetIntrVec(void (*Func)())
-        {
-            fp = Func;          // 引数として渡された処理を割り当てる
-            NVIC_SetVector(ADC_IRQn, (uint32_t)Isr);    // "core_cm4.h" 参照
-            NVIC_EnableIRQ(ADC_IRQn);                   // "core_cm4.h" 参照
-        }    
+        void SetIntrVec(void (*Func)());
 
         // AD 変換された値を読み込む
         //      -1.0f <= AD変換された値 < 1.0f
         virtual float Read() const { return ToFloat(myAdc_->DR); }
+
     private:
         static void (*fp)();    // 割込みサービス・ルーチンの中で実行される関数のポインタ
 
@@ -42,8 +38,5 @@
         static void Isr()
         {   if ((myAdc_->SR & ADC_SR_EOC_Msk) == ADC_SR_EOC) fp(); }
     };
-
-    // static メンバの実体
-    void (*AdcF446_Intr::fp)();
 }
 #endif  // ADC_F446_INTERRUPT_HPP