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-12 10:45:14 -07:00
|
|
|
#include "HAL/Types.h"
|
2016-07-01 00:29:08 -07:00
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
enum HAL_Counter_Mode {
|
|
|
|
|
HAL_Counter_kTwoPulse = 0,
|
|
|
|
|
HAL_Counter_kSemiperiod = 1,
|
|
|
|
|
HAL_Counter_kPulseLength = 2,
|
|
|
|
|
HAL_Counter_kExternalDirection = 3
|
2016-05-24 00:58:10 -07:00
|
|
|
};
|
|
|
|
|
|
2016-07-12 21:53:06 -07:00
|
|
|
#ifdef __cplusplus
|
2016-05-24 00:58:10 -07:00
|
|
|
extern "C" {
|
2016-07-12 21:53:06 -07:00
|
|
|
#endif
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_CounterHandle HAL_InitializeCounter(HAL_Counter_Mode mode, int32_t* index,
|
|
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_FreeCounter(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
void HAL_SetCounterAverageSize(HAL_CounterHandle counterHandle, int32_t size,
|
2016-05-24 00:58:10 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpSource(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_Handle digitalSourceHandle,
|
|
|
|
|
HAL_AnalogTriggerType analogTriggerType,
|
|
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpSourceEdge(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool risingEdge, HAL_Bool fallingEdge,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_ClearCounterUpSource(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
void HAL_SetCounterDownSource(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_Handle digitalSourceHandle,
|
|
|
|
|
HAL_AnalogTriggerType analogTriggerType,
|
|
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterDownSourceEdge(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool risingEdge, HAL_Bool fallingEdge,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_ClearCounterDownSource(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpDownMode(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
void HAL_SetCounterExternalDirectionMode(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterSemiPeriodMode(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool highSemiPeriod, int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterPulseLengthMode(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
double threshold, int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
int32_t HAL_GetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterSamplesToAverage(HAL_CounterHandle counterHandle,
|
2016-07-09 00:24:26 -07:00
|
|
|
int samplesToAverage, int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_ResetCounter(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
int32_t HAL_GetCounter(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
double HAL_GetCounterPeriod(HAL_CounterHandle counterHandle, int32_t* status);
|
|
|
|
|
void HAL_SetCounterMaxPeriod(HAL_CounterHandle counterHandle, double maxPeriod,
|
2016-07-09 00:24:26 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterUpdateWhenEmpty(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool enabled, int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
HAL_Bool HAL_GetCounterStopped(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
HAL_Bool HAL_GetCounterDirection(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
int32_t* status);
|
2016-08-12 13:45:28 -07:00
|
|
|
void HAL_SetCounterReverseDirection(HAL_CounterHandle counterHandle,
|
2016-07-12 10:45:14 -07:00
|
|
|
HAL_Bool reverseDirection, int32_t* status);
|
2016-07-12 21:53:06 -07:00
|
|
|
#ifdef __cplusplus
|
2016-05-24 00:58:10 -07:00
|
|
|
}
|
2016-07-12 21:53:06 -07:00
|
|
|
#endif
|