-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
RMT Legacy Driver option #9941
Merged
+51
−1
Merged
RMT Legacy Driver option #9941
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4ddeb3b
feat(rmt): allow legacy driver
SuGlider b295f9c
feat(rmt): legacy driver example
SuGlider 3629905
fix(rmt): legacy driver example
SuGlider a11b473
fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF
SuGlider 930681c
fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF
SuGlider 2fdbe44
fix(rmt): ESP32_ARDUINO_NEW_RMT_DRV_OFF
SuGlider a1f228b
fix(rmt): GPIO HAL only
SuGlider 4320650
fix(rmt): error case
SuGlider fe50369
fix(rmt): not necessary change
SuGlider 1a14a6d
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] a64b428
ci(pre-commit): Ignore build_opt in clangformat
lucasssvaz 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 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 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 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 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 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 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
52 changes: 52 additions & 0 deletions
52
libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/Legacy_RMT_Driver_Compatible.ino
This file contains 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,52 @@ | ||
/* | ||
* This example demonstrates how to use the file build_opt.h to disable the new RMT Driver | ||
* Note that this file shall be added the Arduino project | ||
* | ||
* If the content of this file changes, it is necessary to delete the compiled Arduino IDE cache | ||
* It can be done by changing, for instance, the "Core Debug Level" option, forcing the system to rebuild the Arduino Core | ||
* | ||
*/ | ||
|
||
#ifndef ESP32_ARDUINO_NEW_RMT_DRV_OFF | ||
|
||
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NEW_RMT_DRV_OFF" to use the RMT Legacy driver | ||
#warning "ESP32_ARDUINO_NEW_RMT_DRV_OFF is not defined, using new RMT driver" | ||
|
||
#define RMT_PIN 4 // Valid GPIO for ESP32, S2, S3, C3, C6 and H2 | ||
bool installed = false; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial.println("This sketch uses the new RMT driver."); | ||
installed = rmtInit(RMT_PIN, RMT_TX_MODE, RMT_MEM_NUM_BLOCKS_1, 10000000); | ||
} | ||
|
||
void loop() { | ||
String msg = "RMT New driver is installed: "; | ||
msg += (char*)(installed ? "Yes." : "No."); | ||
Serial.println(msg); | ||
delay(5000); | ||
} | ||
|
||
#else | ||
|
||
// add the file "build_opt.h" to your Arduino project folder with "-DESP32_ARDUINO_NEW_RMT_DRV_OFF" to use the RMT Legacy driver | ||
// neoPixelWrite() is a function that writes to the RGB LED and it won't be available here | ||
#include "driver/rmt.h" | ||
|
||
bool installed = false; | ||
|
||
void setup() { | ||
Serial.begin(115200); | ||
Serial.println("This sketch is using the RMT Legacy driver."); | ||
installed = rmt_driver_install(RMT_CHANNEL_0, 0, 0) == ESP_OK; | ||
} | ||
|
||
void loop() { | ||
String msg = "RMT Legacy driver is installed: "; | ||
msg += (char*)(installed ? "Yes." : "No."); | ||
Serial.println(msg); | ||
delay(5000); | ||
} | ||
|
||
#endif // ESP32_ARDUINO_NEW_RMT_DRV_OFF |
1 change: 1 addition & 0 deletions
1
libraries/ESP32/examples/RMT/Legacy_RMT_Driver_Compatible/build_opt.h
This file contains 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 @@ | ||
-DESP32_ARDUINO_NEW_RMT_DRV_OFF |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho a warning for using a actual function is not correct.
It should be the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the example, it is just a way to say "this example is intended to demonstrate how to use RMT Legacy Driver within Arduino Core 3.0.x + IDF 5.x"
Please elaborate futher.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say: make it an error and no extra code. It should never fail, right? except if we mess up platform.txt, in which case it will be used as notification that the feature broke.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have modified it. Please review it.