Compare commits
7 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9838756e04 | ||
|
|
cfed445f0c | ||
|
|
7ab6164e9d | ||
|
|
9a4dd6111c | ||
|
|
0a5824bcb6 | ||
|
|
2176892c3b | ||
|
|
5502b04fcb |
5 changed files with 369 additions and 121 deletions
225
.clang-format
Normal file
225
.clang-format
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: true
|
||||
AlignConsecutiveBitFields:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
PadOperators: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments:
|
||||
Kind: Always
|
||||
OverEmptyLines: 0
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros:
|
||||
- __capability
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BitFieldColonSpacing: Both
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterExternBlock: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakAfterAttributes: Never
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IfMacros:
|
||||
- KJ_IF_MAYBE
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
CaseSensitive: false
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: false
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentRequiresClause: true
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
BinaryMinDigits: 0
|
||||
Decimal: 0
|
||||
DecimalMinDigits: 0
|
||||
Hex: 0
|
||||
HexMinDigits: 0
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
LambdaBodyIndentation: Signature
|
||||
LineEnding: DeriveLF
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PackConstructorInitializers: BinPack
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakOpenParenthesis: 0
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyIndentedWhitespace: 0
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
PPIndentWidth: -1
|
||||
QualifierAlignment: Leave
|
||||
ReferenceAlignment: Pointer
|
||||
ReflowComments: true
|
||||
RemoveBracesLLVM: false
|
||||
RemoveSemicolon: false
|
||||
RequiresClausePosition: OwnLine
|
||||
RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Leave
|
||||
ShortNamespaceLines: 1
|
||||
SortIncludes: CaseSensitive
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: LexicographicNumeric
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceAroundPointerQualifiers: Default
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: true
|
||||
AfterForeachMacros: true
|
||||
AfterFunctionDefinitionName: false
|
||||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: true
|
||||
AfterOverloadedOperator: false
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: Never
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 1
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Latest
|
||||
StatementAttributeLikeMacros:
|
||||
- Q_EMIT
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- BOOST_PP_STRINGIZE
|
||||
- CF_SWIFT_NAME
|
||||
- NS_SWIFT_NAME
|
||||
- PP_STRINGIZE
|
||||
- STRINGIZE
|
||||
...
|
||||
|
||||
26
.editorconfig
Normal file
26
.editorconfig
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
# Set default charset
|
||||
charset = utf-8
|
||||
|
||||
# 4 space indentation
|
||||
[*.{c, h, cpp}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
# Tab indentation (no size specified)
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json,.travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# esp_ws28xx
|
||||
A light and simple ESP-IDF lib for WS2812B/WS2815 led strips. Works via SPI with DMA.
|
||||
A fork of https://github.com/8-DK/ESP32_SPI_WS2812_idf/ with a lot of fixes, refactoring, improvements and flexability. Fixed bit format, added correct reset pulses and support of WS2815.
|
||||
A fork of https://github.com/8-DK/ESP32_SPI_WS2812_idf/ with a lot of fixes, refactoring, improvements, and higher flexibility. Fixed bit format, added correct reset pulses, and support of WS2815.
|
||||
Tested with esp-idf v5.1 and esp32-c3.
|
||||
|
||||
# Example of usage
|
||||
|
|
|
|||
203
esp_ws28xx.c
203
esp_ws28xx.c
|
|
@ -1,121 +1,116 @@
|
|||
#include "esp_ws28xx.h"
|
||||
|
||||
uint16_t* dma_buffer;
|
||||
CRGB* ws28xx_pixels;
|
||||
static int led_num, reset_delay, dma_buf_size;
|
||||
uint16_t *dma_buffer;
|
||||
CRGB *ws28xx_pixels;
|
||||
static int n_of_leds, reset_delay, dma_buf_size;
|
||||
led_strip_model_t led_model;
|
||||
|
||||
static spi_settings_t spi_settings = {
|
||||
.host = SPI2_HOST,
|
||||
.dma_chan = SPI_DMA_CH_AUTO,
|
||||
.buscfg = {
|
||||
.miso_io_num = -1,
|
||||
.sclk_io_num = -1,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
},
|
||||
.devcfg = { .clock_speed_hz = 3.2 * 1000 * 1000, //Clock out at 3.2 MHz
|
||||
.mode = 0, //SPI mode 0
|
||||
.spics_io_num = -1, //CS pin
|
||||
.queue_size = 1,
|
||||
.command_bits = 0,
|
||||
.address_bits = 0,
|
||||
.flags = SPI_DEVICE_TXBIT_LSBFIRST,
|
||||
}
|
||||
.host = SPI2_HOST,
|
||||
.dma_chan = SPI_DMA_CH_AUTO,
|
||||
.buscfg =
|
||||
{
|
||||
.miso_io_num = -1,
|
||||
.sclk_io_num = -1,
|
||||
.quadwp_io_num = -1,
|
||||
.quadhd_io_num = -1,
|
||||
},
|
||||
.devcfg =
|
||||
{
|
||||
.clock_speed_hz = 3.2 * 1000 * 1000, // Clock out at 3.2 MHz
|
||||
.mode = 0, // SPI mode 0
|
||||
.spics_io_num = -1, // CS pin
|
||||
.queue_size = 1,
|
||||
.command_bits = 0,
|
||||
.address_bits = 0,
|
||||
.flags = SPI_DEVICE_TXBIT_LSBFIRST,
|
||||
},
|
||||
};
|
||||
|
||||
static const uint16_t timing_bits[16] = {
|
||||
0x1111, 0x7111, 0x1711, 0x7711, 0x1171, 0x7171, 0x1771, 0x7771,
|
||||
0x1117, 0x7117, 0x1717, 0x7717, 0x1177, 0x7177, 0x1777, 0x7777};
|
||||
|
||||
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int led_number, CRGB** led_buffer_ptr) {
|
||||
esp_err_t err = ESP_OK;
|
||||
led_num = led_number;
|
||||
led_model = model;
|
||||
dma_buf_size = led_num * 12 + (reset_delay + 1) * 2; //12 bytes for each led + bytes for initial zero and reset state
|
||||
ws28xx_pixels = malloc(sizeof(CRGB) * led_num);
|
||||
if (ws28xx_pixels == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
*led_buffer_ptr = ws28xx_pixels;
|
||||
spi_settings.buscfg.mosi_io_num = pin;
|
||||
spi_settings.buscfg.max_transfer_sz = dma_buf_size;
|
||||
err = spi_bus_initialize(spi_settings.host, &spi_settings.buscfg, spi_settings.dma_chan);
|
||||
if (err != ESP_OK) {
|
||||
free(ws28xx_pixels);
|
||||
return err;
|
||||
}
|
||||
err = spi_bus_add_device(spi_settings.host, &spi_settings.devcfg, &spi_settings.spi);
|
||||
if (err != ESP_OK) {
|
||||
free(ws28xx_pixels);
|
||||
return err;
|
||||
}
|
||||
reset_delay = (model == WS2812B) ? 3 : 30; //insrease if something breaks. values are less that recommended in datasheets but seem stable
|
||||
dma_buffer = heap_caps_malloc(dma_buf_size, MALLOC_CAP_DMA); // Critical to be DMA memory.
|
||||
if (dma_buffer == NULL) {
|
||||
free(ws28xx_pixels);
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
return ESP_OK;
|
||||
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int num_of_leds,
|
||||
CRGB **led_buffer_ptr) {
|
||||
esp_err_t err = ESP_OK;
|
||||
n_of_leds = num_of_leds;
|
||||
led_model = model;
|
||||
// Insrease if something breaks. values are less than recommended in
|
||||
// datasheets but seem stable
|
||||
reset_delay = (model == WS2812B) ? 3 : 30;
|
||||
// 12 bytes for each led + bytes for initial zero and reset state
|
||||
dma_buf_size = n_of_leds * 12 + (reset_delay + 1) * 2;
|
||||
ws28xx_pixels = malloc(sizeof(CRGB) * n_of_leds);
|
||||
if (ws28xx_pixels == NULL) {
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
*led_buffer_ptr = ws28xx_pixels;
|
||||
spi_settings.buscfg.mosi_io_num = pin;
|
||||
spi_settings.buscfg.max_transfer_sz = dma_buf_size;
|
||||
err = spi_bus_initialize(spi_settings.host, &spi_settings.buscfg,
|
||||
spi_settings.dma_chan);
|
||||
if (err != ESP_OK) {
|
||||
free(ws28xx_pixels);
|
||||
return err;
|
||||
}
|
||||
err = spi_bus_add_device(spi_settings.host, &spi_settings.devcfg,
|
||||
&spi_settings.spi);
|
||||
if (err != ESP_OK) {
|
||||
free(ws28xx_pixels);
|
||||
return err;
|
||||
}
|
||||
// Critical to be DMA memory.
|
||||
dma_buffer = heap_caps_malloc(dma_buf_size, MALLOC_CAP_DMA);
|
||||
if (dma_buffer == NULL) {
|
||||
free(ws28xx_pixels);
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
void ws28xx_fill_color(CRGB color) {
|
||||
for(int i=0; i < led_num; i++) {
|
||||
ws28xx_pixels[i] = color;
|
||||
}
|
||||
void ws28xx_fill_all(CRGB color) {
|
||||
for (int i = 0; i < n_of_leds; i++) {
|
||||
ws28xx_pixels[i] = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
esp_err_t ws28xx_update() {
|
||||
uint16_t timing_bits[16] = {
|
||||
0x1111,
|
||||
0x7111,
|
||||
0x1711,
|
||||
0x7711,
|
||||
0x1171,
|
||||
0x7171,
|
||||
0x1771,
|
||||
0x7771,
|
||||
0x1117,
|
||||
0x7117,
|
||||
0x1717,
|
||||
0x7717,
|
||||
0x1177,
|
||||
0x7177,
|
||||
0x1777,
|
||||
0x7777
|
||||
};
|
||||
esp_err_t err;
|
||||
int n = 0;
|
||||
memset(dma_buffer, 0, dma_buf_size);
|
||||
|
||||
dma_buffer[n++] = 0;
|
||||
for (int i = 0; i < led_num; i++) {
|
||||
uint32_t temp = ws28xx_pixels[i].num;// Data you want to write to each LEDs
|
||||
if (led_model == WS2815) {
|
||||
//Red
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >>4)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)];
|
||||
esp_err_t err;
|
||||
int n = 0;
|
||||
memset(dma_buffer, 0, dma_buf_size);
|
||||
dma_buffer[n++] = 0;
|
||||
for (int i = 0; i < n_of_leds; i++) {
|
||||
// Data you want to write to each LEDs
|
||||
uint32_t temp = ws28xx_pixels[i].num;
|
||||
if (led_model == WS2815) {
|
||||
// Red
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >> 4)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)];
|
||||
|
||||
//Green
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >>12)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)>>8];
|
||||
} else {
|
||||
//Green
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >>12)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)>>8];
|
||||
// Green
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >> 12)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp) >> 8];
|
||||
} else {
|
||||
// Green
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >> 12)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp) >> 8];
|
||||
|
||||
//Red
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >>4)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)];
|
||||
}
|
||||
//Blue
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >>20)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)>>16];
|
||||
}
|
||||
for (int i = 0; i < reset_delay; i++) dma_buffer[n++] = 0;
|
||||
// Red
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >> 4)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp)];
|
||||
}
|
||||
// Blue
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp >> 20)];
|
||||
dma_buffer[n++] = timing_bits[0x0f & (temp) >> 16];
|
||||
}
|
||||
for (int i = 0; i < reset_delay; i++) {
|
||||
dma_buffer[n++] = 0;
|
||||
}
|
||||
|
||||
err = spi_device_transmit(spi_settings.spi, &(spi_transaction_t){
|
||||
.length = dma_buf_size * 8,
|
||||
.tx_buffer = dma_buffer,
|
||||
});
|
||||
return err;
|
||||
err = spi_device_transmit(spi_settings.spi, &(spi_transaction_t){
|
||||
.length = dma_buf_size * 8,
|
||||
.tx_buffer = dma_buffer,
|
||||
});
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
34
esp_ws28xx.h
34
esp_ws28xx.h
|
|
@ -1,37 +1,40 @@
|
|||
#ifndef MAIN_ESP_WS28XX_H_
|
||||
#define MAIN_ESP_WS28XX_H_
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "driver/spi_master.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
union {
|
||||
struct {
|
||||
union {
|
||||
uint8_t r;
|
||||
uint8_t red;
|
||||
};
|
||||
|
||||
union {
|
||||
uint8_t g;
|
||||
uint8_t green;
|
||||
};
|
||||
|
||||
union {
|
||||
uint8_t b;
|
||||
uint8_t blue;
|
||||
};
|
||||
};
|
||||
uint8_t raw[3];
|
||||
uint32_t num;
|
||||
};
|
||||
|
||||
uint8_t raw[3];
|
||||
uint32_t num;
|
||||
};
|
||||
} CRGB;
|
||||
|
||||
typedef struct {
|
||||
spi_host_device_t host;
|
||||
spi_device_handle_t spi;
|
||||
int dma_chan;
|
||||
spi_device_interface_config_t devcfg;
|
||||
spi_bus_config_t buscfg;
|
||||
spi_host_device_t host;
|
||||
spi_device_handle_t spi;
|
||||
int dma_chan;
|
||||
spi_device_interface_config_t devcfg;
|
||||
spi_bus_config_t buscfg;
|
||||
} spi_settings_t;
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -39,10 +42,9 @@ typedef enum {
|
|||
WS2815,
|
||||
} led_strip_model_t;
|
||||
|
||||
|
||||
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int led_number, CRGB** led_buffer_ptr);
|
||||
void ws28xx_fill_color(CRGB color);
|
||||
esp_err_t ws28xx_init(int pin, led_strip_model_t model, int num_of_leds,
|
||||
CRGB **led_buffer_ptr);
|
||||
void ws28xx_fill_all(CRGB color);
|
||||
esp_err_t ws28xx_update();
|
||||
|
||||
|
||||
#endif /* MAIN_ESP_WS28XX_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue