Skip to content

Commit 9e5e77e

Browse files
committed
[ws2812] copied spi transfer from apa102
1 parent 72ed78e commit 9e5e77e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/modm/driver/pwm/ws2812b.hpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <modm/architecture/interface/spi_master.hpp>
1515
#include <modm/architecture/interface/unaligned.hpp>
1616
#include <modm/ui/color.hpp>
17+
#include <modm/processing/resumable.hpp>
1718

1819
namespace modm
1920
{
@@ -100,13 +101,10 @@ class Ws2812b
100101
return {color[1], color[0], color[2]};
101102
}
102103

103-
void
104+
modm::ResumableResult<void>
104105
write()
105106
{
106-
for (const auto value : data) {
107-
while (not SpiMaster::Hal::isTransmitRegisterEmpty()) ;
108-
SpiMaster::Hal::write(value);
109-
}
107+
return SpiMaster::transfer(data, nullptr, length+1);
110108
}
111109
};
112110

0 commit comments

Comments
 (0)