WPILibC++  2020.3.2
AnalogInput.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2019 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 
64 void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle,
65  HAL_SimDeviceHandle device);
66 
74 void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status);
75 
84 double HAL_GetAnalogSampleRate(int32_t* status);
85 
96 void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
97  int32_t bits, int32_t* status);
98 
108 int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle,
109  int32_t* status);
110 
122 void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
123  int32_t bits, int32_t* status);
124 
135 int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle,
136  int32_t* status);
137 
148 int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle,
149  int32_t* status);
150 
165 int32_t HAL_GetAnalogAverageValue(HAL_AnalogInputHandle analogPortHandle,
166  int32_t* status);
167 
180 int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle,
181  double voltage, int32_t* status);
182 
192 double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle,
193  int32_t* status);
194 
208 double HAL_GetAnalogAverageVoltage(HAL_AnalogInputHandle analogPortHandle,
209  int32_t* status);
210 
221 int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle,
222  int32_t* status);
223 
234 int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle,
235  int32_t* status);
236 
244 double HAL_GetAnalogValueToVolts(HAL_AnalogInputHandle analogPortHandle,
245  int32_t rawValue, int32_t* status);
246 #ifdef __cplusplus
247 } // extern "C"
248 #endif
249 
HAL_SetAnalogSampleRate
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t *status)
Sets the sample rate.
HAL_GetAnalogAverageValue
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.
HAL_CheckAnalogModule
HAL_Bool HAL_CheckAnalogModule(int32_t module)
Checks that the analog module number is valid.
HAL_GetAnalogOversampleBits
int32_t HAL_GetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the number of oversample bits.
HAL_FreeAnalogInputPort
void HAL_FreeAnalogInputPort(HAL_AnalogInputHandle analogPortHandle)
Frees an analog input port.
HAL_CheckAnalogInputChannel
HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel)
Checks that the analog output channel number is value.
HAL_GetAnalogValue
int32_t HAL_GetAnalogValue(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a sample straight from the channel on this module.
HAL_GetAnalogSampleRate
double HAL_GetAnalogSampleRate(int32_t *status)
Gets the current sample rate.
HAL_GetAnalogOffset
int32_t HAL_GetAnalogOffset(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the factory scaling offset constant.
HAL_GetAnalogVoltage
double HAL_GetAnalogVoltage(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets a scaled sample straight from the channel on this module.
HAL_GetAnalogAverageBits
int32_t HAL_GetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the number of averaging bits.
HAL_SetAnalogAverageBits
void HAL_SetAnalogAverageBits(HAL_AnalogInputHandle analogPortHandle, int32_t bits, int32_t *status)
Sets the number of averaging bits.
HAL_InitializeAnalogInputPort
HAL_AnalogInputHandle HAL_InitializeAnalogInputPort(HAL_PortHandle portHandle, int32_t *status)
Initializes the analog input port using the given port object.
HAL_GetAnalogVoltsToValue
int32_t HAL_GetAnalogVoltsToValue(HAL_AnalogInputHandle analogPortHandle, double voltage, int32_t *status)
Converts a voltage to a raw value for a specified channel.
HAL_SetAnalogInputSimDevice
void HAL_SetAnalogInputSimDevice(HAL_AnalogInputHandle handle, HAL_SimDeviceHandle device)
Indicates the analog input is used by a simulated device.
HAL_SetAnalogOversampleBits
void HAL_SetAnalogOversampleBits(HAL_AnalogInputHandle analogPortHandle, int32_t bits, int32_t *status)
Sets the number of oversample bits.
HAL_GetAnalogAverageVoltage
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.
HAL_GetAnalogValueToVolts
double HAL_GetAnalogValueToVolts(HAL_AnalogInputHandle analogPortHandle, int32_t rawValue, int32_t *status)
Get the analog voltage from a raw value.
HAL_GetAnalogLSBWeight
int32_t HAL_GetAnalogLSBWeight(HAL_AnalogInputHandle analogPortHandle, int32_t *status)
Gets the factory scaling least significant bit weight constant.