Add name to HAL Notifier

This commit is contained in:
Peter Johnson
2019-11-09 11:41:58 -08:00
parent 2da64d15f6
commit 3e049e02f0
10 changed files with 74 additions and 2 deletions

View File

@@ -11,6 +11,7 @@
#include <hal/FRCUsageReporting.h>
#include <hal/Notifier.h>
#include <wpi/SmallString.h>
#include "frc/Timer.h"
#include "frc/Utility.h"
@@ -91,6 +92,13 @@ Notifier& Notifier::operator=(Notifier&& rhs) {
return *this;
}
void Notifier::SetName(const wpi::Twine& name) {
wpi::SmallString<64> nameBuf;
int32_t status = 0;
HAL_SetNotifierName(m_notifier,
name.toNullTerminatedStringRef(nameBuf).data(), &status);
}
void Notifier::SetHandler(std::function<void()> handler) {
std::scoped_lock lock(m_processMutex);
m_handler = handler;