Commit Graph

16 Commits

Author SHA1 Message Date
Damien George 8e130fcf2b esp8266/modpybpin: Make pin.irq() methods take keyword args. 2016-05-03 13:47:10 +01:00
Damien George 8a3e9036eb esp8266/modpybpin: Use None instead of PULL_NONE for no-pull config. 2016-05-03 13:13:56 +01:00
Damien George 9df6b3a2c2 esp8266/modpybpin: Use enum+array instead of struct for parsing args. 2016-05-03 12:44:28 +01:00
Paul Sokolovsky 6d103b6548 py: Move call_function_*_protected() functions to py/ for reuse.
They almost certainly needed by any C code which calls Python callbacks.
2016-04-25 19:31:17 +03:00
Damien George a2d5d84ecc esp8266: Convert mp_hal_pin_obj_t from pin ptr to simple integer.
Most pin I/O can be done just knowing the pin number as a simple
integer, and it's more efficient this way (code size, speed) because it
doesn't require a memory lookup to get the pin id from the pin object.

If the full pin object is needed then it can be easily looked up in the
pin table.
2016-04-22 10:04:12 +01:00
Damien George 674bf1bc81 esp8266: Add hard IRQ callbacks for pin change on GPIO0-15. 2016-04-14 12:44:26 +01:00
Damien George d9d408135d esp8266: Add dummy entries for non-existing pins to simplify pin logic.
Now pins can be easily looked up in the table using the pin number as the
index and vice versa.
2016-04-14 12:43:25 +01:00
Damien George a9a732af1f esp8266: Remove pin_id field from C pin object.
This field is the same as phys_port and not needed.
2016-04-14 12:43:25 +01:00
Damien George 7059c8c23c esp8266: Expose pin object as a public structure for use as C pin API.
This is an initial attempt at making a simple C pin API for writing
things like I2C drivers in C.
2016-03-24 11:07:41 +02:00
Paul Sokolovsky eb247eacd8 esp8266/modpybpin: Add support for GPIO16.
GPIO16 is actually special-function I/O, though some boards have LED there.
2016-03-05 21:37:55 +02:00
Damien George 342d903a13 esp8266: Expose simple pin API at C level. 2016-03-05 21:36:32 +02:00
Damien George cdad2b6f4d esp8266: Implement Pin.__call__() and Pin.OPEN_DRAIN mode.
OPEN_DRAIN is of course synthesised.  All pin modes are tested and
working.
2016-03-05 21:35:32 +02:00
Damien George 5b3f0b7f39 py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.
The first argument to the type.make_new method is naturally a uPy type,
and all uses of this argument cast it directly to a pointer to a type
structure.  So it makes sense to just have it a pointer to a type from
the very beginning (and a const pointer at that).  This patch makes
such a change, and removes all unnecessary casting to/from mp_obj_t.
2016-01-11 00:49:27 +00:00
Josef Gajdusek 7d8edeff4e esp8266: Update to SDK version 1.1.0 (MIT-licensed).
1. Updated linker script, now user app appears to contain exception vector
table and oesn't work (faults) without it.
2. Commened out support for GPIO pulldown, which was removed in this SDK
version without clear explanation, but apparently because it was released
without proper validation, and now turns out it doesn't work as expected,
or there's a different function there.
2015-05-30 20:58:59 +03:00
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
Damien George 87c6250b4c esp8266: Add basic pyb.Pin class; supports output mode only. 2015-02-13 22:21:44 +00:00