WPILibC++  2019.2.1-24-g74f7ba0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Interrupts.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/AnalogTrigger.h"
13 #include "hal/Types.h"
14 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 typedef void (*HAL_InterruptHandlerFunction)(uint32_t interruptAssertedMask,
26  void* param);
27 
34 HAL_InterruptHandle HAL_InitializeInterrupts(HAL_Bool watcher, int32_t* status);
35 
43 void* HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status);
44 
54 int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle,
55  double timeout, HAL_Bool ignorePrevious,
56  int32_t* status);
57 
67 void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle, int32_t* status);
68 
74 void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle,
75  int32_t* status);
76 
87 int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
88  int32_t* status);
89 
100 int64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
101  int32_t* status);
102 
111 void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
112  HAL_Handle digitalSourceHandle,
113  HAL_AnalogTriggerType analogTriggerType,
114  int32_t* status);
115 
126 void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle,
127  HAL_InterruptHandlerFunction handler,
128  void* param, int32_t* status);
129 
140 void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interruptHandle,
141  HAL_InterruptHandlerFunction handler,
142  void* param, int32_t* status);
143 
153 void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
154  HAL_Bool risingEdge, HAL_Bool fallingEdge,
155  int32_t* status);
156 #ifdef __cplusplus
157 } // extern "C"
158 #endif
159 
void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t *status)
Sets the edges to trigger the interrupt on.
int64_t HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle, int32_t *status)
Returns the timestamp for the rising interrupt that occurred most recently.
void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle, HAL_InterruptHandlerFunction handler, void *param, int32_t *status)
Attaches an asynchronous interrupt handler to the interrupt.
void * HAL_CleanInterrupts(HAL_InterruptHandle interruptHandle, int32_t *status)
Frees an interrupt.
void HAL_EnableInterrupts(HAL_InterruptHandle interruptHandle, int32_t *status)
Enables interrupts to occur on this input.
int64_t HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle, int32_t *status)
Returns the timestamp for the falling interrupt that occurred most recently.
void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interruptHandle, HAL_InterruptHandlerFunction handler, void *param, int32_t *status)
Attaches an asynchronous interrupt handler to the interrupt.
int64_t HAL_WaitForInterrupt(HAL_InterruptHandle interruptHandle, double timeout, HAL_Bool ignorePrevious, int32_t *status)
In synchronous mode, waits for the defined interrupt to occur.
void HAL_DisableInterrupts(HAL_InterruptHandle interruptHandle, int32_t *status)
Disables interrupts without without deallocating structures.
void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle, HAL_Handle digitalSourceHandle, HAL_AnalogTriggerType analogTriggerType, int32_t *status)
Requests interrupts on a specific digital source.
HAL_InterruptHandle HAL_InitializeInterrupts(HAL_Bool watcher, int32_t *status)
Initializes an interrupt.