This repository has been archived by the owner on Jun 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
encoder.h
robz edited this page Sep 20, 2013
·
5 revisions
Go to the source code for encoder.h
#include "gpio.h"
tEncoder *InitializeEncoder(tPin a, tPin b, tBoolean invert);
signed long GetEncoder(tEncoder *enc);
void ResetEncoder(tEncoder *enc);
tEncoder *InitializeEncoder(tPin a, tPin b, tBoolean invert);
Initializes an encoder on a pair of pins
Parameters:
-
a
Pin that the encoder A line should be plugged into -
b
Pin that the encoder B line should be plugged into -
invert
Flag to switch the direction that the encoder value is incremented
Returns:
- Pointer to a tEncoder used by the GetEncoder and ResetEncoder functions
signed long GetEncoder(tEncoder *enc);
Gets the accumulated value for an encoder
Parameters:
-
enc
Pointer to a tEncoder that was returned by the InitializeEncoder function
Returns:
- Accumulated encoder value
void ResetEncoder(tEncoder *enc);
Clears any ticks that have been accumulated for an encoder
Parameters:
-
enc
Pointer to a tEncoder that was returned by the InitializeEncoder function