-
-
Notifications
You must be signed in to change notification settings - Fork 217
feat: add SP616E serial LED controller driver #1558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
awawa-dev
merged 2 commits into
awawa-dev:master
from
MysticCodolic:feature/sp616e-driver
Sep 9, 2026
+93
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #pragma once | ||
|
|
||
| #include "ProviderSerial.h" | ||
|
|
||
| class DriverSerialSP616E : public ProviderSerial | ||
| { | ||
| public: | ||
| explicit DriverSerialSP616E(const QJsonObject& deviceConfig); | ||
| static LedDevice* construct(const QJsonObject& deviceConfig); | ||
|
|
||
| private: | ||
| bool init(QJsonObject deviceConfig) override; | ||
| int writeFiniteColors(const std::vector<ColorRgb>& ledValues) override; | ||
|
|
||
| static bool isRegistered; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "type":"object", | ||
| "required":true, | ||
| "properties":{ | ||
| "output": { | ||
| "type": "string", | ||
| "title":"edt_dev_spec_outputPath_title", | ||
| "default":"ttyACM0", | ||
| "propertyOrder" : 1 | ||
| }, | ||
| "rate": { | ||
| "type": "integer", | ||
| "title":"edt_dev_spec_baudrate_title", | ||
| "default": 115200, | ||
| "propertyOrder" : 2 | ||
| }, | ||
| "delayAfterConnect": { | ||
| "type": "integer", | ||
| "title":"edt_dev_spec_delayAfterConnect_title", | ||
| "default": 250, | ||
| "propertyOrder" : 3 | ||
| } | ||
| }, | ||
| "additionalProperties": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| #include <led-drivers/serial/DriverSerialSP616E.h> | ||
|
|
||
| // SP616E protocol: | ||
| // - RGB pixels followed by a 0xFF terminator | ||
| // - Frame size is dynamic: (_ledRGBCount) + 1 bytes | ||
| // - No header, no checksum, no length field | ||
|
|
||
| static const uint8_t SP616E_TERMINATOR = 0xFF; | ||
|
|
||
| DriverSerialSP616E::DriverSerialSP616E(const QJsonObject& deviceConfig) | ||
| : ProviderSerial(deviceConfig) | ||
| { | ||
| } | ||
|
|
||
| bool DriverSerialSP616E::init(QJsonObject deviceConfig) | ||
| { | ||
| bool isInitOK = false; | ||
|
|
||
| // Initialise sub-class | ||
| if (ProviderSerial::init(deviceConfig)) | ||
| { | ||
|
|
||
| _ledBuffer.resize(_ledRGBCount + 1, 0x00); | ||
| _ledBuffer.back() = SP616E_TERMINATOR; // block-end byte | ||
|
|
||
| isInitOK = true; | ||
| } | ||
| return isInitOK; | ||
| } | ||
|
|
||
| int DriverSerialSP616E::writeFiniteColors(const std::vector<ColorRgb>& ledValues) | ||
| { | ||
| if (_ledCount != ledValues.size()) | ||
| { | ||
| Warning(_log, "SP616E led count has changed (old: {:d}, new: {:d}). Rebuilding buffer.", _ledCount, ledValues.size()); | ||
| setLedCount(static_cast<int>(ledValues.size())); | ||
| _ledBuffer.resize(_ledRGBCount + 1, 0x00); | ||
| _ledBuffer.back() = SP616E_TERMINATOR; | ||
| } | ||
|
|
||
| memcpy(_ledBuffer.data(), ledValues.data(), _ledRGBCount); | ||
| return writeBytes(_ledBuffer.size(), _ledBuffer.data()); | ||
| } | ||
|
|
||
| LedDevice* DriverSerialSP616E::construct(const QJsonObject& deviceConfig) | ||
| { | ||
| return new DriverSerialSP616E(deviceConfig); | ||
| } | ||
|
|
||
| bool DriverSerialSP616E::isRegistered = hyperhdr::leds::REGISTER_LED_DEVICE( | ||
| "sp616e", "leds_group_3_serial", DriverSerialSP616E::construct); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.