Firmware simplification for ESP8266 question.
Posted: Mon Jun 07, 2021 6:23 pm
Hi all,
I’m currently teaching a course on Microcontroller programming for first-time coders and I wanted to make a simplification to the ESP8266 firmware to support initialization of an input and output GPIO Pin by using a case insensitive string rather than an instance variable from the machine library.
The current method in MicroPython of initializing GPIO pin D1 is the following:
I wanted to further simplify the firmware to, instead, support the following GPIO pin intialization:
Ideally with this new feature, the string titled "output" and "input" would be case insensitive and the initialization of the pin would be able to also support the strings “out” and “in”.
From the research that I have done, I found that the file machine_pin.c (https://github.com/micropython/micropyt ... hine_pin.c) initializes GPIO pins for the ESP8266, but I’m not able to pinpoint the function that is used to instantiate a specific pin as an input or output. Does anyone have any suggestions or can provide a walkthrough of how to develop this feature?
Thank you so much,
Ryan Dehmoubed
I’m currently teaching a course on Microcontroller programming for first-time coders and I wanted to make a simplification to the ESP8266 firmware to support initialization of an input and output GPIO Pin by using a case insensitive string rather than an instance variable from the machine library.
The current method in MicroPython of initializing GPIO pin D1 is the following:
Code: Select all
Led = machine.Pin(“D1”, machine.Pin.OUT) #to initialize D1 as an output GPIO pin.
Led = machine.Pin(“D1”, machine.Pin.IN) #to initialize D1 as an input GPIO pin.
I wanted to further simplify the firmware to, instead, support the following GPIO pin intialization:
Code: Select all
Led = machine.Pin(“D1”, “Output”)
Led = machine.Pin(“D1”, “Input”)
From the research that I have done, I found that the file machine_pin.c (https://github.com/micropython/micropyt ... hine_pin.c) initializes GPIO pins for the ESP8266, but I’m not able to pinpoint the function that is used to instantiate a specific pin as an input or output. Does anyone have any suggestions or can provide a walkthrough of how to develop this feature?
Thank you so much,
Ryan Dehmoubed