mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Add RobotController.getSerialNumber() (#4783)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "frc/RobotController.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include <hal/CAN.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/Power.h>
|
||||
@@ -26,6 +28,13 @@ int64_t RobotController::GetFPGARevision() {
|
||||
return revision;
|
||||
}
|
||||
|
||||
std::string RobotController::GetSerialNumber() {
|
||||
// Serial number is 8 characters
|
||||
char serialNum[9];
|
||||
size_t len = HAL_GetSerialNumber(serialNum, sizeof(serialNum));
|
||||
return std::string(serialNum, len);
|
||||
}
|
||||
|
||||
uint64_t RobotController::GetFPGATime() {
|
||||
int32_t status = 0;
|
||||
uint64_t time = HAL_GetFPGATime(&status);
|
||||
|
||||
Reference in New Issue
Block a user