| 356 | } |
| 357 | |
| 358 | fl::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 | |
| 380 | const Config& Device::getConfig() const { |
| 381 | // Note: Caller must ensure Device is valid |