32bits encoder counter using 16bits TIM and a 32bits software counter

Dependents:   v1 v2 v2bis GestionPixy ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Nucleo_Encoder_16_bits.h Source File

Nucleo_Encoder_16_bits.h

00001 #ifndef ENCODER_H
00002 #define ENCODER_H
00003 #include "mbed.h"
00004 
00005 void EncoderInit(TIM_Encoder_InitTypeDef * encoder, TIM_HandleTypeDef * timer, TIM_TypeDef * TIMx, uint32_t maxcount, uint32_t encmode);
00006 
00007 
00008 namespace mbed{
00009     
00010     class Nucleo_Encoder_16_bits {
00011         
00012         public :
00013             Nucleo_Encoder_16_bits(TIM_TypeDef * _TIM);
00014             Nucleo_Encoder_16_bits(TIM_TypeDef * _TIM, uint32_t _maxcount, uint32_t _encmode);
00015             Nucleo_Encoder_16_bits(TIM_Encoder_InitTypeDef * _encoder, TIM_HandleTypeDef * _timer, TIM_TypeDef * _TIM, uint32_t _maxcount, uint32_t _encmode);
00016             int32_t GetCounter();
00017             TIM_HandleTypeDef* GetTimer();
00018         
00019         private :
00020         
00021         
00022         protected :
00023             TIM_Encoder_InitTypeDef encoder;
00024             TIM_HandleTypeDef timer;
00025             TIM_TypeDef * TIM;
00026         
00027     };
00028 
00029 }// namespace mbed
00030 
00031 #endif