WPILibC++  2020.3.2
DIO.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 
31 HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
32  HAL_Bool input, int32_t* status);
33 
40 HAL_Bool HAL_CheckDIOChannel(int32_t channel);
41 
42 void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle);
43 
50 void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device);
51 
57 HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status);
58 
64 void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
65 
75 void HAL_SetDigitalPWMRate(double rate, int32_t* status);
76 
83 void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
84  double dutyCycle, int32_t* status);
85 
92 void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
93  int32_t channel, int32_t* status);
94 
102 void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
103  int32_t* status);
104 
111 void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
112  int32_t* status);
113 
120 HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status);
121 
128 HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status);
129 
139 void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
140  int32_t* status);
141 
147 HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status);
148 
154 HAL_Bool HAL_IsAnyPulsing(int32_t* status);
155 
165 void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
166  int32_t* status);
167 
177 int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
178 
190 void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
191 
204 int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status);
205 #ifdef __cplusplus
206 } // extern "C"
207 #endif
208 
HAL_SetFilterPeriod
void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t *status)
Sets the filter period for the specified filter index.
HAL_GetFilterSelect
int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads the filter index from the FPGA.
HAL_GetDIODirection
HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads the direction of a DIO channel.
HAL_GetFilterPeriod
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t *status)
Gets the filter period for the specified filter index.
HAL_GetDIO
HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads a digital value from a DIO channel.
HAL_Pulse
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength, int32_t *status)
Generates a single digital pulse.
HAL_FreeDigitalPWM
void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t *status)
Frees the resource associated with a DO PWM generator.
HAL_IsAnyPulsing
HAL_Bool HAL_IsAnyPulsing(int32_t *status)
Checks if any DIO line is currently generating a pulse.
HAL_SetDigitalPWMDutyCycle
void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator, double dutyCycle, int32_t *status)
Configures the duty-cycle of the PWM generator.
HAL_CheckDIOChannel
HAL_Bool HAL_CheckDIOChannel(int32_t channel)
Checks if a DIO channel is valid.
HAL_SetDigitalPWMOutputChannel
void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator, int32_t channel, int32_t *status)
Configures which DO channel the PWM signal is output on.
HAL_AllocateDigitalPWM
HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t *status)
Allocates a DO PWM Generator.
HAL_SetDIODirection
void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input, int32_t *status)
Sets the direction of a DIO channel.
HAL_IsPulsing
HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t *status)
Checks a DIO line to see if it is currently generating a pulse.
HAL_SetDigitalPWMRate
void HAL_SetDigitalPWMRate(double rate, int32_t *status)
Changes the frequency of the DO PWM generator.
HAL_SetDIO
void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value, int32_t *status)
Writes a digital value to a DIO channel.
HAL_InitializeDIOPort
HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle, HAL_Bool input, int32_t *status)
Creates a new instance of a digital port.
HAL_SetFilterSelect
void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex, int32_t *status)
Writes the filter index from the FPGA.
HAL_SetDIOSimDevice
void HAL_SetDIOSimDevice(HAL_DigitalHandle handle, HAL_SimDeviceHandle device)
Indicates the DIO channel is used by a simulated device.