MCPcopy Create free account
hub / github.com/FastLED/FastLED / setClockSpeed

Method setClockSpeed

src/fl/channels/spi/device.cpp.hpp:358–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358fl::optional<fl::task::Error> Device::setClockSpeed(u32 speed_hz) {
359 if (!pImpl) {
360 return fl::task::Error("Device not initialized");
361 }
362
363 // Update the configuration
364 pImpl->config.clock_speed_hz = speed_hz;
365
366 // Note: Runtime clock speed updates are not currently supported by the hardware layer.
367 // The new speed will take effect on the next begin() call.
368 // To apply immediately, call end() followed by begin().
369
370 if (pImpl->initialized) {
371 FL_LOG_SPI("SPI Device: Clock speed updated to " << speed_hz
372 << " Hz (will take effect on next begin())");
373 } else {
374 FL_LOG_SPI("SPI Device: Clock speed set to " << speed_hz << " Hz");
375 }
376
377 return fl::nullopt;
378}
379
380const Config& Device::getConfig() const {
381 // Note: Caller must ensure Device is valid

Callers 1

FL_TEST_FILEFunction · 0.45

Calls 1

ErrorClass · 0.85

Tested by

no test coverage detected