Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: Capteurs/Encodeur.h
- Revision:
- 0:1cfd66c3a181
diff -r 000000000000 -r 1cfd66c3a181 Capteurs/Encodeur.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Capteurs/Encodeur.h Wed May 22 16:54:27 2019 +0000 @@ -0,0 +1,39 @@ +#ifndef ENCODEUR_H +#define ENCODEUR_H + +#include "mbed.h" + +#ifndef M_PI +//#define M_PI 3.14159265358979323846 +#define M_PI 3.14159265358979323846f +#endif + +// Initialisation du Timer pour l'Encodeur: +void EncodeurInit(TIM_Encoder_InitTypeDef* encodeur, TIM_HandleTypeDef* timer, TIM_TypeDef* TIMx, uint32_t resolution); + +class Encodeur { + public: + // Constructeur: + Encodeur(char e, int resolution, int diametre); + + // Getters & Setter: + uint16_t getCount(); + int getTotalCount(); + int getTours(); + int* getTours_ptr(); + void updateTour(int); + int getDist(); // en mm + + int getDiametre(); // en mm + int getResolution(); + float getTicks_par_mm(); + + private: + int m_tours; + int m_resolution; + int m_diametre; // en mm + float m_ticks_par_mm; + TIM_HandleTypeDef* m_timer; +}; + +#endif \ No newline at end of file