Skip to content

Update from upstream #1

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

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8f726b0
Add alpha blending
haberturdeur Apr 13, 2021
631f2d8
Merge pull request #31 from haberturdeur/master
haberturdeur Apr 14, 2021
a36b5ae
Add equality operator
haberturdeur Apr 14, 2021
6f54b2f
Fix missing include
haberturdeur Apr 14, 2021
0003d4c
Fix assert warning
haberturdeur Jun 24, 2021
1fd43aa
Add LED control class for LD8806
GrantRolls Jun 22, 2021
0fd159b
Fix formatting
haberturdeur Jul 8, 2021
f5805d3
Fix more formatting
haberturdeur Jul 8, 2021
8b799c5
Improve gamma correction
yaqwsx Jul 13, 2021
048b250
Fix typo
haberturdeur Jul 14, 2021
396a663
Allow users to choose which core is the RMT interrupt is allocated on
Tasssadar Jul 16, 2021
d546c82
Merge pull request #39 from RoboticsBrno/isr-core-selection
Tasssadar Jul 19, 2021
832939c
Add RGB minus operator
SnijderC Oct 26, 2022
d8ae06f
Use the RMT driver instead of registers directly
Tasssadar Feb 14, 2023
b75166a
Use RMT translator feature to consume less memory
Tasssadar Feb 16, 2023
93451bb
Merge pull request #44 from RoboticsBrno/rmt_driver
haberturdeur Feb 17, 2023
43dde23
Remove useless delay after each pixel, make it after whole strip only
Tasssadar Feb 18, 2023
7e2c93d
Release 2.0.0
Tasssadar Feb 18, 2023
7e92147
Refactor to use the new driver on IDF 5.0
Tasssadar Feb 19, 2023
20426e0
Revert "Refactor to use the new driver on IDF 5.0"
Tasssadar Apr 11, 2023
cf2dbb4
Refactor to use the new driver on IDF 5.0 (#45)
Tasssadar Jul 9, 2023
3330090
Release 3.0.0
Tasssadar Jul 9, 2023
c054909
feat: add channel() getter to SmartLeds
Tasssadar Jul 9, 2023
4f30ba6
fix: compatiblity with esp32c3
Tasssadar Jul 9, 2023
95e286c
Release 3.1.0
Tasssadar Jul 9, 2023
713065b
fix: warning about narrowing conversion
Tasssadar Jul 10, 2023
ede05a6
fix: pin type conversion
Tasssadar Jul 10, 2023
de331ca
fix: do not set IRAM ISR flag if the config is not set (#48)
Tasssadar Jun 27, 2024
cb3cbc1
fix: DMA channel picking on S3
Tasssadar Nov 25, 2024
6516d2b
fix: make Apa102 clock speed configurable
Tasssadar Nov 25, 2024
bbeb895
fix: init _transCount in Apa102
Tasssadar Nov 25, 2024
dd49716
chore: bump to 3.1.4
Tasssadar Dec 2, 2024
3f1e230
fix: end frame for SK9822 LEDs
Tasssadar Dec 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
ColumnLimit: 120
...
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PlatformIO CI

on: [push]

jobs:
build-test:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
example:
- examples/basic
conf:
- esp32-idf4-arduino.ini
- esp32-idf5-idf.ini
- esp32s3-idf4-arduino.ini
- esp32s3-idf5-idf.ini
- esp32c3-idf4-arduino.ini
- esp32c3-idf5-idf.ini
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install platformio
- name: Build examples
run: platformio ci --lib="." --project-conf="./test-inis/${{ matrix.conf }}"
env:
PLATFORMIO_CI_SRC: ${{ matrix.example }}
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.0)

set(SRCS
"src/Color.cpp"
"src/RmtDriver4.cpp"
"src/RmtDriver5.cpp"
"src/SmartLeds.cpp"
)

idf_component_register(
SRCS ${SRCS}
INCLUDE_DIRS "./src"
REQUIRES driver
)
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,13 +2,16 @@

Simple & intuitive way to drive various smart LEDs on ESP32.

Requires ESP-IDF >=4.0

## Supported LEDs:

- WS2812 (RMT driver)
- WS2812 (RMT driver)
- WS2812B (RMT driver)
- SK6812 (RMT driver)
- WS2813 (RMT driver)
- APA102 (SPI driver)
- SK6812 (RMT driver)
- WS2813 (RMT driver)
- APA102 (SPI driver)
- LPD8806 (SPI driver)

All the LEDs are driven by hardware peripherals in order to achieve high
performance.
@@ -27,4 +30,5 @@ performance.
- clock at 10 MHz

## Available
[PlatformIO - library 1740 - SmartLeds](https://platformio.org/lib/show/1740/SmartLeds)

[PlatformIO - library 1740 - SmartLeds](https://platformio.org/lib/show/1740/SmartLeds)
62 changes: 62 additions & 0 deletions examples/basic/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#ifdef LX16A_ARDUINO
#include <Arduino.h>
#else
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
static void delay(int ms) { vTaskDelay(pdMS_TO_TICKS(ms)); }
static uint32_t millis() { return xTaskGetTickCount(); }
#endif

#include <SmartLeds.h>

const int LED_COUNT = 15;
const int DATA_PIN = 22;
const int CHANNEL = 0;

// SmartLed -> RMT driver (WS2812/WS2812B/SK6812/WS2813)
SmartLed leds(LED_WS2812B, LED_COUNT, DATA_PIN, CHANNEL, DoubleBuffer);

const int CLK_PIN = 23;
// APA102 -> SPI driver
//Apa102 leds(LED_COUNT, CLK_PIN, DATA_PIN, DoubleBuffer);

void setup() {}

uint8_t hue;
void showGradient() {
hue++;
// Use HSV to create nice gradient
for (int i = 0; i != LED_COUNT; i++)
leds[i] = Hsv { static_cast<uint8_t>(hue + 30 * i), 255, 255 };
leds.show();
// Show is asynchronous; if we need to wait for the end of transmission,
// we can use leds.wait(); however we use double buffered mode, so we
// can start drawing right after showing.
}

void showRgb() {
leds[0] = Rgb { 255, 0, 0 };
leds[1] = Rgb { 0, 255, 0 };
leds[2] = Rgb { 0, 0, 255 };
leds[3] = Rgb { 0, 0, 0 };
leds[4] = Rgb { 255, 255, 255 };
leds.show();
}

void loop() {
if (millis() % 10000 < 5000)
showGradient();
else
showRgb();
delay(50);
}

#ifndef ARDUINO
extern "C" void app_main() {
setup();
while (true) {
loop();
vTaskDelay(0);
}
}
#endif
48 changes: 0 additions & 48 deletions examples/basicExample/basicExample.ino

This file was deleted.

35 changes: 17 additions & 18 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{
"name": "SmartLeds",
"keywords": "LED, esp32, NeoPixel, WS2812, WS2812B, APA102",
"description": "Simple & intuitive way to drive various smart LEDs on ESP32.",
"repository":
"name": "SmartLeds",
"keywords": "LED, esp32, NeoPixel, WS2812, WS2812B, APA102",
"description": "Simple & intuitive way to drive various smart LEDs on ESP32.",
"repository": {
"type": "git",
"url": "https://github.com/RoboticsBrno/SmartLeds.git"
},
"authors": [
{
"type": "git",
"url": "https://github.com/RoboticsBrno/SmartLeds.git"
},
"authors": [
{
"name": "Jan Mrázek",
"email": "[email protected]",
"url": "http://www.robotikabrno.cz",
"maintainer": true
}
],
"version": "1.2.1",
"frameworks": ["arduino","espidf"],
"platforms": "espressif32"
"name": "Jan Mrázek",
"email": "[email protected]",
"url": "http://www.robotikabrno.cz",
"maintainer": true
}
],
"version": "3.1.5",
"frameworks": ["arduino", "espidf"],
"platforms": "espressif32"
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SmartLeds
version=1.2.1
version=3.1.5
author=Jan Mrázek
maintainer=Jan Mrázek <[email protected]>
sentence=Simple & intuitive way to drive various smart LEDs on ESP32.
Loading