on test and not completed based on nucleo_hello_encoder library

Dependencies:   mbed

Fork of Nucleo_Hello_Encoder by David Lowe

Encoder/CounterInit.cpp

Committer:
c128
Date:
2015-09-29
Revision:
1:3d2fffa6e19f
Child:
2:70f92ce7d983

File content as of revision 1:3d2fffa6e19f:

#include "mbed.h"

void CounterInit(TIM_IC_InitTypeDef counterSet, TIM_HandleTypeDef timer, TIM_TypeDef *TIMx, uint32_t maxcount)
{
    timer.Instance = TIMx;
    timer.Init.Period = maxcount;
    timer.Init.CounterMode = TIM_COUNTERMODE_UP;
    timer.Init.Prescaler = 0;
    timer.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
    timer.Init.RepetitionCounter = 0;

    counterSet.ICFilter = 0;
    counterSet.ICPolarity = TIM_ICPOLARITY_RISING;
    counterSet.ICPrescaler = TIM_ICPSC_DIV1;
    counterSet.ICSelection = TIM_ICSELECTION_DIRECTTI;

}