不韋 呂 / UIT_ADDA

Dependents:   UIT2_MovingAverage UIT2_AllpassReverb UIT2_CombReverb UIT2_FIR_LPF_Symmetry ... more

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Wed Dec 31 10:21:54 2014 +0000
Parent:
14:6c60601c1834
Child:
16:0001d3e93bee
Commit message:
16

Changed in this revision

ADC_Base.cpp Show annotated file Show diff for this revision Revisions of this file
ADC_Base.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/ADC_Base.cpp	Sun Dec 21 08:07:09 2014 +0000
+++ b/ADC_Base.cpp	Wed Dec 31 10:21:54 2014 +0000
@@ -3,7 +3,7 @@
 //      To get bit definition for register in
 //      peripheral, see "stm32f401xe.h"
 //
-// 2014/12/19, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/12/31, Copyright (c) 2014 MIKAMI, Naoki
 //------------------------------------------------------
 
 #include "ADC_Base.hpp"
@@ -12,30 +12,29 @@
 {
     ADC_Base::ADC_Base(PinName pin1, int frequency,
                        PinName pin2, PinName pin3)
-        : adc_(pin1), /*PIN1_(pin1), PIN2_(pin2),
-          PIN3_(pin3), */myAdc_(ADC1)
+        : adc_(pin1), myAdc_(ADC1)
     {
         myAdc_->CR2 = ADC_EXTERNALTRIGCONVEDGE_RISING   // External Trigger on the rising edge
                     | ADC_EXTERNALTRIGCONV_T2_TRGO      // Use Timer2 TRGO event
                     | ADC_CR2_ADON;                     // Enable ADC
 
-        ch1_ = GetChannel(pin1);
+        ch1_ = GetChannelNumber(pin1);
         if (pin2 != NC)
         {
             adc2_ = new AnalogIn(pin2);
-            ch2_ = GetChannel(pin2);
+            ch2_ = GetChannelNumber(pin2);
         }
         if (pin3 != NC)
         {
             adc3_ = new AnalogIn(pin3);
-            ch3_ = GetChannel(pin3);
+            ch3_ = GetChannelNumber(pin3);
         }
         SetTim2(frequency);
         Select1stChannel();
     }
 
     // Extract channel number
-    uint8_t ADC_Base::GetChannel(PinName pin)
+    uint8_t ADC_Base::GetChannelNumber(PinName pin)
     {
         uint8_t ch = 0;
         if ((pin & 0x30) == 0x00) ch = pin;
@@ -59,3 +58,4 @@
     }
 }
 
+
--- a/ADC_Base.hpp	Sun Dec 21 08:07:09 2014 +0000
+++ b/ADC_Base.hpp	Wed Dec 31 10:21:54 2014 +0000
@@ -1,7 +1,7 @@
 //------------------------------------------------------
 // Class for ADC using TIM2 trigger -- Header
 //
-// 2014/12/19, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/12/31, Copyright (c) 2014 MIKAMI, Naoki
 //------------------------------------------------------
 
 #ifndef ADC_BASE_HPP
@@ -18,7 +18,7 @@
         // initialized by menber initializer
         AnalogIn adc_;
         // Following two objects of AnalogIn class will be
-        // initailized by regular excutable statements
+        // initailized by regular executable statements
         AnalogIn* adc2_;
         AnalogIn* adc3_;
 
@@ -29,7 +29,7 @@
         void SetTim2(int frequency);
         
         // Exctract channel number
-        uint8_t GetChannel(PinName);
+        uint8_t GetChannelNumber(PinName);
 
         // for inhibition of copy constructor
         ADC_Base(const ADC_Base&);