WPILibC++  2018.4.1-20180824021726-1174-g488ba79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
AnalogInput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2018 FIRST. 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/Types.h"
13 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
30 HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(HAL_PortHandle portHandle,
31  int32_t* status);
32 
38 void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle);
39 
46 HAL_Bool HAL_CheckAnalogModule(int32_t module);
47 
56 HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel);
57 
65 void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
66 
75 double HAL_GetAnalogSampleRate(int32_t* status);
76 
87 void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
88  int32_t bits, int32_t* status);
89 
99 int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
100  int32_t* status);
101 
113 void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
114  int32_t bits, int32_t* status);
115 
126 int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
127  int32_t* status);
128 
139 int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
140  int32_t* status);
141 
156 int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
157  int32_t* status);
158 
171 int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
172  double voltage, int32_t* status);
173 
183 double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
184  int32_t* status);
185 
199 double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
200  int32_t* status);
201 
212 int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
213  int32_t* status);
214 
225 int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
226  int32_t* status);
227 #ifdef __cplusplus
228 } // extern "C"
229 #endif
230 
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a sample straight from the channel on this module.
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a scaled sample straight from the channel on this module.
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle, int32_t bits, int32_t *status)
Sets the number of oversample bits.
HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel)
Checks that the analog output channel number is value.
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t *status)
Sets the sample rate.
double HAL_GetAnalogSampleRate(int32_t *status)
Gets the current sample rate.
int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle, double voltage, int32_t *status)
Converts a voltage to a raw value for a specified channel.
void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle)
Frees an analog input port.
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(HAL_PortHandle portHandle, int32_t *status)
Initializes the analog input port using the given port object.
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the factory scaling offset constant.
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the number of oversample bits.
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle, int32_t bits, int32_t *status)
Sets the number of averaging bits.
double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a scaled sample from the output of the oversample and average engine for the channel...
int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a sample from the output of the oversample and average engine for the channel.
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the factory scaling least significant bit weight constant.
HAL_Bool HAL_CheckAnalogModule(int32_t module)
Checks that the analog module number is valid.
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the number of averaging bits.