Brian Silverman | f7f267a | 2017-02-04 16:16:08 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2016-2017. All Rights Reserved. */ |
| 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ |
| 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ |
| 5 | /* the project. */ |
| 6 | /*----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | |
| 12 | #include "HAL/AnalogTrigger.h" |
| 13 | #include "HAL/Types.h" |
| 14 | |
| 15 | enum HAL_EncoderIndexingType : int32_t { |
| 16 | HAL_kResetWhileHigh, |
| 17 | HAL_kResetWhileLow, |
| 18 | HAL_kResetOnFallingEdge, |
| 19 | HAL_kResetOnRisingEdge |
| 20 | }; |
| 21 | enum HAL_EncoderEncodingType : int32_t { |
| 22 | HAL_Encoder_k1X, |
| 23 | HAL_Encoder_k2X, |
| 24 | HAL_Encoder_k4X |
| 25 | }; |
| 26 | |
| 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | HAL_EncoderHandle HAL_InitializeEncoder( |
| 31 | HAL_Handle digitalSourceHandleA, HAL_AnalogTriggerType analogTriggerTypeA, |
| 32 | HAL_Handle digitalSourceHandleB, HAL_AnalogTriggerType analogTriggerTypeB, |
| 33 | HAL_Bool reverseDirection, HAL_EncoderEncodingType encodingType, |
| 34 | int32_t* status); |
| 35 | void HAL_FreeEncoder(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 36 | int32_t HAL_GetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 37 | int32_t HAL_GetEncoderRaw(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 38 | int32_t HAL_GetEncoderEncodingScale(HAL_EncoderHandle encoderHandle, |
| 39 | int32_t* status); |
| 40 | void HAL_ResetEncoder(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 41 | double HAL_GetEncoderPeriod(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 42 | void HAL_SetEncoderMaxPeriod(HAL_EncoderHandle encoderHandle, double maxPeriod, |
| 43 | int32_t* status); |
| 44 | HAL_Bool HAL_GetEncoderStopped(HAL_EncoderHandle encoderHandle, |
| 45 | int32_t* status); |
| 46 | HAL_Bool HAL_GetEncoderDirection(HAL_EncoderHandle encoderHandle, |
| 47 | int32_t* status); |
| 48 | double HAL_GetEncoderDistance(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 49 | double HAL_GetEncoderRate(HAL_EncoderHandle encoderHandle, int32_t* status); |
| 50 | void HAL_SetEncoderMinRate(HAL_EncoderHandle encoderHandle, double minRate, |
| 51 | int32_t* status); |
| 52 | void HAL_SetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle, |
| 53 | double distancePerPulse, int32_t* status); |
| 54 | void HAL_SetEncoderReverseDirection(HAL_EncoderHandle encoderHandle, |
| 55 | HAL_Bool reverseDirection, int32_t* status); |
| 56 | void HAL_SetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle, |
| 57 | int32_t samplesToAverage, int32_t* status); |
| 58 | int32_t HAL_GetEncoderSamplesToAverage(HAL_EncoderHandle encoderHandle, |
| 59 | int32_t* status); |
| 60 | |
| 61 | void HAL_SetEncoderIndexSource(HAL_EncoderHandle encoderHandle, |
| 62 | HAL_Handle digitalSourceHandle, |
| 63 | HAL_AnalogTriggerType analogTriggerType, |
| 64 | HAL_EncoderIndexingType type, int32_t* status); |
| 65 | |
| 66 | int32_t HAL_GetEncoderFPGAIndex(HAL_EncoderHandle encoderHandle, |
| 67 | int32_t* status); |
| 68 | |
| 69 | double HAL_GetEncoderDecodingScaleFactor(HAL_EncoderHandle encoderHandle, |
| 70 | int32_t* status); |
| 71 | |
| 72 | double HAL_GetEncoderDistancePerPulse(HAL_EncoderHandle encoderHandle, |
| 73 | int32_t* status); |
| 74 | |
| 75 | HAL_EncoderEncodingType HAL_GetEncoderEncodingType( |
| 76 | HAL_EncoderHandle encoderHandle, int32_t* status); |
| 77 | #ifdef __cplusplus |
| 78 | } |
| 79 | #endif |