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