| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | // Forward declaration to avoid pulling in PixelOverlayModel.h in a header | ||
| 4 | // that's transitively #included by FX.cpp. | ||
| 5 | class PixelOverlayModel; | ||
| 6 | PixelOverlayModel* currentBusModel(); // defined in wled.cpp | ||
| 7 | |||
| 8 | class BusConfig { | ||
| 9 | public: | ||
| 10 | ✗ | BusConfig(...) {} | |
| 11 | |||
| 12 | ✗ | size_t memUsage(size_t digitalCount) const { | |
| 13 | ✗ | return 0; | |
| 14 | } | ||
| 15 | uint8_t type = TYPE_DIGITAL_MIN; | ||
| 16 | uint8_t count = 1; | ||
| 17 | }; | ||
| 18 | class Bus { | ||
| 19 | public: | ||
| 20 | 9476 | int getStart() const { return 0; } | |
| 21 | int getType() const { return 0; } | ||
| 22 | |||
| 23 | // RGBW awareness: when the current overlay model has 4 bytes per | ||
| 24 | // pixel (RGBW), tell WLED that this bus has a white channel. | ||
| 25 | // Triggers Segment::refreshLightCapabilities() to flip on | ||
| 26 | // SEG_CAPABILITY_W and (with the auto-white mode below) makes | ||
| 27 | // every effect's setPixelColor call route the bright/white parts | ||
| 28 | // to the W channel rather than driving R+G+B together. | ||
| 29 | bool hasWhite() const; | ||
| 30 | 1196 | bool hasRGB() const { return true; } | |
| 31 | |||
| 32 | int getLength() const; | ||
| 33 | uint32_t getPixelColor(int i) const; | ||
| 34 | void setPixelColor(int i, uint32_t c); | ||
| 35 | |||
| 36 | 3542 | void setBrightness(uint32_t b) {} | |
| 37 | 3542 | void begin() {} | |
| 38 | |||
| 39 | 1196 | bool hasCCT() const { return false; } | |
| 40 | 4738 | bool isOk() const { return true; } | |
| 41 | // Default to AUTO_BRIGHTER on RGBW models — every existing WLED | ||
| 42 | // effect emits pure RGB and relies on the bus to extract a W | ||
| 43 | // value. AUTO_BRIGHTER takes min(r,g,b) for W, leaving RGB intact; | ||
| 44 | // visually best on warm/neutral white LEDs. | ||
| 45 | uint8_t getAutoWhiteMode() const; | ||
| 46 | 1 | static uint8_t getGlobalAWMode() { return AW_GLOBAL_DISABLED; } | |
| 47 | 3542 | bool isOffRefreshRequired() { return false; } | |
| 48 | ✗ | bool isVirtual() const { return false; } | |
| 49 | ✗ | bool isPWM() const { return false; } | |
| 50 | bool is2Pin() const { return false; } | ||
| 51 | ✗ | static constexpr unsigned getNumberOfPins(uint8_t type) { return 4; } | |
| 52 | |||
| 53 | static constexpr bool isTypeValid(uint8_t type) { return (type > 15 && type < 128); } | ||
| 54 | ✗ | static constexpr bool isDigital(uint8_t type) { return (type >= TYPE_DIGITAL_MIN && type <= TYPE_DIGITAL_MAX) || is2Pin(type); } | |
| 55 | ✗ | static constexpr bool is2Pin(uint8_t type) { return (type >= TYPE_2PIN_MIN && type <= TYPE_2PIN_MAX); } | |
| 56 | ✗ | static constexpr bool isOnOff(uint8_t type) { return (type == TYPE_ONOFF); } | |
| 57 | ✗ | static constexpr bool isPWM(uint8_t type) { return (type >= TYPE_ANALOG_MIN && type <= TYPE_ANALOG_MAX); } | |
| 58 | static constexpr bool isVirtual(uint8_t type) { return (type >= TYPE_VIRTUAL_MIN && type <= TYPE_VIRTUAL_MAX); } | ||
| 59 | static constexpr bool is16bit(uint8_t type) { return type == TYPE_UCS8903 || type == TYPE_UCS8904 || type == TYPE_SM16825; } | ||
| 60 | static constexpr bool mustRefresh(uint8_t type) { return type == TYPE_TM1814; } | ||
| 61 | static constexpr int numPWMPins(uint8_t type) { return (type - 40); } | ||
| 62 | }; | ||
| 63 | namespace BusManager | ||
| 64 | { | ||
| 65 | extern Bus bus; | ||
| 66 | |||
| 67 | 13018 | constexpr uint32_t getNumBusses() { return 1; } | |
| 68 | 4738 | constexpr Bus* getBus(size_t b) { return &bus; } | |
| 69 | ✗ | constexpr void setBrightness(uint32_t b) {} | |
| 70 | constexpr bool hasRGB() { return true; } | ||
| 71 | constexpr bool hasWhite() { return false; } | ||
| 72 | constexpr bool canAllShow() { return false; } | ||
| 73 | 8530 | constexpr void show() {} | |
| 74 | 17060 | constexpr void setSegmentCCT(int i, bool b = false) {} | |
| 75 | constexpr int getSegmentCCT() { return 0; } | ||
| 76 | 791136 | inline uint32_t getPixelColor(int i) { return bus.getPixelColor(i); } | |
| 77 | 2373073 | inline void setPixelColor(int i, uint32_t c) { bus.setPixelColor(i, c); } | |
| 78 | ✗ | constexpr int add(...) { return -1; } | |
| 79 | constexpr uint32_t memUsage() { return 0; } | ||
| 80 | }; | ||
| 81 | |||
| 82 | constexpr uint32_t WLED_NUM_PINS = 40; | ||
| 83 | namespace PinManager | ||
| 84 | { | ||
| 85 | ✗ | constexpr bool isPinOk(int pin, bool b) { return true; } | |
| 86 | ✗ | constexpr bool isPinAllocated(int pin) { return true; } | |
| 87 | }; | ||
| 88 |