while ((dma->CFG->DCR & DMA_DCR_ERQ)) { | while ((dma->CFG->DCR & DMA_DCR_ERQ)) { | ||||
yield(); | yield(); | ||||
} | } | ||||
#elif defined(KINETISL) | |||||
#endif | #endif | ||||
// wait 300us WS2812 reset time | // wait 300us WS2812 reset time | ||||
uint32_t min_elapsed = ((numled * 34134) >> 10) + 300; | uint32_t min_elapsed = ((numled * 34134) >> 10) + 300; | ||||
*fb++ = x; | *fb++ = x; | ||||
} while (fb < stop); | } while (fb < stop); | ||||
} | } | ||||
#if defined(KINETISK) | |||||
dma->sourceBuffer(frameBuffer, numled * 8); | dma->sourceBuffer(frameBuffer, numled * 8); | ||||
dma->transferSize(1); | dma->transferSize(1); | ||||
dma->transferCount(numled * 8); | dma->transferCount(numled * 8); | ||||
dma->disableOnCompletion(); | dma->disableOnCompletion(); | ||||
dma->enable(); | dma->enable(); | ||||
#elif defined(KINETISL) | |||||
dma->CFG->SAR = frameBuffer; | |||||
dma->CFG->DSR_BCR = 0x01000000; | |||||
dma->CFG->DSR_BCR = numled * 8; | |||||
dma->CFG->DCR = DMA_DCR_ERQ | DMA_DCR_CS | DMA_DCR_SSIZE(1) | | |||||
DMA_DCR_SINC | DMA_DCR_DSIZE(1) | DMA_DCR_D_REQ; | |||||
#endif | |||||
} | } | ||||
const int pin = 1; | const int pin = 1; | ||||
// Usable pins: | // Usable pins: | ||||
// Teensy LC: 1, 4, 5, 24 | |||||
// Teensy 3.2: 1, 5, 8, 10, 20, 31 | // Teensy 3.2: 1, 5, 8, 10, 20, 31 | ||||
// Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48 | // Teensy 3.5: 1, 5, 8, 10, 20, 26, 32, 33, 48 | ||||
// Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33 | // Teensy 3.6: 1, 5, 8, 10, 20, 26, 32, 33 |