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

Method writeBit

src/platforms/arm/sam/fastspi_arm_sam.h:334–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332
333 // write a single bit out, which bit from the passed in byte is determined by template parameter
334 template <u8 BIT> inline void writeBit(u8 b) FL_NOEXCEPT {
335 // For bit-banging, we need to temporarily disable SPI and use GPIO
336 ::SPI.endTransaction();
337
338 pinMode(_DATA_PIN, PinMode::Output);
339 pinMode(_CLOCK_PIN, PinMode::Output);
340
341 if(b & (1 << BIT)) {
342 digitalWrite(_DATA_PIN, PinValue::High);
343 } else {
344 digitalWrite(_DATA_PIN, PinValue::Low);
345 }
346
347 digitalWrite(_CLOCK_PIN, PinValue::High);
348 digitalWrite(_CLOCK_PIN, PinValue::Low);
349
350 // Re-initialize pins for SPI
351 ::SPI.begin();
352 }
353
354 // write a block of uint8_ts out in groups of three. len is the total number of uint8_ts to write out.
355 template <u8 FLAGS, class D, EOrder RGB_ORDER> void writePixels(PixelController<RGB_ORDER> pixels, void* context = nullptr) FL_NOEXCEPT {

Callers

nothing calls this directly

Calls 4

pinModeFunction · 0.70
digitalWriteFunction · 0.70
endTransactionMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected