TI RSLK Library  0.2.0
Macros | Functions
Encoder.h File Reference
#include <stdint.h>

Go to the source code of this file.

Macros

#define WHEEL_DIR_FORWARD   1
 Value used to reference wheel going forward.
 
#define WHEEL_DIR_BACKWARD   0
 Value used to reference wheel going backwards.
 

Functions

void setupEncoder (uint8_t ela_pin, uint8_t elb_pin, uint8_t era_pin, uint8_t erb_pin)
 Initialize the wheel encoder. More...
 
uint32_t getEncoderLeftCnt ()
 Return number of encoder ticks from the left wheel. More...
 
uint32_t getEncoderRightCnt ()
 Return number of encoder ticks from the right wheel. More...
 
void resetLeftEncoderCnt ()
 Set the left encoder tick count to 0.
 
void resetRightEncoderCnt ()
 Set the right encoder tick count to 0.
 
uint8_t getLeftWheelDir ()
 Determines if the left wheel is going forward or backwards. More...
 
uint8_t getRightWheelDir ()
 Determines if the right wheel is going forward or backwards. More...
 

Function Documentation

◆ getEncoderLeftCnt()

uint32_t getEncoderLeftCnt ( )

Return number of encoder ticks from the left wheel.

Returns
The number of encoder ticks from the left wheel.

Definition at line 53 of file Encoder.cpp.

◆ getEncoderRightCnt()

uint32_t getEncoderRightCnt ( )

Return number of encoder ticks from the right wheel.

Returns
The number of encoder ticks from the right wheel.

Definition at line 49 of file Encoder.cpp.

◆ getLeftWheelDir()

uint8_t getLeftWheelDir ( )

Determines if the left wheel is going forward or backwards.

Returns
1 for forward or 0 for backwards

Definition at line 65 of file Encoder.cpp.

◆ getRightWheelDir()

uint8_t getRightWheelDir ( )

Determines if the right wheel is going forward or backwards.

Returns
1 for forward or 0 for backwards

Definition at line 68 of file Encoder.cpp.

◆ setupEncoder()

void setupEncoder ( uint8_t  ela_pin,
uint8_t  elb_pin,
uint8_t  era_pin,
uint8_t  erb_pin 
)

Initialize the wheel encoder.

Parameters
[in]ela_pinpin number on Launchpad connected to ELA pin on encoder.
[in]elb_pinpin number on Launchpad connected to ELB pin on encoder.
[in]era_pinpin number on Launchpad connected to ERA pin on encoder.
[in]erb_pinpin number on Launchpad connected to ERB pin on encoder.

This function needs to be called before any other encoder function is used.

Definition at line 32 of file Encoder.cpp.