Skip to content

Commit

Permalink
fix: make Apa102 clock speed configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasssadar committed Nov 25, 2024
1 parent 8a4663e commit 4c21e75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SmartLeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ class Apa102 {
static const int FINAL_FRAME_SIZE = 4;
static const int TRANS_COUNT = 2 + 8;

Apa102(int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer)
Apa102(int count, int clkpin, int datapin, BufferType doubleBuffer = SingleBuffer, int clock_speed_hz = 1000000)
: _count(count)
, _firstBuffer(new ApaRgb[count])
, _secondBuffer(doubleBuffer ? new ApaRgb[count] : nullptr)
Expand All @@ -243,7 +243,7 @@ class Apa102 {

spi_device_interface_config_t devcfg;
memset(&devcfg, 0, sizeof(devcfg));
devcfg.clock_speed_hz = 1000000;
devcfg.clock_speed_hz = clock_speed_hz;
devcfg.mode = 0;
devcfg.spics_io_num = -1;
devcfg.queue_size = TRANS_COUNT;
Expand Down

0 comments on commit 4c21e75

Please sign in to comment.