WPILibC++ 2024.3.2
AnalogOutput.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <stdint.h>
8
9#include "hal/Types.h"
10
11/**
12 * @defgroup hal_analogoutput Analog Output Functions
13 * @ingroup hal_capi
14 * @{
15 */
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/**
22 * Initializes the analog output port using the given port object.
23 *
24 * @param[in] portHandle handle to the port
25 * @param[in] allocationLocation the location where the allocation is occurring
26 * (can be null)
27 * @param[out] status Error status variable. 0 on success.
28 * @return the created analog output handle
29 */
31 HAL_PortHandle portHandle, const char* allocationLocation, int32_t* status);
32
33/**
34 * Frees an analog output port.
35 *
36 * @param analogOutputHandle the analog output handle
37 */
39
40/**
41 * Sets an analog output value.
42 *
43 * @param[in] analogOutputHandle the analog output handle
44 * @param[in] voltage the voltage (0-5v) to output
45 * @param[out] status Error status variable. 0 on success.
46 */
48 double voltage, int32_t* status);
49
50/**
51 * Gets the current analog output value.
52 *
53 * @param[in] analogOutputHandle the analog output handle
54 * @param[out] status Error status variable. 0 on success.
55 * @return the current output voltage (0-5v)
56 */
58 int32_t* status);
59
60/**
61 * Checks that the analog output channel number is valid.
62 *
63 * Verifies that the analog channel number is one of the legal channel numbers.
64 * Channel numbers are 0-based.
65 *
66 * @return Analog channel is valid
67 */
69#ifdef __cplusplus
70} // extern "C"
71#endif
72/** @} */
HAL_Bool HAL_CheckAnalogOutputChannel(int32_t channel)
Checks that the analog output channel number is valid.
void HAL_FreeAnalogOutputPort(HAL_AnalogOutputHandle analogOutputHandle)
Frees an analog output port.
HAL_AnalogOutputHandle HAL_InitializeAnalogOutputPort(HAL_PortHandle portHandle, const char *allocationLocation, int32_t *status)
Initializes the analog output port using the given port object.
double HAL_GetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle, int32_t *status)
Gets the current analog output value.
void HAL_SetAnalogOutput(HAL_AnalogOutputHandle analogOutputHandle, double voltage, int32_t *status)
Sets an analog output value.
int32_t HAL_Bool
Definition: Types.h:73
HAL_Handle HAL_PortHandle
Definition: Types.h:19
HAL_Handle HAL_AnalogOutputHandle
Definition: Types.h:23