mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -16,7 +16,7 @@
|
||||
#include "wpi/util/StackTrace.hpp"
|
||||
#include "wpi/util/sendable/SendableBuilder.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
DutyCycle::DutyCycle(int channel) : m_channel{channel} {
|
||||
if (!SensorUtil::CheckDigitalChannel(channel)) {
|
||||
@@ -27,18 +27,18 @@ DutyCycle::DutyCycle(int channel) : m_channel{channel} {
|
||||
|
||||
void DutyCycle::InitDutyCycle() {
|
||||
int32_t status = 0;
|
||||
std::string stackTrace = wpi::GetStackTrace(1);
|
||||
std::string stackTrace = wpi::util::GetStackTrace(1);
|
||||
m_handle = HAL_InitializeDutyCycle(m_channel, stackTrace.c_str(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", GetSourceChannel());
|
||||
HAL_ReportUsage("IO", m_channel, "DutyCycle");
|
||||
wpi::SendableRegistry::Add(this, "Duty Cycle", m_channel);
|
||||
wpi::util::SendableRegistry::Add(this, "Duty Cycle", m_channel);
|
||||
}
|
||||
|
||||
units::hertz_t DutyCycle::GetFrequency() const {
|
||||
wpi::units::hertz_t DutyCycle::GetFrequency() const {
|
||||
int32_t status = 0;
|
||||
auto retVal = HAL_GetDutyCycleFrequency(m_handle, &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", GetSourceChannel());
|
||||
return units::hertz_t{retVal};
|
||||
return wpi::units::hertz_t{retVal};
|
||||
}
|
||||
|
||||
double DutyCycle::GetOutput() const {
|
||||
@@ -48,18 +48,18 @@ double DutyCycle::GetOutput() const {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
units::second_t DutyCycle::GetHighTime() const {
|
||||
wpi::units::second_t DutyCycle::GetHighTime() const {
|
||||
int32_t status = 0;
|
||||
auto retVal = HAL_GetDutyCycleHighTime(m_handle, &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", GetSourceChannel());
|
||||
return units::nanosecond_t{static_cast<double>(retVal)};
|
||||
return wpi::units::nanosecond_t{static_cast<double>(retVal)};
|
||||
}
|
||||
|
||||
int DutyCycle::GetSourceChannel() const {
|
||||
return m_channel;
|
||||
}
|
||||
|
||||
void DutyCycle::InitSendable(wpi::SendableBuilder& builder) {
|
||||
void DutyCycle::InitSendable(wpi::util::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Duty Cycle");
|
||||
builder.AddDoubleProperty(
|
||||
"Frequency", [this] { return this->GetFrequency().value(); }, nullptr);
|
||||
|
||||
Reference in New Issue
Block a user