Commit Graph

6 Commits

Author SHA1 Message Date
Dan Halbert ef61b5ecb5 Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet
esp8266 not tested yet
2017-08-25 22:17:07 -04:00
Alexander Steffen 299bc62586 all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-07-18 11:57:39 +10:00
Scott Shawcroft ccbb5e84f9 This introduces an alternative hardware API called nativeio structured around different functions that are typically accelerated by native hardware. Its not meant to reflect the structure of the hardware.
Docs are here: http://tannewt-micropython.readthedocs.io/en/microcontroller/

It differs from upstream's machine in the following ways:

* Python API is identical across ports due to code structure. (Lives in shared-bindings)
* Focuses on abstracting common functionality (AnalogIn) and not representing structure (ADC).
* Documentation lives with code making it easy to ensure they match.
* Pin is split into references (board.D13 and microcontroller.pin.PA17) and functionality (DigitalInOut).
* All nativeio classes claim underlying hardware resources when inited on construction, support Context Managers (aka with statements) and have deinit methods which release the claimed hardware.
* All constructors take pin references rather than peripheral ids. Its up to the implementation to find hardware or throw and exception.
2016-11-21 14:11:52 -08:00
Damien George 34e0198436 esp8266: Extend system microsecond counter to 64-bits; use in ticks_ms.
So now ticks_ms can count up to the full 30 bits.  Fixes issue #2412.
2016-09-20 14:28:17 +10:00
Damien George 927388e80e esp8266: Provide a dedicated variable to disable ets_loop_iter.
So ets_loop_iter is now only disabled when using machine.disable_irq.
2016-06-01 17:26:49 +01:00
Paul Sokolovsky 97c2628900 esp8266: Add alternative event loop implementation.
This implementation provides the same interface and uses the same
datastructures as used by BootROM, i.e. is a drop-in replacement for it.
But it offers one advantage: it allows to run single iteration of
event-pumping loop.

Original BootROM function are renamed, prefixed with underscore. There's
a switch which allows to use forward calls to them, for compatibility
testing.

The implementation also includes workarounds for hardware timer handler,
and these workarounds may be SDK version specific.
2016-03-11 09:13:31 +07:00