Quad Encoder driver.
More...
#include <stdlib.h>
#include "ch.h"
#include "hal.h"
#include "vex.h"
void vexEncoderInit |
( |
void |
) | |
|
Initialize all the encoder data, counts to zero etc.
Add an encoder to the system.
- Parameters
-
[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
Start an encoder interrupt handler.
- Parameters
-
[in] | channel | The encoder channel to start the irq handler on |
Stop an encoder interrupt handler.
- Parameters
-
[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.
- Parameters
-
[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.
- Parameters
-
[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.
- Parameters
-
[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.
- Parameters
-
[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 |