forked from Makuna/NeoPixelBus
Adding error checks to the esp32 rmt_* api invocations (#284)
This commit is contained in:
committed by
Michael Miller
parent
a833fb48f0
commit
d6f7ad3b74
@@ -31,7 +31,8 @@ License along with NeoPixel. If not, see
|
|||||||
/* General Reference documentation for the APIs used in this implementation
|
/* General Reference documentation for the APIs used in this implementation
|
||||||
LOW LEVEL: (what is actually used)
|
LOW LEVEL: (what is actually used)
|
||||||
DOCS: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/rmt.html
|
DOCS: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/rmt.html
|
||||||
EXAMPLE: https://github.com/espressif/esp-idf/blob/826ff7186ae07dc81e960a8ea09ebfc5304bfb3b/examples/peripherals/rmt_tx/main/rmt_tx_main.c
|
EXAMPLE: https://github.com/espressif/esp-idf/blob/826ff7186ae07dc81e960a8ea09ebfc5304bfb3b/examples/peripherals/rmt_tx/main/rmt_tx_main.c
|
||||||
|
|
||||||
HIGHER LEVEL:
|
HIGHER LEVEL:
|
||||||
NO TRANSLATE SUPPORT so this was not used
|
NO TRANSLATE SUPPORT so this was not used
|
||||||
NOTE: https://github.com/espressif/arduino-esp32/commit/50d142950d229b8fabca9b749dc4a5f2533bc426
|
NOTE: https://github.com/espressif/arduino-esp32/commit/50d142950d229b8fabca9b749dc4a5f2533bc426
|
||||||
@@ -178,9 +179,9 @@ public:
|
|||||||
{
|
{
|
||||||
// wait until the last send finishes before destructing everything
|
// wait until the last send finishes before destructing everything
|
||||||
// arbitrary time out of 10 seconds
|
// arbitrary time out of 10 seconds
|
||||||
// arbitrary time out of 10 seconds
|
ESP_ERROR_CHECK_WITHOUT_ABORT(rmt_wait_tx_done(T_CHANNEL::RmtChannelNumber, 10000 / portTICK_PERIOD_MS));
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(rmt_driver_uninstall(T_CHANNEL::RmtChannelNumber));
|
||||||
|
|
||||||
free(_pixelsEditing);
|
free(_pixelsEditing);
|
||||||
free(_pixelsSending);
|
free(_pixelsSending);
|
||||||
@@ -210,9 +211,9 @@ public:
|
|||||||
|
|
||||||
config.clk_div = T_SPEED::RmtClockDivider;
|
config.clk_div = T_SPEED::RmtClockDivider;
|
||||||
|
|
||||||
|
ESP_ERROR_CHECK(rmt_config(&config));
|
||||||
rmt_config(&config);
|
ESP_ERROR_CHECK(rmt_driver_install(T_CHANNEL::RmtChannelNumber, 0, 0));
|
||||||
rmt_driver_install(T_CHANNEL::RmtChannelNumber, 0, 0);
|
ESP_ERROR_CHECK(rmt_translator_init(T_CHANNEL::RmtChannelNumber, _translate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update(bool maintainBufferConsistency)
|
void Update(bool maintainBufferConsistency)
|
||||||
@@ -220,10 +221,10 @@ public:
|
|||||||
// wait for not actively sending data
|
// wait for not actively sending data
|
||||||
// this will time out at 10 seconds, an arbitrarily long period of time
|
// this will time out at 10 seconds, an arbitrarily long period of time
|
||||||
// and do nothing if this happens
|
// and do nothing if this happens
|
||||||
// and do nothing if this happens
|
if (ESP_OK == ESP_ERROR_CHECK_WITHOUT_ABORT(rmt_wait_tx_done(T_CHANNEL::RmtChannelNumber, 10000 / portTICK_PERIOD_MS)))
|
||||||
{
|
{
|
||||||
// now start the RMT transmit with the editing buffer before we swap
|
// now start the RMT transmit with the editing buffer before we swap
|
||||||
// now start the RMT transmit with the editing buffer before we swap
|
ESP_ERROR_CHECK_WITHOUT_ABORT(rmt_write_sample(T_CHANNEL::RmtChannelNumber, _pixelsEditing, _pixelsSize, false));
|
||||||
|
|
||||||
if (maintainBufferConsistency)
|
if (maintainBufferConsistency)
|
||||||
{
|
{
|
||||||
@@ -366,4 +367,4 @@ typedef NeoEsp32RmtMethodBase<NeoEsp32RmtSpeed400Kbps, NeoEsp32RmtChannel7> NeoE
|
|||||||
// RMT is NOT the default method for Esp32,
|
// RMT is NOT the default method for Esp32,
|
||||||
// you are required to use a specific channel listed above
|
// you are required to use a specific channel listed above
|
||||||
|
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user