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

Use GPIO2 as TX #261

Closed
marcootaviomello opened this issue Nov 29, 2022 · 9 comments
Closed

Use GPIO2 as TX #261

marcootaviomello opened this issue Nov 29, 2022 · 9 comments
Assignees

Comments

@marcootaviomello
Copy link

I need to use the GPIO2 as a TX, I know that it is a stap pin, but a PCB version has already been produced considering it as a TX, by default I know that the lib does not allow use, can someone tell me in the source code where I should comment to remove this restriction?

@fanfanlatulipe26
Copy link

Have a look at #251
The test is in bool isValidGPIOpin(int8_t pin);

@dok-net
Copy link
Collaborator

dok-net commented Dec 14, 2022

The library will be not reverted to allow the use of official strapping pins, this has been stated in prior issues to the same effect here.
The issue can be left pending as a reminder, that perhaps some mechanism to override this restrictive tests could be implemented in a future release.

@hemchik
Copy link

hemchik commented Feb 9, 2023

Здравствуйте, как с вами связаться?

@dok-net
Copy link
Collaborator

dok-net commented Feb 18, 2023

I am working on implementing this via template syntax. Bear with me.

@dok-net dok-net self-assigned this Feb 18, 2023
@dok-net
Copy link
Collaborator

dok-net commented Feb 18, 2023

@mcspr any opinion on this from the ESP8266 team?

@dok-net
Copy link
Collaborator

dok-net commented Mar 5, 2023

In master, there is now the BasicUART class template. By providing a custom implementation for GpioCapabilities, one case permit or restrict the use of any GPIOs, strapping pin or not, etc.

@dok-net
Copy link
Collaborator

dok-net commented Mar 5, 2023

@fanfanlatulipe26 Hi, I hope you will be glad to hear that your request has now been resolved via C++ template syntax. Here's a little advice on what needs to be done, if you are not completely privy to C++:

The default SoftwareSerial class is now a template class, aliased from BasicUART< GpioCapabilities >. Your mission, if you accept it, is to provide a duck typed implementation of IGpioCapabilities, possibly with no checks at all that the given GPIOs conform to the requested capabilities.
Say you name that instance class UncheckedGpioCapabilities. You would do that in your code, no need to change the library sources. Then do this:
using PromiscuousUART = BasicUART< UncheckedGpioCapabilities >;
And there you go, your new PromiscuousUART will allow you to configure it for any GPIO you wish.

It's in the main branch now, will hopefully soon be released as 8.0.0.

@fanfanlatulipe26
Copy link

Thanks for the tips. I really need to learn C++ if I want to understand this code ;-)

@dok-net
Copy link
Collaborator

dok-net commented Mar 6, 2023

@fanfanlatulipe26 you might ;-) I hope you'll be able to figure out how to copy, paste and modify to get where you need to be, given my hints from earlier. I'm closing this issue because it's resolved.

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

No branches or pull requests

4 participants