FastLED 3.9.15
Loading...
Searching...
No Matches
ObjectFLEDDmaManager.cpp.hpp
Go to the documentation of this file.
1#include "platforms/arm/teensy/is_teensy.h"
2
3#if defined(FL_IS_TEENSY_4X) // Teensy 4.0/4.1 only
4
6#include "fl/system/delay.h"
7
8namespace fl {
9
10// Define static members
11DMAMEM uint32_t ObjectFLEDDmaManager::bitdata[BYTES_PER_DMA * 64] __attribute__((used, aligned(32)));
12DMAMEM uint32_t ObjectFLEDDmaManager::bitmask[4] __attribute__((used, aligned(32)));
13
14void ObjectFLEDDmaManager::acquire(void* owner) {
15 // Wait for any current transmission to complete
16 waitForCompletion();
17
18 // Set ownership
19 mCurrentOwner = owner;
20}
21
22void ObjectFLEDDmaManager::release(void* owner) {
23 // Validate ownership
24 if (mCurrentOwner != owner) {
25 // Ownership mismatch - ignore for now
26 return;
27 }
28
29 // Release ownership
30 mCurrentOwner = nullptr;
31}
32
33void ObjectFLEDDmaManager::waitForCompletion() {
34 // Spin-wait for DMA completion with periodic delays
35 while (!dma3.complete()) {
37 }
38}
39
40bool ObjectFLEDDmaManager::isBusy() {
41 return !dma3.complete();
42}
43
44} // namespace fl
45
46#endif // FL_IS_TEENSY_4X
#define BYTES_PER_DMA
Definition ObjectFLED.h:61
Delay utilities for FastLED Includes nanosecond-precision delays, cycle counting, and microsecond del...
fl::u32 uint32_t
Definition s16x16x4.h:219
void delayMicroseconds(u32 us)
Delay for a given number of microseconds.
Base definition for an LED controller.
Definition crgb.hpp:179