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:
Thad House
2022-10-13 17:25:54 -07:00
committed by GitHub
parent ca43fe2798
commit 58b6484dbe
11 changed files with 272 additions and 16 deletions

View File

@@ -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;
}