不韋 呂 / UIT_ADDA

Dependents:   UIT2_MovingAverage UIT2_AllpassReverb UIT2_CombReverb UIT2_FIR_LPF_Symmetry ... more

ScfClockTim3.hpp

Committer:
MikamiUitOpen
Date:
2014-10-20
Revision:
0:6e0ed5adfe47

File content as of revision 0:6e0ed5adfe47:

//--------------------------------------------------------
// 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