-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Adds RMT End of Transmission Level API #9238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b232726
RMT (featt): adds a new function to set EOT level after RMT writing
SuGlider 534d549
RMT (feat): adds new feature to set the EOT level after writing RMT c…
SuGlider cd388ee
adds return value to rmtSetEOT()
SuGlider 52d1fa4
adds bool return to rmtSetEOT()
SuGlider 745cdfb
adds return value to the rmtSetEOT() function
SuGlider a8133e7
FIX (rmt): fixes eot_level setting using flags in the TX structure
SuGlider 52bda1c
RMT(feat): Create RMT_EndOfTransmissionState.ino example
SuGlider 6c2c5e7
Update cores/esp32/esp32-hal-rmt.h
SuGlider 04852da
Update cores/esp32/esp32-hal-rmt.c
SuGlider 5181fea
Update cores/esp32/esp32-hal-rmt.c
SuGlider File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
libraries/ESP32/examples/RMT/RMT_EndOfTransmissionState/RMT_EndOfTransmissionState.ino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#define BLINK_GPIO 2 | ||
#define EOT_INITIAL_STATE_TIME_MS 1000 | ||
|
||
// BLINK_GPIO shall start at RMT_EOT (HIGH or LOW) as initial state for EOT_INITIAL_STATE_TIME_MS, | ||
// BLINK: 1 second ON, 1 second OFF and then return/stay to RMT_EOT level at the end. | ||
#define RMT_EOT HIGH | ||
|
||
// RMT is at 400KHz with a 2.5us tick | ||
// This RMT data sends a 0.5Hz pulse with 1s High and 1s Low signal | ||
rmt_data_t blink_1s_rmt_data[] = { | ||
// 400,000 x 2.5us = 1 second ON | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
{25000, 1, 25000, 1,}, | ||
// 400,000 x 2.5us = 1 second OFF | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
{25000, 0, 25000, 0,}, | ||
// Looping mode needs a Zero ending data to mark the EOF | ||
{0, 0, 0, 0} | ||
}; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial.println("Starting Blink testing..."); | ||
Serial.flush(); | ||
|
||
// 1 RMT Block has 64 RMT_SYMBOLS (ESP32|ESP32S2) or 48 RMT_SYMBOLS (ESP32C3|ESP32S3) | ||
if (!rmtInit(BLINK_GPIO, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 400000)) { //2.5us tick | ||
Serial.println("===> rmtInit Error!"); | ||
} | ||
|
||
// sets the End of Transmission Level to HIGH, after writing to the pin. DEFAULT is LOW. | ||
rmtSetEOT(BLINK_GPIO, RMT_EOT); | ||
// set initial RMT state by writing a single RMT data | ||
rmt_data_t initStateSetup_rmt_data[] = { {1, RMT_EOT, 0, 0} }; | ||
rmtWrite(BLINK_GPIO, initStateSetup_rmt_data, RMT_SYMBOLS_OF(initStateSetup_rmt_data), RMT_WAIT_FOR_EVER); | ||
Serial.printf("\nLED GPIO%d start in the inital level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH"); | ||
delay(EOT_INITIAL_STATE_TIME_MS); // set initial state of the LED is set by RMT_EOT. | ||
|
||
// Send the data and wait until it is done - set EOT level to HIGH | ||
Serial.printf("\nLED GPIO%d Blinks 1 second HIGH - 1 second LOW.\n", BLINK_GPIO); | ||
if (!rmtWrite(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data) - 2, RMT_WAIT_FOR_EVER)) { | ||
Serial.println("===> rmtWrite Blink 1s Error!"); | ||
} | ||
Serial.printf("\nLED GPIO%d goes to the EOT level %s\n", BLINK_GPIO, RMT_EOT == LOW ? "LOW" : "HIGH"); | ||
} | ||
|
||
void loop(){} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.