0

Where can I find the CircuitPython sources for ESP8266 machi
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Where can I find the CircuitPython sources for ESP8266 machi

by lfast on Mon Jul 09, 2018 3:45 pm

I'm a newbie climbing up from following tutorials toward looking at micropython source code to get more insights. I'm having trouble navigating the github sources to find things like machine.py or the equivalent. I'm guessing part of my problem is not understanding how the C source get converted in to Python libraries. Where can I look to get a better understanding of this?

At the more specific level, I'm looking for sources for the machine Module. I've been looking at https://docs.micropython.org/en/latest/ ... ckref.html but that only takes me so far. I want to see the whole library and especially things like the Enumerations.

Navigating the sources is doubly important because I'm trying to use CircuitPython with the 8266 Huzzah board. The differences between micropython, circuitpython, older wiki pages and board differences is giving me headaches. I'm hoping that getting into the sources will provide some relief.

... and if using CircuitPython with the 8266 is not supported or not recommended, please steer me in the right direction.

lfast
 
Posts: 8
Joined: Mon Jun 11, 2018 3:09 pm

Re: Where can I find the CircuitPython sources for ESP8266 m

by tannewt2 on Mon Jul 09, 2018 7:21 pm

In CircuitPython we do support the ESP8266. However, its missing the USB workflow because the ESP doesn't have native USB.

CircuitPython APIs are well documented here: https://circuitpython.readthedocs.io/en ... index.html These docs correspond to these source directories: https://github.com/adafruit/circuitpyth ... d-bindings

MicroPython isn't structured the same way. The code itself is the same though. machine for ESP is here: https://github.com/adafruit/circuitpyth ... dmachine.c

Hope that helps!
~Scott

tannewt2
 
Posts: 841
Joined: Thu Oct 06, 2016 8:48 pm

Re: Where can I find the CircuitPython sources for ESP8266 m

by lfast on Wed Jul 11, 2018 4:32 pm

Thanks Scott,

Those are good jumping off points. Two related questions. Is there anything I could use in PyCharm to provide access to Pythonic library declarations? And are there any fine words out there describing how the C code gets converted into Python. I'm worming my way around and making some progress but any additional references would be most appreciated.

Currently my primary reference docs are
https://circuitpython.readthedocs.io/en ... nit__.html
http://docs.micropython.org/en/latest/e ... ckref.html
I realize the 2nd is a -micro-python page and doesn't necessarily map to circuitpython. That said it's providing excellent and accurate code examples. Eg. Pin() and Timer() work as described. But FWIW here are a couple of the problems that are pushing me toward the source code:

>>> import time
>>> time.time() - fails: module has no attribute 'time'. Mentioned in both references. Perhaps it got replaced by RTC?

The example in https://circuitpython.readthedocs.io/en ... -digitalio fails because D13 is not defined. The 8266 seems to have a different Pin module.

Thanks again for the code refs.
Cheers
Larry Fast

lfast
 
Posts: 8
Joined: Mon Jun 11, 2018 3:09 pm

Re: Where can I find the CircuitPython sources for ESP8266 m

by tannewt2 on Wed Jul 11, 2018 9:40 pm

We don't have any declarations for PyCharm. pip installing Adafruit-Blinka may help though since its the same API.

This is worth a read: https://circuitpython.readthedocs.io/en ... n_hal.html

Don't rely on micropython APIs in CircuitPython because we're removing them as we need the space. The CircuitPython API is better because its the same across boards.

I'm not sure why time.time fails. Please file an issue on GitHub about it.

D13 is missing from the board module because its not labelled that way. Try a different pin instead.

tannewt2
 
Posts: 841
Joined: Thu Oct 06, 2016 8:48 pm

Re: Where can I find the CircuitPython sources for ESP8266 m

by lfast on Wed Jul 11, 2018 11:05 pm

Thanks again. I will retest time.time() the next time I re-flash my board. I want to be clear about my board config before making a nuisance of myself.
Cheers,
Larry

lfast
 
Posts: 8
Joined: Mon Jun 11, 2018 3:09 pm

Re: Where can I find the CircuitPython sources for ESP8266 m

by lfast on Thu Jul 12, 2018 12:37 am

After installing CircuitPython 3.0.0 and the 3.0.0-beta bundle time.time() now reports a useful error: RuntimeError: RTC is not supported on this board.

The digitalio example still fails. I will report it on github.

Cheers,
Larry

lfast
 
Posts: 8
Joined: Mon Jun 11, 2018 3:09 pm

Please be positive and constructive with your questions and comments.