Skip to content

Commit

Permalink
WS2812 stub for simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Apr 28, 2024
1 parent 7798e70 commit d8a16a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/sim/PrefabManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,28 @@ class CShape *PrefabManager::generateStrip_RGBCW() {
}
return o;
}
class CShape *PrefabManager::generateWS2812B() {

float bulb_radius = 20.0f;

CShape *o = new CShape();
o->addText(-40, -25, "WS2812");
o->setName("WS2812");
CShape *filler = o->addRect(-bulb_radius,-bulb_radius, bulb_radius*2, bulb_radius*2);
CShape *body = o->addRect(-bulb_radius, -bulb_radius, bulb_radius * 2, bulb_radius * 2);
filler->setFill(true);
CJunction *a = o->addJunction(-bulb_radius, 0);
a->setName("A");
a->addText(-5, -5, "");
CJunction *b = o->addJunction(bulb_radius, 0);
b->setName("B");
b->addText(-25, -5, "");
CControllerBulb *bulb = new CControllerBulb(a, b);
o->setController(bulb);
filler->setName("internal_bulb_filler");
bulb->setShape(filler);
return o;
}
class CShape *PrefabManager::generateStrip_RGB() {
float bulb_radius = 20.0f;

Expand Down Expand Up @@ -465,6 +487,7 @@ void PrefabManager::createDefaultPrefabs() {
addPrefab(generateVDD());
addPrefab(generateBL0942());
addPrefab(generatePot());
addPrefab(generateWS2812B());
}


Expand Down
1 change: 1 addition & 0 deletions src/sim/PrefabManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PrefabManager {
class CShape *generateGND();
class CShape *generateVDD();
class CShape *generatePot();
class CShape *generateWS2812B();
public:
PrefabManager(CSimulator *ps) {
sim = ps;
Expand Down

0 comments on commit d8a16a7

Please sign in to comment.