RMT driver initialization and control functions.
More...
RMT driver initialization and control functions.
◆ ws2812b_if_getDrvRMT()
Get RMT driver interface.
- Returns
- const ws2812b_drv_t* Pointer to driver interface structure
Returns function pointer structure for LED control. Use this interface to interact with LEDs.
Example:
drv->SetOneDiodeRGB(0, 255, 0, 0);
drv->Refresh();
const ws2812b_drv_t * ws2812b_if_getDrvRMT(void)
Get RMT driver interface.
Definition ws2812b_drv_RMT.c:66
WS2812B driver interface structure.
Definition ws2812b_if.h:81
- Note
- Must call ws2812b_if_init() before using driver
◆ ws2812b_if_init()
| void ws2812b_if_init |
( |
void | | ) |
|
Initialize RMT peripheral for WS2812B control.
Initializes ESP32-C6 RMT peripheral with WS2812B-specific configuration.
Initialization Steps:
- Configure RMT bytes encoder (0.3µs / 0.9µs timing)
- Create RMT TX channel on specified GPIO
- Configure 64-symbol memory blocks (reduces flickering)
- Set up 4-deep transaction queue for smooth updates
- Enable RMT channel
RMT Configuration:
- Resolution: 10MHz (0.1µs per tick)
- Bit 0: 0.3µs HIGH + 0.9µs LOW
- Bit 1: 0.9µs HIGH + 0.3µs LOW
- MSB first transmission
- DMA enabled
- Note
- Call once during application startup
-
Must be called before any LED operations
- Warning
- Crashes if RMT channel allocation fails
- See also
- ws2812b_if_getDrvRMT() to get driver interface
◆ ws2812b_if_simpleTest()
| void ws2812b_if_simpleTest |
( |
void | | ) |
|
Run simple LED test sequence.
Cycles through LEDs one by one in red, green, blue sequence. Useful for testing LED strip connectivity and order.
Test Sequence:
- Light LED 0 red
- Light LED 1 red
- ... through all LEDs red
- Light LED 0 green
- ... through all LEDs green
- Light LED 0 blue
- ... through all LEDs blue
- Repeat
Usage:
void test_task(void *pvParameters) {
while(1) {
vTaskDelay(pdMS_TO_TICKS(100));
}
}
void ws2812b_if_simpleTest(void)
Run simple LED test sequence.
Definition ws2812b_drv_RMT.c:129
void ws2812b_if_init(void)
Initialize RMT peripheral for WS2812B control.
Definition ws2812b_drv_RMT.c:166
- Note
- Add to FreeRTOS task with delay
-
Static state maintained between calls
- Warning
- Do not call faster than 10ms