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

Add ULP.uart_init method for lp_core #22985

Draft
wants to merge 10 commits into
base: development
Choose a base branch
from

Conversation

ameeuw
Copy link
Contributor

@ameeuw ameeuw commented Feb 10, 2025

Description:

Related issue (if applicable): Builds on #22567 to enable uart communication w/ lp_core

This PR adds a initialisation method for the UART interface of the lp_core of the esp32c6.
The method's signature is

BE_FUNC_CTYPE_DECLARE(be_ULP_uart_init, "", "@iii[i]");

With the arguments being:

  • vm
  • RX-pin
  • TX-pin
  • Speed
  • optional: Mode (as done in serial)

The method can be used as follows:

import ULP
ULP.uart_init(4,5,9600,serial.SERIAL_8N1)

Open points on implementation:

  • RTS- and CTS-pin are left with their default assignment. Should these be exposed in the interface as well? Can they be set to -1 to not use them?

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.8
  • The code change is tested and works with Tasmota core ESP32 V.3.1.1.250203
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@ameeuw ameeuw changed the title Feat/lp core serial Add ULP.uart_init method for lp_core Feb 10, 2025
@Staars
Copy link
Contributor

Staars commented Feb 10, 2025

At first glance I thought we could pack this into ˋgpio_initˋ, but this would probably be quite cumbersome, thus I am fine with this new method.

Can you please refactor it to return an error code instead of ˋvoidˋ and remove all Addlogs. I did not look too deep into it, but maybe we can use -2 and -3 for the wrong pins and the ESP_ERR for the rest.

You use a mixture for C function declaration, that is not in line with most of the rest of this driver and not consistent in itself. Just look at the code for gpio_init in this driver. Your code can be written a bit shorter.

I did not check for the actual functionality. Did you create a working example?

@s-hadinger
Copy link
Collaborator

Any news? The PR is still marked as "work in progress"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants