mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal] Fix and document addressable LED timings (#5272)
HAL_SetAddressableLEDBitTiming swapped high and low timings for whatever was written to it. This fixes that bug. Additionally, the API has been updated to take high time first, and then low time. This is due to this being the physical data format, so having the API match is clearer. Additionally, update the docs with the defaults.
This commit is contained in:
@@ -65,14 +65,14 @@ void AddressableLED::SetData(std::initializer_list<LEDData> ledData) {
|
||||
FRC_CheckErrorStatus(status, "Port {}", m_port);
|
||||
}
|
||||
|
||||
void AddressableLED::SetBitTiming(units::nanosecond_t lowTime0,
|
||||
units::nanosecond_t highTime0,
|
||||
units::nanosecond_t lowTime1,
|
||||
units::nanosecond_t highTime1) {
|
||||
void AddressableLED::SetBitTiming(units::nanosecond_t highTime0,
|
||||
units::nanosecond_t lowTime0,
|
||||
units::nanosecond_t highTime1,
|
||||
units::nanosecond_t lowTime1) {
|
||||
int32_t status = 0;
|
||||
HAL_SetAddressableLEDBitTiming(
|
||||
m_handle, lowTime0.to<int32_t>(), highTime0.to<int32_t>(),
|
||||
lowTime1.to<int32_t>(), highTime1.to<int32_t>(), &status);
|
||||
m_handle, highTime0.to<int32_t>(), lowTime0.to<int32_t>(),
|
||||
highTime1.to<int32_t>(), lowTime1.to<int32_t>(), &status);
|
||||
FRC_CheckErrorStatus(status, "Port {}", m_port);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user