不韋 呂 / 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 Nov 12 08:56:31 2014 +0000
Parent:
7:6a9c1633dd90
Child:
9:72fe42a4323c
Commit message:
9

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
DAC_MCP4922.cpp Show annotated file Show diff for this revision Revisions of this file
DAC_MCP4922.hpp Show annotated file Show diff for this revision Revisions of this file
ScfClockTim3.hpp Show diff for this revision Revisions of this file
--- a/ADC_Base.cpp	Tue Nov 11 10:04:00 2014 +0000
+++ b/ADC_Base.cpp	Wed Nov 12 08:56:31 2014 +0000
@@ -28,7 +28,9 @@
     void ADC_Base::SetTim2(int frequency)
     {
         __TIM2_CLK_ENABLE();    // Supply clock, See "stm32f4xx_hal_rcc.h"
-        SystemInit();           // Set core clock (for F411RE)
+        
+        SystemCoreClockUpdate();    // Update core clock (for F411RE)
+                                    // See system_stm32f4xx.h
 
         TIM_TypeDef* myTim = TIM2;
 
@@ -40,3 +42,4 @@
 }
 
 
+
--- a/ADC_Base.hpp	Tue Nov 11 10:04:00 2014 +0000
+++ b/ADC_Base.hpp	Wed Nov 12 08:56:31 2014 +0000
@@ -40,8 +40,8 @@
         // for normalize   
         static const float AMP_ = 1.0f/2048.0f;
 
-        ADC_TypeDef* const myAdc_;     
-        
+        ADC_TypeDef* const myAdc_;
+
         // Wait until completion of AD conversion
         void WaitDone()
         { while((myAdc_->SR & ADC_SR_EOC) == RESET); }
--- a/DAC_MCP4922.cpp	Tue Nov 11 10:04:00 2014 +0000
+++ b/DAC_MCP4922.cpp	Wed Nov 12 08:56:31 2014 +0000
@@ -1,7 +1,7 @@
 //------------------------------------------------------
 // Class for single DAC in MCP4922
 //
-// 2014/09/29, Copyright (c) 2014 MIKAMI, Naoki
+// 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki
 //------------------------------------------------------
 
 #include "DAC_MCP4922.hpp"
@@ -55,4 +55,15 @@
         ss_->SlaveSelect();
         mySpi_->DR = value | wcr_;
     }
+
+    void DAC_MCP4922::ScfClockTim3(uint32_t clock)
+    {
+        PwmOut clockSCF_(D9);
+        
+        TIM3->ARR =  SystemCoreClock/clock - 1;
+        TIM3->PSC = 0;
+        // Set capture/compare register 2
+        TIM3->CCR2 = (TIM3->ARR + 1)/2;    
+    }
 }
+
--- a/DAC_MCP4922.hpp	Tue Nov 11 10:04:00 2014 +0000
+++ b/DAC_MCP4922.hpp	Wed Nov 12 08:56:31 2014 +0000
@@ -5,10 +5,16 @@
 // Default pin assign
 //      D11  SPI Master Out Slave In
 //      D13  SPI Serial Clock
-//      D12  SPI Slave Select
-//      D10  to MCP4922 LDAC pin
+//      D10  SPI Slave Select
+//      D12  to MCP4922 LDAC pin
 //
-// 2014/10/23, Copyright (c) 2014 MIKAMI, Naoki
+// Argument cs in constructor must be output of TIM4,
+// i.e. D10(PB_6), PB_7, D15(PB_8), or D14(PB_9)
+//
+// Clock for Switched-capacitor filter:
+//      Output pin: D9 (PC7) ------ TIM3 CH2
+//
+// 2014/11/12, Copyright (c) 2014 MIKAMI, Naoki
 //------------------------------------------------------
 
 #ifndef DAC_MCP4922_HPP
@@ -44,6 +50,10 @@
         // Check busy
         bool IsBusy()
         { return (mySpi_->SR & SPI_FLAG_BSY) == SPI_FLAG_BSY; }
+        
+        // Set clock for switched-capacitor filter
+        void ScfClockTim3(uint32_t clock);
+
 
     private:
         uint16_t wcr_;  // write command register
--- a/ScfClockTim3.hpp	Tue Nov 11 10:04:00 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-//--------------------------------------------------------
-// Clock generator for SCF using PwmOut class
-//      Output pin: D9 (PC7) ------ TIM3 CH2
-// 2014/09/30, Copyright (c) 2014 MIKAMI, Naoki
-//--------------------------------------------------------
-
-#ifndef SCF_CLOCK_TIM3_HPP
-#define SCF_CLOCK_TIM3_HPP
-
-#include "mbed.h"
- 
-namespace Mikami
-{
-    void ScfClockTim3(uint32_t clock)
-    {
-        PwmOut clockSCF_(D9);
-        
-        TIM3->ARR =  SystemCoreClock/clock - 1;
-        TIM3->PSC = 0;
-        // Set capture/compare register 2
-        TIM3->CCR2 = (TIM3->ARR + 1)/2;    
-    }
-}
-#endif  // SCF_CLOCK_TIM3_HPP
\ No newline at end of file