FastLED 3.10.8
Loading...
Searching...
No Matches
bus_priorities.h
Go to the documentation of this file.
1#pragma once
2
14
15#include "fl/channels/bus.h"
16#include "fl/stl/stdint.h"
17
18// Platform CMSIS/Arduino headers may define SPI / UART / I2S as register
19// pointer macros (e.g. Sam3X8E: `#define UART ((Uart*)0x400E0800U)`).
20// Those macros expand inside qualified names like `Bus::SPI` below and
21// produce a syntax error. bus.h itself uses push_macro/pop_macro around
22// its enum definition; once bus.h pops the macros are restored. So we
23// must apply the same guard locally here. See fl/channels/bus.h.
24#pragma push_macro("UART")
25#pragma push_macro("SPI")
26#pragma push_macro("I2S")
27#undef UART
28#undef SPI
29#undef I2S
30
31namespace fl {
32
39 // FORCE-style overrides (FASTLED_ESP32_FORCE_*) are intentionally not
40 // applied here -- the legacy initChannelDrivers() retains its own
41 // priority-bumping logic for backward compatibility. This table is the
42 // baseline used by the new enableDrivers<>() opt-in API.
43 //
44 // Secondary FLEX_IO instances sit one below the primary so the
45 // manager fills the primary bank first and overflows to the
46 // secondary (classic-ESP32 I2S0 second bank, ESP32-P4 LCD_RGB —
47 // FastLED#3576 Phase 1).
48 return
49 b == Bus::FLEX_IO ? (which == 0 ? 4 : which == 1 ? 3 : 2) :
50 b == Bus::RMT ? 2 :
51 b == Bus::SPI ? 1 :
52 b == Bus::DUAL_SPI ? 1 :
53 b == Bus::QUAD_SPI ? 1 :
54 b == Bus::OCTAL_SPI ? 1 :
55 b == Bus::BIT_BANG ? 0 :
56 b == Bus::UART ? (which == 0 ? -1 : -2) :
57 0;
58}
59
60} // namespace fl
61
62#pragma pop_macro("I2S")
63#pragma pop_macro("SPI")
64#pragma pop_macro("UART")
Portable compile-time identifiers for LED channel buses.
unsigned char u8
Definition stdint.h:131
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Bus
Portable public bus selector.
Definition bus.h:27
@ FLEX_IO
Definition bus.h:36
@ DUAL_SPI
Definition bus.h:32
@ QUAD_SPI
Definition bus.h:33
@ SPI
Definition bus.h:31
@ OCTAL_SPI
Definition bus.h:34
@ BIT_BANG
Definition bus.h:29
@ RMT
Definition bus.h:35
@ UART
Definition bus.h:30
constexpr int default_bus_priority(Bus b, fl::u8 which) FL_NO_EXCEPT
Default priority assigned to a Bus when registered with the manager.
Base definition for an LED controller.
Definition crgb.hpp:179