Updated ESP32 NeoMethods (markdown)

Michael Miller
2023-04-03 15:56:08 -07:00
parent a5de2a40e0
commit 8d8771fd35

@@ -1,43 +1,56 @@
⚠️ **IMPORTANT** ⚠️
The ESP32 platforms requires hardware support to be able to reliably send the data stream.
The ESP32 platforms requires hardware support to be able to reliably send the data stream. While a bit bang method is provided, it is not recommended.
The ESP32 and the ESP32S2 both have some pins dedicated for input only. The following NeoMethods are restricted to use only output pins.
For the ESP32 all pins below 34 are output pins. You will still need to check your board to make sure any of these pins are available. [Esp32 Dev Pin Map](https://docs.espressif.com/projects/arduino-esp32/en/latest/boards/ESP32-DevKitC-1.html#pin-layout)
For the ESP32S2 all pins other than 46 are output pins. Again, please check your specific board for available pins.
The bitbang method has further restrictions in that it will only support pins below 32.
If you notice any flickering related to network activity and/or high CPU load you might want to look into [ESP32 and RTOS tasks](https://github.com/Makuna/NeoPixelBus/wiki/ESP32-and-RTOS-Tasks)
## NeoEsp32I2s1800KbpsMethod
NeoEsp32I2s1800KbpsMethod supports any available pin below 34.
This method uses i2s hardware support to send data to the NeoPixels. Thus this method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for the I2s DMA to read from. Thus there is a trade off of CPU use versus memory use. The extra buffer needed is four times the size of the primary pixel buffer.
All methods for the ESP32 platform will follow this template for the methods name. The LED names are the same from the simple names and will not be listed in full below as we will focus on the hardware details on this page.
**NOTE:** The ESP32S2 and ESP32C3 only support one i2s hardware bus. Thus you can only use the NeoEsp32I2s0*Method types.
**NOTE:** The esp32 supports two i2s hardware buses. The first one is left open for other uses. If for some reason you need to use the first one, then use NeoEsp32I2s0800KbpsMethod instead.
"NeoEsp32\<insert hardware detail\>\<insert LED name\>Method"
## NeoEsp32I2s1400KbpsMethod
Same as NeoEsp32I2s1800KbpsMethod but running at the older and slower data rate.
## I2S
The I2S hardware is used to send the data. This method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for the I2S DMA to read from. Thus, there is a tradeoff of CPU use versus memory use. The extra buffer needed is four times the size of the primary pixel buffer.
A single I2S peripheral can send a single channel (pin) or it can send a collection of parallel channels. Each of these have different methods.
### Single Channel:
* I2s0 - Uses the I2S 0 peripheral, an example would be NeoEsp32**I2s0**Ws2812xMethod.
* I2s1 - Uses the I2S 1 peripheral, an example would be NeoEsp32**I2s1**Ws2812xMethod.
* I2sN - An example would be NeoEsp32**I2sN**Ws2812xMethod. The I2S peripheral to use is defined at runtime as an argument on the constructor.
## NeoEsp32I2s1Ws2813Method
Same as NeoEsp32I2s1800KbpsMethod but has the longer delay required by these LEDs.
**NOTE:** The ESP32S2 and ESP32C3 only support one i2s hardware bus. Thus you can only use the NeoEsp32I2s0*Method types.
## NeoEsp32Rmt# Methods
The NeoEsp32Rmt0800KbpsMethod is an example, the number following the Rmt is 0-7 providing 8 channels of the RMT hardware. All the variants for different leds (Ws2812x, Ws12813, etc) are supported.
### Parallel Channels:
These methods can be instanced more than once, up to the number of channels specified. They consume memory for the length of the longest instance multiplied by the number of channels, so use the least number of channels that you need.
* I2s0X8 - Uses the I2S 0 peripheral in 8 channel parallel mode, an example would be NeoEsp32**I2s0X8**Ws2812xMethod.
* I2s0X16 - Uses the I2S 0 peripheral in 16 channel parallel mode, an example would be NeoEsp32**I2s0X16**Ws2812xMethod.
* I2s1X8 - Uses the I2S 1 peripheral in 8 channel parallel mode, an example would be NeoEsp32**I2s1X8**Ws2812xMethod.
* I2s1X16 - Uses the I2S 1 peripheral in 16 channel parallel mode, an example would be NeoEsp32**I2s1X16**Ws2812xMethod.
**NOTE:** The ESP32S2 only supports one i2s hardware bus. Thus you can only use the NeoEsp32I2s0*Method types.
## RMT
The RMT peripheral is used to send data to the NeoPixels. Thus, this method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for hardware to read from. This extra buffer is the same size as the primary buffer. Due to the use of a ISR to translate and fill the RMT hardware output buffer, there are many interrupts fired to keep that small DMA output buffer filled. Some have found this to be an issue when other features of their sketch also trigger a high volume of interrupts.
* Rmt0 - Uses the RMT channel 0. An example would be NeoEsp32**Rmt0**Ws2812xMethod.
* Rmt1 - Uses the RMT channel 1. An example would be NeoEsp32**Rmt1**Ws2812xMethod.
* Rmt2 - Uses the RMT channel 2. An example would be NeoEsp32**Rmt2**Ws2812xMethod.
* Rmt3 - Uses the RMT channel 3. An example would be NeoEsp32**Rmt3**Ws2812xMethod.
* Rmt4 - Uses the RMT channel 4. An example would be NeoEsp32**Rmt4**Ws2812xMethod.
* Rmt5 - Uses the RMT channel 5. An example would be NeoEsp32**Rmt5**Ws2812xMethod.
* Rmt6 - Uses the RMT channel 6. An example would be NeoEsp32**Rmt6**Ws2812xMethod.
* Rmt7 - Uses the RMT channel 7. An example would be NeoEsp32**Rmt7**Ws2812xMethod.
* RmtN - Uses the RMT but allows the channel selection to be done at runtime. An example would be NeoEsp32**RmtN**Ws2812xMethod.
**NOTE:** Even though the ESP32 has 8 channels of RMT hardware, using beyond 4 has shown to cause sending delays.
**NOTE:** The ESP32S2 only supports 4 channels of RMT hardware, so only channels 0-3 are available.
**NOTE:** The ESP32C3 only supports 2 channels of RMT hardware, so only channels 0 and 1 are available.
**NOTE:** NeoEsp32Rmt# Methods supports any available pin below 34.
NeoEsp32Rmt# Methods supports any available pin below 34.
These methods uses RMT hardware support to send data to the NeoPixels. Thus this method uses very little CPU for actually sending the data to NeoPixels but it requires an extra buffer for hardware to read from. This extra buffer is the same size as the primary buffer. Due to the use of a ISR to translate and fill the RMT hardware output buffer, there are many interrupts fired to keep that small output buffer filled. Some have found this to be an issue when other features of their sketch also trigger a high volume of interrupts.
## NeoEsp32BitBang800KbpsMethod
NeoEsp32BitBang800KbpsMethod supports any available pin below 32. Even though 33 and 34 are also output pins, they are not supported.
## Bit Bang
The bit bang methods only support pins below 32. Even though 33 and 34 are also output pins, they are not supported.
* BitBang - An example would be NeoEsp32**BitBang**Ws2812xMethod.
This method uses only the CPU to send data to the NeoPixels. But due to core interrupts it is not stable when used with more than a few pixels. It has been reported that using `xTaskCreatePinnedToCore()` will greatly help.
It is not recommended to use this method except for comparing results with the other methods. For very short runs of pixels it may be possible to use this method without ill effects. If it fails, the pixels may not be correctly set. Use this instead of Neo800KbpsMethod to force your sketch to use the Bit Banging to send data.
## NeoEsp32BitBang400KbpsMethod
Same as NeoEsp32BitBang800KbpsMethod but running at the older and slower data rate.
## NeoEsp32BitBangWs2813Method
Same as NeoEsp32BitBang800KbpsMethod but has the longer delay required these chips.