Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 83c92c9

Browse files
committed
Rename WS2812s to WS2812b (spelling error)
1 parent 71b16cf commit 83c92c9

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

libsrc/leddevice/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ endif(ENABLE_SPIDEV)
7070

7171
SET(Leddevice_HEADERS
7272
${Leddevice_HEADERS}
73-
${CURRENT_SOURCE_DIR}/LedDeviceWS2812s.h
73+
${CURRENT_SOURCE_DIR}/LedDeviceWS2812b.h
7474
)
7575
SET(Leddevice_SOURCES
7676
${Leddevice_SOURCES}
77-
${CURRENT_SOURCE_DIR}/LedDeviceWS2812s.cpp
77+
${CURRENT_SOURCE_DIR}/LedDeviceWS2812b.cpp
7878
)
7979

8080
if(ENABLE_TINKERFORGE)

libsrc/leddevice/LedDeviceFactory.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "LedDevicePhilipsHue.h"
3232
#include "LedDeviceTpm2.h"
3333

34-
#include "LedDeviceWS2812s.h"
34+
#include "LedDeviceWS2812b.h"
3535

3636
LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
3737
{
@@ -183,10 +183,10 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
183183
LedDeviceTpm2* deviceTpm2 = new LedDeviceTpm2(output, rate);
184184
deviceTpm2->open();
185185
device = deviceTpm2;
186-
}else if (type == "ws2812s")
186+
}else if (type == "ws2812b")
187187
{
188-
LedDeviceWS2812s * ledDeviceWS2812s = new LedDeviceWS2812s();
189-
device = ledDeviceWS2812s;
188+
LedDeviceWS2812b * ledDeviceWS2812b = new LedDeviceWS2812b();
189+
device = ledDeviceWS2812b;
190190
}
191191
else
192192
{

libsrc/leddevice/LedDeviceWS2812s.cpp renamed to libsrc/leddevice/LedDeviceWS2812b.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// For license and other informations see LedDeviceWS2812s.h
1+
// For license and other informations see LedDeviceWS2812b.h
22
// To activate: use led device "ws2812s" in the hyperion configuration
33

44
// STL includes
@@ -15,7 +15,7 @@
1515
//#include <sys/ioctl.h>
1616

1717
// hyperion local includes
18-
#include "LedDeviceWS2812s.h"
18+
#include "LedDeviceWS2812b.h"
1919

2020
// ==== Defines and Vars ====
2121

@@ -227,7 +227,7 @@
227227

228228

229229

230-
LedDeviceWS2812s::LedDeviceWS2812s() :
230+
LedDeviceWS2812b::LedDeviceWS2812b() :
231231
LedDevice(),
232232
mLedCount(0)
233233
{
@@ -237,7 +237,7 @@ LedDeviceWS2812s::LedDeviceWS2812s() :
237237
}
238238

239239

240-
int LedDeviceWS2812s::write(const std::vector<ColorRgb> &ledValues)
240+
int LedDeviceWS2812b::write(const std::vector<ColorRgb> &ledValues)
241241
{
242242
mLedCount = ledValues.size();
243243
//printf("Set leds, number: %d\n", mLedCount);
@@ -315,12 +315,12 @@ int LedDeviceWS2812s::write(const std::vector<ColorRgb> &ledValues)
315315
return 0;
316316
}
317317

318-
int LedDeviceWS2812s::switchOff()
318+
int LedDeviceWS2812b::switchOff()
319319
{
320320
return write(std::vector<ColorRgb>(mLedCount, ColorRgb{0,0,0}));
321321
}
322322

323-
LedDeviceWS2812s::~LedDeviceWS2812s()
323+
LedDeviceWS2812b::~LedDeviceWS2812b()
324324
{
325325
// Exit cleanly, freeing memory and stopping the DMA & PWM engines
326326
// We trap all signals (including Ctrl+C), so even if you don't get here, it terminates correctly
@@ -340,7 +340,7 @@ LedDeviceWS2812s::~LedDeviceWS2812s()
340340
// Convenience functions
341341
// --------------------------------------------------------------------------------------------------
342342
// Print some bits of a binary number (2nd arg is how many bits)
343-
void LedDeviceWS2812s::printBinary(unsigned int i, unsigned int bits) {
343+
void LedDeviceWS2812b::printBinary(unsigned int i, unsigned int bits) {
344344
int x;
345345
for(x=bits-1; x>=0; x--) {
346346
printf("%d", (i & (1 << x)) ? 1 : 0);
@@ -378,7 +378,7 @@ static void udelay(int us) {
378378

379379
// Shutdown functions
380380
// --------------------------------------------------------------------------------------------------
381-
void LedDeviceWS2812s::terminate(int dummy) {
381+
void LedDeviceWS2812b::terminate(int dummy) {
382382
// Shut down the DMA controller
383383
if(dma_reg) {
384384
CLRBIT(dma_reg[DMA_CS], DMA_CS_ACTIVE);
@@ -402,7 +402,7 @@ void LedDeviceWS2812s::terminate(int dummy) {
402402
//exit(1);
403403
}
404404

405-
void LedDeviceWS2812s::fatal(const char *fmt, ...) {
405+
void LedDeviceWS2812b::fatal(const char *fmt, ...) {
406406
va_list ap;
407407
va_start(ap, fmt);
408408
vfprintf(stderr, fmt, ap);
@@ -414,13 +414,13 @@ void LedDeviceWS2812s::fatal(const char *fmt, ...) {
414414
// Memory management
415415
// --------------------------------------------------------------------------------------------------
416416
// Translate from virtual address to physical
417-
unsigned int LedDeviceWS2812s::mem_virt_to_phys(void *virt) {
417+
unsigned int LedDeviceWS2812b::mem_virt_to_phys(void *virt) {
418418
unsigned int offset = (uint8_t *)virt - virtbase;
419419
return page_map[offset >> PAGE_SHIFT].physaddr + (offset % PAGE_SIZE);
420420
}
421421

422422
// Translate from physical address to virtual
423-
unsigned int LedDeviceWS2812s::mem_phys_to_virt(uint32_t phys) {
423+
unsigned int LedDeviceWS2812b::mem_phys_to_virt(uint32_t phys) {
424424
unsigned int pg_offset = phys & (PAGE_SIZE - 1);
425425
unsigned int pg_addr = phys - pg_offset;
426426

@@ -435,7 +435,7 @@ unsigned int LedDeviceWS2812s::mem_phys_to_virt(uint32_t phys) {
435435
}
436436

437437
// Map a peripheral's IO memory into our virtual memory, so we can read/write it directly
438-
void * LedDeviceWS2812s::map_peripheral(uint32_t base, uint32_t len) {
438+
void * LedDeviceWS2812b::map_peripheral(uint32_t base, uint32_t len) {
439439
int fd = open("/dev/mem", O_RDWR);
440440
void * vaddr;
441441

@@ -450,15 +450,15 @@ void * LedDeviceWS2812s::map_peripheral(uint32_t base, uint32_t len) {
450450
}
451451

452452
// Zero out the PWM waveform buffer
453-
void LedDeviceWS2812s::clearPWMBuffer() {
453+
void LedDeviceWS2812b::clearPWMBuffer() {
454454
memset(PWMWaveform, 0, NUM_DATA_WORDS * 4); // Times four because memset deals in bytes.
455455
}
456456

457457
// Set an individual bit in the PWM output array, accounting for word boundaries
458458
// The (31 - bitIdx) is so that we write the data backwards, correcting its endianness
459459
// This means getPWMBit will return something other than what was written, so it would be nice
460460
// if the logic that calls this function would figure it out instead. (However, that's trickier)
461-
void LedDeviceWS2812s::setPWMBit(unsigned int bitPos, unsigned char bit) {
461+
void LedDeviceWS2812b::setPWMBit(unsigned int bitPos, unsigned char bit) {
462462

463463
// Fetch word the bit is in
464464
unsigned int wordOffset = (int)(bitPos / 32);
@@ -480,7 +480,7 @@ void LedDeviceWS2812s::setPWMBit(unsigned int bitPos, unsigned char bit) {
480480

481481
// ==== Init Hardware ====
482482

483-
void LedDeviceWS2812s::initHardware() {
483+
void LedDeviceWS2812b::initHardware() {
484484
int pid;
485485
int fd;
486486
char pagemap_fn[64];
@@ -722,7 +722,7 @@ void LedDeviceWS2812s::initHardware() {
722722
}
723723

724724
// Begin the transfer
725-
void LedDeviceWS2812s::startTransfer() {
725+
void LedDeviceWS2812b::startTransfer() {
726726
// Enable DMA
727727
dma_reg[DMA_CONBLK_AD] = mem_virt_to_phys(ctl->cb);
728728
dma_reg[DMA_CS] = DMA_CS_CONFIGWORD | (1 << DMA_CS_ACTIVE);

libsrc/leddevice/LedDeviceWS2812s.h renamed to libsrc/leddevice/LedDeviceWS2812b.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef LEDDEVICEWS2812S_H_
2-
#define LEDDEVICEWS2812S_H_
1+
#ifndef LEDDEVICEWS2812B_H_
2+
#define LEDDEVICEWS2812B_H_
33

44
#pragma once
55

@@ -126,14 +126,14 @@ typedef struct {
126126
///
127127
/// Implementation of the LedDevice interface for writing to Ws2801 led device.
128128
///
129-
class LedDeviceWS2812s : public LedDevice
129+
class LedDeviceWS2812b : public LedDevice
130130
{
131131
public:
132132
///
133133
/// Constructs the LedDevice for a string containing leds of the type WS2812
134-
LedDeviceWS2812s();
134+
LedDeviceWS2812b();
135135

136-
~LedDeviceWS2812s();
136+
~LedDeviceWS2812b();
137137
///
138138
/// Writes the led color values to the led-device
139139
///
@@ -206,4 +206,4 @@ class LedDeviceWS2812s : public LedDevice
206206

207207

208208

209-
#endif /* LEDDEVICEWS2812S_H_ */
209+
#endif /* LEDDEVICEWS2812B_H_ */

0 commit comments

Comments
 (0)