Skip to content
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

Adds RMT End of Transmission Level API #9238

Merged
merged 10 commits into from Feb 14, 2024
Merged

Adds RMT End of Transmission Level API #9238

merged 10 commits into from Feb 14, 2024

Conversation

SuGlider
Copy link
Collaborator

@SuGlider SuGlider commented Feb 12, 2024

Description of Change

This PR adds a new API to RMT that allows the application to set the End of Transmission Level used at the end of writing to a RMT chanel. This level shall be set before transmiting and it can be changed between transmissions using the same pin.

Tests scenarios

ESP32 was tested using this Example:

#define BLINK_GPIO 2

// 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!");
  }
  delay(1000); // initial state of the LED is LOW by default.
  
  // sets the End of Transmission Level to HIGH, after writing to the pin. DEFAULT is LOW.
  rmtSetEOT(BLINK_GPIO, HIGH);
    
  // Send the data and wait until it is done - set EOT level to HIGH
  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!");
  }
    
  // LED shall stay 1 seconds OFF (initial state), BLINK: 1 second ON, 1 second OFF and then stay in HIGH level at the end.
}

void loop(){}

Related links

Closes #9235

@SuGlider SuGlider added this to the 3.0.0-RC1 milestone Feb 12, 2024
@SuGlider SuGlider self-assigned this Feb 12, 2024
Copy link
Contributor

github-actions bot commented Feb 12, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "FIX (rmt): fixes eot_level setting using flags in the TX structure":
    • summary looks empty
    • type/action looks empty
  • the commit message "RMT (feat): adds new feature to set the EOT level after writing RMT channel":
    • summary looks empty
    • type/action looks empty
  • the commit message "RMT (featt): adds a new function to set EOT level after RMT writing":
    • summary looks empty
    • type/action looks empty
  • the commit message "RMT(feat): Create RMT_EndOfTransmissionState.ino example":
    • type/action should start with a lowercase letter
    • type/action should be one of [change, ci, docs, feat, fix, refactor, remove, revert, test]
  • the commit message "Update cores/esp32/esp32-hal-rmt.c":
    • summary looks empty
    • type/action looks empty
  • the commit message "Update cores/esp32/esp32-hal-rmt.c":
    • summary looks empty
    • type/action looks empty
  • the commit message "Update cores/esp32/esp32-hal-rmt.h":
    • summary looks empty
    • type/action looks empty
  • the commit message "adds bool return to rmtSetEOT()":
    • summary looks empty
    • type/action looks empty
  • the commit message "adds return value to rmtSetEOT()":
    • summary looks empty
    • type/action looks empty
  • the commit message "adds return value to the rmtSetEOT() function":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️ Please consider squashing your 10 commits (simplifying branch history).
⚠️

The source branch "RMT_EOT" incorrect format:

  • contains uppercase letters. This can cause troubles on case-insensitive file systems (macOS).
    Please rename your branch.

👋 Hello SuGlider, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

1. An internal issue has been created for the PR, we assign it to the relevant engineer.
2. They review the PR and either approve it or ask you for changes or clarifications.
3. Once the GitHub PR is approved we do the final review, collect approvals from core owners and make sure all the automated tests are passing.
- At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against 5181fea

@SuGlider SuGlider added the Type: Feature request Feature request for Arduino ESP32 label Feb 12, 2024
@SuGlider
Copy link
Collaborator Author

@me-no-dev - All done. I tested it using the example from this PR and it works fine.

Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuGlider Just small typos in comments.
Tested with S2 and works perfectly :)

cores/esp32/esp32-hal-rmt.h Outdated Show resolved Hide resolved
cores/esp32/esp32-hal-rmt.c Outdated Show resolved Hide resolved
cores/esp32/esp32-hal-rmt.c Outdated Show resolved Hide resolved
SuGlider and others added 3 commits February 13, 2024 12:13
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
@VojtechBartoska VojtechBartoska added the Status: Review needed Issue or PR is awaiting review label Feb 14, 2024
@me-no-dev me-no-dev merged commit 7eb1ce8 into master Feb 14, 2024
46 checks passed
@me-no-dev me-no-dev deleted the RMT_EOT branch February 14, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review needed Issue or PR is awaiting review Type: Feature request Feature request for Arduino ESP32
Projects
Development

Successfully merging this pull request may close these issues.

RMT - Add capability to set transmitter End Of Transmission/idle state
4 participants