mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Add usage reporting for AddressableLED (#2108)
This commit is contained in:
committed by
Peter Johnson
parent
4ebae17123
commit
5f85457a97
@@ -8,6 +8,7 @@
|
||||
#include "frc/AddressableLED.h"
|
||||
|
||||
#include <hal/AddressableLED.h>
|
||||
#include <hal/FRCUsageReporting.h>
|
||||
#include <hal/HALBase.h>
|
||||
#include <hal/PWM.h>
|
||||
#include <hal/Ports.h>
|
||||
@@ -30,6 +31,8 @@ AddressableLED::AddressableLED(int port) {
|
||||
if (m_handle == HAL_kInvalidHandle) {
|
||||
HAL_FreePWMPort(m_pwmHandle, &status);
|
||||
}
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_AddressableLEDs, port + 1);
|
||||
}
|
||||
|
||||
AddressableLED::~AddressableLED() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.AddressableLEDJNI;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.PWMJNI;
|
||||
|
||||
@@ -26,6 +27,7 @@ public class AddressableLED implements AutoCloseable {
|
||||
public AddressableLED(int port) {
|
||||
m_pwmHandle = PWMJNI.initializePWMPort(HAL.getPort((byte) port));
|
||||
m_handle = AddressableLEDJNI.initialize(m_pwmHandle);
|
||||
HAL.report(tResourceType.kResourceType_AddressableLEDs, port + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user