2016-05-25 20:23:37 -07:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
|
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
|
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2016-05-24 00:58:10 -07:00
|
|
|
#pragma once
|
2016-05-25 22:38:11 -07:00
|
|
|
|
2016-05-24 00:58:10 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2016-07-07 21:43:55 -07:00
|
|
|
#include "HAL/AnalogTrigger.h"
|
2016-07-03 15:22:22 -07:00
|
|
|
#include "HAL/Handles.h"
|
|
|
|
|
|
2016-05-24 00:58:10 -07:00
|
|
|
extern "C" {
|
2016-07-09 00:24:26 -07:00
|
|
|
enum HAL_EncoderIndexingType {
|
2016-07-03 15:22:22 -07:00
|
|
|
HAL_kResetWhileHigh,
|
|
|
|
|
HAL_kResetWhileLow,
|
|
|
|
|
HAL_kResetOnFallingEdge,
|
|
|
|
|
HAL_kResetOnRisingEdge
|
|
|
|
|
};
|
2016-07-09 00:24:26 -07:00
|
|
|
enum HAL_EncoderEncodingType {
|
|
|
|
|
HAL_Encoder_k1X,
|
|
|
|
|
HAL_Encoder_k2X,
|
|
|
|
|
HAL_Encoder_k4X
|
|
|
|
|
};
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_EncoderHandle HAL_InitializeEncoder(
|
|
|
|
|
HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA,
|
|
|
|
|
HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB,
|
|
|
|
|
bool reverseDirection, HAL_EncoderEncodingType encodingType,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
void HAL_FreeEncoder(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
int32_t HAL_GetEncoder(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
void HAL_ResetEncoder(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
int32_t HAL_GetEncoderPeriod(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoder_handle, double maxPeriod,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
uint8_t HAL_GetEncoderStopped(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
uint8_t HAL_GetEncoderDirection(HAL_EncoderHandle encoder_handle,
|
2016-05-24 00:58:10 -07:00
|
|
|
int32_t* status);
|
2016-07-09 00:24:26 -07:00
|
|
|
double HAL_GetEncoderDistance(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
double HAL_GetEncoderRate(HAL_EncoderHandle encoder_handle, int32_t* status);
|
|
|
|
|
void HAL_SetEncoderMinRate(HAL_EncoderHandle encoder_handle, double minRate,
|
|
|
|
|
int32_t* status);
|
|
|
|
|
void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
double distancePerPulse, int32_t* status);
|
|
|
|
|
void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
uint8_t reverseDirection, int32_t* status);
|
|
|
|
|
void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t samplesToAverage, int32_t* status);
|
|
|
|
|
int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
HAL_Handle digitalSourceHandle,
|
|
|
|
|
HAL_AnalogTriggerType analogTriggerType,
|
|
|
|
|
HAL_EncoderIndexingType type, int32_t* status);
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoder_handle,
|
|
|
|
|
int32_t* status);
|
2016-07-03 15:22:22 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_EncoderEncodingType HAL_GetEncoderEncodingType(
|
|
|
|
|
HAL_EncoderHandle encoder_handle, int32_t* status);
|
2016-05-24 00:58:10 -07:00
|
|
|
}
|