WPILibC++  2018.4.1-20180923204725-1195-g5c6b78e
 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 
85 double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle,
86  int32_t* status);
87 
96 double HAL_ReadInterruptFallingTimestamp(HAL_InterruptHandle interruptHandle,
97  int32_t* status);
98 
107 void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
108  HAL_Handle digitalSourceHandle,
109  HAL_AnalogTriggerType analogTriggerType,
110  int32_t* status);
111 
122 void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle,
123  HAL_InterruptHandlerFunction handler,
124  void* param, int32_t* status);
125 
136 void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interruptHandle,
137  HAL_InterruptHandlerFunction handler,
138  void* param, int32_t* status);
139 
149 void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
150  HAL_Bool risingEdge, HAL_Bool fallingEdge,
151  int32_t* status);
152 #ifdef __cplusplus
153 } // extern "C"
154 #endif
155 
void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle, HAL_Bool risingEdge, HAL_Bool fallingEdge, int32_t *status)
Sets the edges to trigger the interrupt on.
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.
double 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.
double HAL_ReadInterruptRisingTimestamp(HAL_InterruptHandle interruptHandle, int32_t *status)
Returns the timestamp for the rising interrupt that occurred most recently.
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.