[Feature Request] GPIO support in MeshCore
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- c
- Domain
- cli, embedded-iot
Research direction
Start by reading src/MeshCore.h, especially the existing MainBoard GPIO methods, then trace the common CLI and board subclasses for the roles and board types mentioned in the proposal. The issue proposes GPIO defines, analog and digital access, and new CLI commands, but leaves compatibility and implementation details open; done would mean agreeing on the interface and supporting the requested pin operations across board roles.
Written by the indexing model from the issue text.
Description
I need to access GPIO pins on my meshcore nodes. I guess that this is something that others also want, and I can write an implementation of this if the proposal is acceptable. The idea is that we expose new CLI commands that lets you set/retieve the values of a GPIO-pin. This is something that I want to implement on all roles.
I want to make some new defines:
GPIO_IN
GPIO_OUT
GPIO_DAC
GPIO_ADC
These defines is a comma-separated list of GPIO-pins that is accessible using the CLI. If a define is not present, then there will be no corresponding GPIO for that type.
Then I want to extend mesh::MainBoard in src/MeshCore.h with some new member functions. These should be overridden at the board type (ESP32 etc).
class MainBoard {
public:
virtual bool setGPIO(int pin, bool newState) = 0; // returns true if the pin was set
virtual bool setDAC(int pin, float value) = 0; // returns true if the pin was set
virtual bool getGPIO(int pin); // return the value, or false if the pin does not exist
virutal float getADC(int pin); // returns the value, or 0
}
I know that getGpio() and setGpio() is defined in MainBoard already, and probably it would be a good idea to use them. I just don't know the consequence yet of using these.
I have not a GPIO-init function here. I think that can be handled by the MainBoard subclass own setup/begin() function.
Then change the common CLI, add some new commands.
set gpio 1 1
get gpio 1
set gpio 2 3.43
If the GPIO is analog, use float values, for digital use 0 or 1.
Any thoughts?
- Dominant language
- C
- Stars
- 3.9k
- Forks
- 1.5k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 26
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from meshcore-dev/MeshCore
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
meshcore-dev/MeshCore#3622 ·
Maintainers usually reply within 1 day
-
[Feature Request] Set Australia (Mid) Preset to automatically enable 2 byte default path hash sizeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
meshcore-dev/MeshCore#3571 · 5 reactions ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
meshcore-dev/MeshCore#3567 · 1 comment ·
Maintainers usually reply within 1 day
-
RTC_RX8130CE writes and reads the one-hot WEEK register as a numberPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
meshcore-dev/MeshCore#3549 ·
Maintainers usually reply within 1 day
-
Repeater: CLI reply to 'setperm <key> 0' is lost when the removed ACL entry sits before the requester (stale ClientInfo* after array shift)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
meshcore-dev/MeshCore#3513 ·
Maintainers usually reply within 1 day
All issues in meshcore-dev/MeshCore
Similar issues
-
[Bug] Unhandled ValueError terminates watchdog thread when GISRC value contains multiple colonsOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
bug Component component: net
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RT-Thread/rt-thread#11913 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
contiki-ng/contiki-ng#3289 ·
Maintainers usually reply within 3 days
-
area:docs help wanted type:enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
semantic-reasoning/wirelog#2229 ·
Maintainers usually reply within 1 day