WPILibC++  2019.1.1-beta-4-32-g6bdd7ce
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
DIO.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 
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 
49 HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status);
50 
56 void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status);
57 
67 void HAL_SetDigitalPWMRate(double rate, int32_t* status);
68 
75 void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
76  double dutyCycle, int32_t* status);
77 
84 void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
85  int32_t channel, int32_t* status);
86 
94 void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
95  int32_t* status);
96 
103 void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
104  int32_t* status);
105 
112 HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status);
113 
120 HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status);
121 
131 void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
132  int32_t* status);
133 
139 HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status);
140 
146 HAL_Bool HAL_IsAnyPulsing(int32_t* status);
147 
157 void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
158  int32_t* status);
159 
169 int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status);
170 
182 void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status);
183 
196 int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status);
197 #ifdef __cplusplus
198 } // extern "C"
199 #endif
200 
void HAL_SetDigitalPWMRate(double rate, int32_t *status)
Changes the frequency of the DO PWM generator.
void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex, int32_t *status)
Writes the filter index from the FPGA.
void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t *status)
Sets the filter period for the specified filter index.
int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads the filter index from the FPGA.
HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads the direction of a DIO channel.
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength, int32_t *status)
Generates a single digital pulse.
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t *status)
Gets the filter period for the specified filter index.
HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t *status)
Reads a digital value from a DIO channel.
HAL_Bool HAL_IsAnyPulsing(int32_t *status)
Checks if any DIO line is currently generating a pulse.
void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t *status)
Frees the resource associated with a DO PWM generator.
void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator, double dutyCycle, int32_t *status)
Configures the duty-cycle of the PWM generator.
HAL_Bool HAL_CheckDIOChannel(int32_t channel)
Checks if a DIO channel is valid.
HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t *status)
Allocates a DO PWM Generator.
void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator, int32_t channel, int32_t *status)
Configures which DO channel the PWM signal is output on.
void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input, int32_t *status)
Sets the direction of a DIO channel.
HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t *status)
Checks a DIO line to see if it is currently generating a pulse.
void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value, int32_t *status)
Writes a digital value to a DIO channel.
HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle, HAL_Bool input, int32_t *status)
Creates a new instance of a digital port.