mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Add name to HAL Notifier
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -60,6 +60,7 @@ TimedRobot::TimedRobot(units::second_t period) : IterativeRobotBase(period) {
|
||||
int32_t status = 0;
|
||||
m_notifier = HAL_InitializeNotifier(&status);
|
||||
wpi_setHALError(status);
|
||||
HAL_SetNotifierName(m_notifier, "TimedRobot", &status);
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Framework,
|
||||
HALUsageReporting::kFramework_Timed);
|
||||
|
||||
Reference in New Issue
Block a user