mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Switch away from NI interrupt manager to custom implementation (#3705)
* Switch away from NI interrupt manager to custom implementation * Formatting * Fix tidy * Formatting * Fix loading * Make interrupt api public * Add multiple wait api * Formatting * Fix build * Fix review comments * wpiformat Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include "hal/HAL.h"
|
||||
#include "hal/Threads.h"
|
||||
#include "hal/handles/UnlimitedHandleResource.h"
|
||||
#include "hal/roborio/InterruptManager.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
@@ -106,10 +107,15 @@ static void alarmCallback() {
|
||||
}
|
||||
|
||||
static void notifierThreadMain() {
|
||||
tRioStatusCode status = 0;
|
||||
tInterruptManager manager{1 << kTimerInterruptNumber, true, &status};
|
||||
InterruptManager& manager = InterruptManager::GetInstance();
|
||||
NiFpga_IrqContext context = manager.GetContext();
|
||||
uint32_t mask = 1 << kTimerInterruptNumber;
|
||||
int32_t status = 0;
|
||||
|
||||
while (notifierRunning) {
|
||||
auto triggeredMask = manager.watch(10000, false, &status);
|
||||
status = 0;
|
||||
auto triggeredMask =
|
||||
manager.WaitForInterrupt(context, mask, false, 10000, &status);
|
||||
if (!notifierRunning) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user