Servo example

Dependencies:   Stepper mbed Servo UniServ

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EncoderCounter.h Source File

EncoderCounter.h

00001 /*
00002  * EncoderCounter.h
00003  * Copyright (c) 2018, ZHAW
00004  * All rights reserved.
00005  */
00006 
00007 #ifndef ENCODER_COUNTER_H_
00008 #define ENCODER_COUNTER_H_
00009 
00010 #include <cstdlib>
00011 #include <stdint.h>
00012 #include <mbed.h>
00013 
00014 /**
00015  * This class implements a driver to read the quadrature
00016  * encoder counter of the STM32 microcontroller.
00017  */
00018 class EncoderCounter {
00019     
00020     public:
00021         
00022                     EncoderCounter(PinName a, PinName b);
00023         virtual     ~EncoderCounter();
00024         void        reset();
00025         void        reset(int16_t offset);
00026         int16_t     read();
00027                     operator int16_t();
00028         
00029     private:
00030         
00031         TIM_TypeDef*    TIM;
00032 };
00033 
00034 #endif /* ENCODER_COUNTER_H_ */
00035 
00036 
00037