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.
Dependencies: mbed mbed-rtos Motor LSM9DS1_Library_cal X_NUCLEO_53L0A1
Encoder.h
- Committer:
- rpatelpj
- Date:
- 2019-04-23
- Revision:
- 11:531208aca075
File content as of revision 11:531208aca075:
#ifndef ENCODER_H
#define ENCODER_H
#include "globals.h"
/**
* Hall Effect Encoder (ROB-12629) bare-metal I/O driver class.
* For more details, visit https://www.sparkfun.com/products/12629
* Fork of https://os.mbed.com/users/electromotivated/code/HALLFX_ENCODER/
*/
class Encoder{
public:
/**
* Encoder constructor. Connect to 3.3 V.
* @param trig mbed pin receiving encoder trigger
*/
Encoder(PinName trig);
/**
* Encoder destructor.
*/
~Encoder();
/**
* Read encoder count.
* @return encoder count
*/
int read();
/**
* Reset encoder count.
*/
void reset();
private:
int count;
InterruptIn _trig;
void increment();
};
#endif /* ENCODER_H */
