mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibc] Fix missing symbols on Windows (#7140)
Windows doesn't support direct static variable access across library boundaries in a mixed static/shared environment, so change to accessor functions.
This commit is contained in:
@@ -135,8 +135,8 @@ void DigitalOutput::DisablePWM() {
|
||||
int32_t status = 0;
|
||||
|
||||
// Disable the output by routing to a dead bit.
|
||||
HAL_SetDigitalPWMOutputChannel(m_pwmGenerator, SensorUtil::kDigitalChannels,
|
||||
&status);
|
||||
HAL_SetDigitalPWMOutputChannel(m_pwmGenerator,
|
||||
SensorUtil::GetNumDigitalChannels(), &status);
|
||||
FRC_CheckErrorStatus(status, "Channel {}", m_channel);
|
||||
|
||||
HAL_FreeDigitalPWM(m_pwmGenerator);
|
||||
|
||||
@@ -104,7 +104,7 @@ LEDPattern LEDPattern::Blink(units::second_t onTime, units::second_t offTime) {
|
||||
if (wpi::Now() % totalMicros < onMicros) {
|
||||
self.ApplyTo(data, writer);
|
||||
} else {
|
||||
LEDPattern::kOff.ApplyTo(data, writer);
|
||||
LEDPattern::Off().ApplyTo(data, writer);
|
||||
}
|
||||
}};
|
||||
}
|
||||
@@ -118,7 +118,7 @@ LEDPattern LEDPattern::SynchronizedBlink(std::function<bool()> signal) {
|
||||
if (signal()) {
|
||||
self.ApplyTo(data, writer);
|
||||
} else {
|
||||
LEDPattern::kOff.ApplyTo(data, writer);
|
||||
LEDPattern::Off().ApplyTo(data, writer);
|
||||
}
|
||||
}};
|
||||
}
|
||||
@@ -198,7 +198,9 @@ LEDPattern LEDPattern::AtBrightness(double relativeBrightness) {
|
||||
|
||||
// Static constants and functions
|
||||
|
||||
LEDPattern LEDPattern::kOff = LEDPattern::Solid(Color::kBlack);
|
||||
LEDPattern LEDPattern::Off() {
|
||||
return LEDPattern::Solid(Color::kBlack);
|
||||
}
|
||||
|
||||
LEDPattern LEDPattern::Solid(const Color color) {
|
||||
return LEDPattern{[=](auto data, auto writer) {
|
||||
@@ -228,7 +230,7 @@ LEDPattern LEDPattern::ProgressMaskLayer(
|
||||
LEDPattern LEDPattern::Steps(std::span<const std::pair<double, Color>> steps) {
|
||||
if (steps.size() == 0) {
|
||||
// no colors specified
|
||||
return LEDPattern::kOff;
|
||||
return LEDPattern::Off();
|
||||
}
|
||||
if (steps.size() == 1 && steps[0].first == 0) {
|
||||
// only one color specified, just show a static color
|
||||
@@ -264,7 +266,7 @@ LEDPattern LEDPattern::Steps(
|
||||
LEDPattern LEDPattern::Gradient(std::span<const Color> colors) {
|
||||
if (colors.size() == 0) {
|
||||
// no colors specified
|
||||
return LEDPattern::kOff;
|
||||
return LEDPattern::Off();
|
||||
}
|
||||
if (colors.size() == 1) {
|
||||
// only one color specified, just show a static color
|
||||
|
||||
@@ -13,12 +13,6 @@
|
||||
|
||||
using namespace frc;
|
||||
|
||||
const int SensorUtil::kDigitalChannels = HAL_GetNumDigitalChannels();
|
||||
const int SensorUtil::kAnalogInputs = HAL_GetNumAnalogInputs();
|
||||
const int SensorUtil::kAnalogOutputs = HAL_GetNumAnalogOutputs();
|
||||
const int SensorUtil::kPwmChannels = HAL_GetNumPWMChannels();
|
||||
const int SensorUtil::kRelayChannels = HAL_GetNumRelayHeaders();
|
||||
|
||||
int SensorUtil::GetDefaultCTREPCMModule() {
|
||||
return 0;
|
||||
}
|
||||
@@ -46,3 +40,23 @@ bool SensorUtil::CheckAnalogInputChannel(int channel) {
|
||||
bool SensorUtil::CheckAnalogOutputChannel(int channel) {
|
||||
return HAL_CheckAnalogOutputChannel(channel);
|
||||
}
|
||||
|
||||
int SensorUtil::GetNumDigitalChannels() {
|
||||
return HAL_GetNumDigitalChannels();
|
||||
}
|
||||
|
||||
int SensorUtil::GetNumAnalogInputs() {
|
||||
return HAL_GetNumAnalogInputs();
|
||||
}
|
||||
|
||||
int SensorUtil::GetNumAnalogOuputs() {
|
||||
return HAL_GetNumAnalogOutputs();
|
||||
}
|
||||
|
||||
int SensorUtil::GetNumPwmChannels() {
|
||||
return HAL_GetNumPWMChannels();
|
||||
}
|
||||
|
||||
int SensorUtil::GetNumRelayChannels() {
|
||||
return HAL_GetNumRelayHeaders();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user