MCPcopy Create free account
hub / github.com/FastLED/FastLED / writeBits

Function writeBits

src/platforms/esp/32/clockless_block_esp32.h:133–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131#define ESP_ADJUST 0 // (2*(F_CPU/24000000))
132#define ESP_ADJUST2 0
133 template<int BITS,int PX> __attribute__ ((always_inline)) inline static void writeBits(FASTLED_REGISTER u32 & last_mark, FASTLED_REGISTER Lines & b, PixelController<RGB_ORDER, LANES, PORT_MASK> &pixels) FL_NOEXCEPT { // , FASTLED_REGISTER uint32_t & b2) {
134 Lines b2 = b;
135 transpose8x1_noinline(b.bytes,b2.bytes);
136
137 FASTLED_REGISTER u8 d = pixels.template getd<PX>(pixels);
138 FASTLED_REGISTER u8 scale = pixels.template getscale<PX>(pixels);
139
140 for(FASTLED_REGISTER u32 i = 0; i < USED_LANES; ++i) {
141 while((__clock_cycles() - last_mark) < (T1+T2+T3));
142 last_mark = __clock_cycles();
143 *FastPin<FIRST_PIN>::sport() = PORT_MASK << REAL_FIRST_PIN;
144
145 u32 nword = ((u32)(~b2.bytes[7-i]) & PORT_MASK) << REAL_FIRST_PIN;
146 while((__clock_cycles() - last_mark) < (T1-6));
147 *FastPin<FIRST_PIN>::cport() = nword;
148
149 while((__clock_cycles() - last_mark) < (T1+T2));
150 *FastPin<FIRST_PIN>::cport() = PORT_MASK << REAL_FIRST_PIN;
151
152 b.bytes[i] = pixels.template loadAndScale<PX>(pixels,i,d,scale);
153 }
154
155 for(FASTLED_REGISTER u32 i = USED_LANES; i < 8; ++i) {
156 while((__clock_cycles() - last_mark) < (T1+T2+T3));
157 last_mark = __clock_cycles();
158 *FastPin<FIRST_PIN>::sport() = PORT_MASK << REAL_FIRST_PIN;
159
160 u32 nword = ((u32)(~b2.bytes[7-i]) & PORT_MASK) << REAL_FIRST_PIN;
161 while((__clock_cycles() - last_mark) < (T1-6));
162 *FastPin<FIRST_PIN>::cport() = nword;
163
164 while((__clock_cycles() - last_mark) < (T1+T2));
165 *FastPin<FIRST_PIN>::cport() = PORT_MASK << REAL_FIRST_PIN;
166 }
167 }
168
169 // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then
170 // gcc will use register Y for the this pointer.

Callers

nothing calls this directly

Calls 2

transpose8x1_noinlineFunction · 0.85
__clock_cyclesFunction · 0.50

Tested by

no test coverage detected