Header for the encoder driver. More...
Go to the source code of this file.
Data Structures | |
struct | _vexQuadEncoder_t |
Holds information relating to an encoder. More... | |
Typedefs | |
typedef struct _vexQuadEncoder_t | vexQuadEncoder_t |
Holds information relating to an encoder. More... | |
Enumerations | |
enum | tVexQuadEncoderChannel { kVexQuadEncoder_1 = 0, kVexQuadEncoder_2, kVexQuadEncoder_3, kVexQuadEncoder_4, kVexQuadEncoder_5, kVexQuadEncoder_Num } |
Encoder channel number. More... | |
Functions | |
void | vexEncoderInit (void) |
Initialize all the encoder data, counts to zero etc. More... | |
void | vexEncoderAdd (tVexQuadEncoderChannel channel, tVexDigitalPin pa, tVexDigitalPin pb) |
Add an encoder to the system. More... | |
void | vexEncoderStart (tVexQuadEncoderChannel channel) |
Start an encoder interrupt handler. More... | |
void | vexEncoderStop (tVexQuadEncoderChannel channel) |
Stop an encoder interrupt handler. More... | |
void | vexEncoderStartAll (void) |
Start all encoder interrupt handlers. More... | |
int32_t | vexEncoderGet (int16_t channel) |
Get encoder count. More... | |
void | vexEncoderSet (int16_t channel, int32_t value) |
Get encoder count. More... | |
int16_t | vexEncoderGetId (int16_t channel) |
Get encoder id. More... | |
void | vexEncoderDebug (vexStream *chp, int argc, char *argv[]) |
Send all encoder raw values and offsets to the console. More... | |
Header for the encoder driver.
typedef struct _vexQuadEncoder_t vexQuadEncoder_t |
Holds information relating to an encoder.
void vexEncoderInit | ( | void | ) |
Initialize all the encoder data, counts to zero etc.
void vexEncoderAdd | ( | tVexQuadEncoderChannel | channel, |
tVexDigitalPin | pa, | ||
tVexDigitalPin | pb | ||
) |
Add an encoder to the system.
[in] | channel | The encoder channel |
[in] | pa | The first input pin used by the encoder |
[in] | pb | The second input pin used by the encoder |
Setup the interrupt handlers for an encoder but do not enable them
void vexEncoderStart | ( | tVexQuadEncoderChannel | channel) |
Start an encoder interrupt handler.
[in] | channel | The encoder channel to start the irq handler on |
void vexEncoderStop | ( | tVexQuadEncoderChannel | channel) |
Stop an encoder interrupt handler.
[in] | channel | The encoder channel to stop the irq handler on |
void vexEncoderStartAll | ( | void | ) |
Start all encoder interrupt handlers.
int32_t vexEncoderGet | ( | int16_t | channel) |
Get encoder count.
[in] | channel | The encoder channel |
Get an encoder count for a channel, we don't use the enumerated channel type so this can be used without warnings from other code in a callback. Typically the motor control code may call this and not know what type of encoder is being used, a quad encoder or an IME
void vexEncoderSet | ( | int16_t | channel, |
int32_t | value | ||
) |
Get encoder count.
[in] | channel | The encoder channel |
[in] | value | The value to set the encoder to |
Set encoder count for a channel, this saves the value as an offset to the current count
int16_t vexEncoderGetId | ( | int16_t | channel) |
Get encoder id.
[in] | channel | The encoder channel |
Get an encoder id for a channel, we don't use the enumerated type so this can be used without warnings from other code in a callback. Typically the motor control code may call this and not know what type of encoder is being used, a quad encoder or an IME The encoder id is basically the pin number for inputA
void vexEncoderDebug | ( | vexStream * | chp, |
int | argc, | ||
char * | argv[] | ||
) |
Send all encoder raw values and offsets to the console.
[in] | chp | A pointer to a vexStream object |
[in] | argc | The number of command line arguments |
[in] | argv | An array of pointers to the command line args |