Damien George
a5d48b1162
esp8266: Add tests/onewire.py as a driver and test code for ds18b20 dev.
2016-03-24 17:35:26 +02:00
Damien George
78d0dde562
esp8266: Add onewire helper functions as C module.
...
Includes functions to read and write bits and bytes.
2016-03-24 17:33:42 +02:00
Damien George
0cdbd356fd
esp8266: Implement bit-bang I2C read, and add i2c.readfrom method.
...
I2C reading tested with TSL2561 luminosity sensor.
2016-03-24 11:46:05 +02:00
Damien George
5b9f361824
esp8266: Clean up bit-bang I2C implementation.
...
Changed from using set_sda_scl function to independent set_sda and
set_scl functions.
2016-03-24 11:37:52 +02:00
Paul Sokolovsky
667d64b430
esp8266/modpybi2c: Add missing include.
2016-03-24 11:21:36 +02:00
Damien George
dd32f02cc3
esp8266: Add basic I2C driver, with init and writeto methods.
...
Tested and working with SSD1306 I2C display.
2016-03-24 11:17:17 +02: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
a1d072df81
esp8266: Enable auto-indent in REPL.
2016-03-23 16:30:29 +02:00
Paul Sokolovsky
df1f6783f2
esp8266: Add "socket" and "usocket" aliases for lwip module.
2016-03-23 16:25:55 +02:00
Paul Sokolovsky
494aea3e86
esp8266: Enable non-blocking stream support.
2016-03-23 16:15:49 +02:00
Damien George
5bc9398d9d
esp8266: Enable more extmod's: uheapq, ure, uzlib.
2016-03-23 14:19:14 +02:00
Damien George
8000d51b68
esp8266: Add module weak link from json to ujson.
2016-03-23 14:16:46 +02:00
Paul Sokolovsky
1a0adf49df
esp8266: Enable urandom module.
2016-03-23 13:33:17 +02:00
Damien George
e673714cfe
esp8266: Make mp_hal_delay_us work with new event framework.
2016-03-23 13:01:21 +02:00
Paul Sokolovsky
58e2ad42ae
esp8266: Update README with the latest features.
2016-03-23 12:08:15 +02:00
Damien George
556a1df6fd
esp8266/ets_alt_task: Make FIRST_PRIO=0 to cover all task priorities.
...
FIRST_PRIO=2 works but using 0 is hopefully safer, and can anyway be
optimised in the future.
2016-03-17 16:28:06 +00:00
Paul Sokolovsky
9d7b871f58
esp8266: Store frozen modules in FlashROM.
...
Requires special lexer to access their contents.
2016-03-17 23:06:47 +08:00
Paul Sokolovsky
e5c39a3a9e
esp8266: Switch to lwIP built from source.
...
Using https://github.com/pfalcon/esp-open-lwip project.
2016-03-12 11:45:53 +07:00
Christopher Arndt
3d0e3a3d3e
esp8266: Mention git submodule in build instructions for esp8266 port.
2016-03-11 10:07:02 +00:00
Damien George
932f07ccf5
esp8266: Rejig Makefile so extmod/modlwip.o is placed under build/.
2016-03-11 12:00:01 +07:00
Paul Sokolovsky
4c2cb7e384
esp8266: Define MICROPY_EVENT_POLL_HOOK for the port.
2016-03-11 10:41:10 +07:00
Paul Sokolovsky
6e5c31c947
esp8266: Be sure to build ets_alt_task.
2016-03-11 09:43:39 +07:00
Paul Sokolovsky
a099bfe89c
esp8266/esp_mphal: Add higher-level event polling function.
...
ets_event_poll() polls both system events and uPy pending exception.
2016-03-11 09:42:03 +07:00
Paul Sokolovsky
54fc247f9b
esp8266/ets_alt_task: Update for vendor SDK 1.5.0.
...
SDK 1.5.0 has a task with priority 3: ets_task(401001f4, 3, 3fff9808, 4).
Recognizing SDK version requires the latets esp-open-sdk build.
2016-03-11 09:17:57 +07:00
Paul Sokolovsky
97375f4576
esp8266/ets_alt_task: Be sure to "pop" event before calling its handler.
...
Otherwise, if handler calls recursive event loop, there's infinite
recursion (because the loop calls the same handler on same event again).
2016-03-11 09:16:34 +07:00
Damien George
7261f17b9e
esp8266: Feed WDT in ets_loop_iter().
2016-03-11 09:15:06 +07: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
Paul Sokolovsky
5239a8a82b
esp8266/modnetwork: Add symbolic names for network interfaces: STA_IF & AP_IF.
...
These are expected to be passed to network.WLAN() to instantiate network
interface objects.
2016-03-10 10:44:15 +07:00
Paul Sokolovsky
a49c16069c
esp8266/modnetwork: Introduce interface .config() method.
...
Allows to set (in case keyword args are given) or query (in case a single
"symbolic keyword" (a string, value is the same as keyword)) arbitrary
interface paramters (i.e. extensible and adaptable to various hardware).
Example usage:
ap_if = network.WLAN(1)
ap_if.config(essid="MicroPython on Air")
print(ap_if.config("essid"))
2016-03-10 10:41:55 +07:00
Paul Sokolovsky
d5a12a6608
esp8266/modnetwork: Move config defines to the top.
2016-03-10 10:39:52 +07:00
Paul Sokolovsky
1c43a0fbf8
esp8266/modnetwork: Add per-interface .active() method.
...
Allows to up/down interface when called with a boolean, or query current
state if called without args. This per-interface method is intended to
supersede adhoc network.wifi_mode() function.
2016-03-10 09:31:23 +07:00
Paul Sokolovsky
7378c50b2f
esp8266: Move wifi_mode() and phy_mode() to network module.
2016-03-10 09:29:21 +07:00
Paul Sokolovsky
9e8396accb
esp8266/modnetwork: Allow to configure STA and AP interfaces separately.
...
On ESP8266, there're 2 different interfaces. Pretending it's not the case
desn't make sense. So, network.WLAN() now takes interface id, and returns
interface object. Individual operations are then methods of interface
object. Some operations require i/f of specific type (e.g. .connect()
makes sense only for STA), other are defined for any (e.g. .ifconfig(),
.mac()).
2016-03-10 09:24:54 +07:00
Damien George
f7be80398e
esp8266: Move pyb.freq to machine.freq.
2016-03-09 09:03:59 +07:00
Paul Sokolovsky
a0cd118b14
esp8266/main: Module to run on boot is "boot", not "main".
2016-03-08 12:37:24 +07:00
Damien George
3fbbbecec9
esp8266: Put more code in iROM section.
...
Also explicitly name the py/*.o files in the linker file, to enable easy
testing of putting certain ones in iRAM.
2016-03-08 11:31:39 +07:00
Paul Sokolovsky
d684f872bd
esp8266/Makefile: Add define for ESP8266 lwIP.
2016-03-08 10:29:05 +07:00
Damien George
05dda0ee9e
esp8266: Enable modlwip.
2016-03-08 10:21:50 +07:00
Paul Sokolovsky
88b0490945
esp8266: Don't gc-collect BSS.
...
None of the other ports do, since introduction of mp_state_ctx_t. In
the case of current esp8266 port, heap is inside BSS, so scanning it
picked up a lot of dead pointers.
2016-03-08 10:16:06 +07:00
Paul Sokolovsky
db984b73f3
esp8266: Enable stack overflow checking.
2016-03-07 14:15:00 +07:00
Damien George
52d7685d9a
esp8266: Allow Makefile's BAUD variable to be overridden.
2016-03-06 05:57:36 +02:00
Paul Sokolovsky
d9d4a72679
esp8266/uart: Add uart_flush() function.
2016-03-05 22:13:26 +02:00
Paul Sokolovsky
d3a4d39687
esp8266: Support raising KeyboardInterrupt on Ctrl+C.
2016-03-05 22:01:27 +02:00
Damien George
077448328a
esp8266/etshal.h: More prototypes of ESP8266 SDK/BootROM functions.
2016-03-05 21:56:32 +02:00
Paul Sokolovsky
26f0616e8f
esp8266/modmachine: Add Pin class from modpyb.
2016-03-05 21:43:11 +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
Paul Sokolovsky
8ab16b6af0
esp8266: Add custom _assert() function.
...
Enabling standard assert() (by removing -DNDEBUG) produces non-bootable
binary (because all messages go to .rodata which silently overflows).
So, for once-off debugging, have a custom _assert().
2016-03-05 11:30:15 +02:00
Paul Sokolovsky
c70637bc00
esp8266/modmachine: Timer: Add ONE_SHOT and PERIODIC symbolic constants.
2016-03-04 22:26:59 +02:00
Paul Sokolovsky
98b727c931
esp8266/modmachine: Use etshal.h.
2016-03-04 19:41:15 +02:00
Paul Sokolovsky
f22a4f8e0a
esp8266/etshal.h: Add timer functions prototypes.
2016-03-04 19:39:24 +02:00
Paul Sokolovsky
f39bcb304b
esp8266/modmachine: Changing params of a timer requires disarming it first.
2016-03-04 18:41:37 +02:00
Paul Sokolovsky
7193086c03
esp8266/modmachine: Basic implementation of Timer for OS virtual timers.
2016-03-04 18:40:35 +02:00
Paul Sokolovsky
4284b3811f
esp8266: Enable modmachine.
2016-03-04 17:37:13 +02:00
Paul Sokolovsky
5d7c408ba8
esp8266: Add modmachine with mem* arrays.
2016-03-04 17:34:25 +02:00
Paul Sokolovsky
6abafca1aa
esp8266/modutime: Support float argument to time.sleep().
2016-03-04 16:52:30 +02:00
Paul Sokolovsky
a4c8ef9d16
esp8266: Reset "virtual RTC" on power on.
...
Initialize RTC period coefficients, etc. if RTC RAM doesn't contain valid
values. time.time() then will return number of seconds since power-on, unless
set to different timebase.
This reuses MEM_MAGIC for the purpose beyond its initial purpose (but the whole
modpybrtc.c need to be eventually reworked completely anyway).
2016-03-04 16:49:01 +02:00
Damien George
57884996b9
esp8266: Add time.{sleep_ms,sleep_us,ticks_ms,ticks_us,ticks_diff}.
...
Framework for time.ticks_cpu added, but not implemented.
2016-03-04 09:25:53 +02:00
Damien George
b41a14a4b9
esp8266: Add mp_hal_delay_us function.
2016-03-04 09:25:05 +02:00
Damien George
f70873db23
esp8266: Enable more features in mpconfigport.h.
...
This is to get the test suite running and passing.
2016-03-03 23:34:31 +02:00
Paul Sokolovsky
7480ee5892
esp8266: Enable uhashlib module.
2016-03-03 20:14:50 +02:00
Paul Sokolovsky
70fb9ee99b
esp8266: Enable config settings helpful for debugging.
2016-03-03 20:12:26 +02:00
Paul Sokolovsky
259f1344ca
esp8266/esp8266.ld: Link in SDK version section.
...
Otherwise, os.uname() returns empty string for SDK version.
2016-03-03 15:37:19 +02:00
Paul Sokolovsky
ff69a1d27d
esp8266: Enable ujson, ubinascii, and uctypes modules.
2016-03-03 15:35:29 +02:00
Damien George
02ea74d8f5
esp8266: Add network.ifconfig().
2016-03-02 23:04:21 +02:00
Damien George
1febaf3ac3
esp8266: Change "soft reboot" message to work with pyboard.py.
2016-03-02 22:58:48 +02:00
Damien George
d083d7d610
esp8266: Allow Makefile's PORT variable to be overridden.
2016-03-02 22:50:55 +02:00
Damien George
6f4357c28e
esp8266: Enable math module.
2016-03-02 22:43:10 +02:00
Damien George
6d0629bddc
esp8266: Enable float support, using 30-bit stuffed floats.
...
No complex numbers though.
2016-03-02 22:43:10 +02:00
Damien George
ecd1272d16
esp8266: Switch bignum implementation from long-long to mpz.
2016-03-02 22:43:10 +02:00
Paul Sokolovsky
609a9c6b71
eagle.rom.addr.v6.ld: More symbols from SDK 1.5.0.
2016-02-14 13:09:42 +02:00
Paul Sokolovsky
a2e39a756c
esp8266/modpybrtc: Simplify multiplication by fixed-point value.
2016-02-12 23:20:52 +02:00
Paul Sokolovsky
9e78ab4b86
esp8266/README: Add hint about adding toolchain to PATH.
2016-02-08 22:35:24 +02:00
Paul Sokolovsky
814b1ae3a9
esp8266/modpybrtc: pyb_rtc_memory(): Fix copy-paste error.
2016-02-08 21:39:33 +02:00
Alex March
81407729a5
esp8266/modesp: Implement flash_write(), flash_erase().
2016-02-08 11:42:24 +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
Paul Sokolovsky
adfe4ff72a
esp8266: Support CFLAGS_EXTRA.
2016-01-08 01:30:20 +02:00
Paul Sokolovsky
43fecb0acb
esp8266/modesp: Allow to compile out proprietary espconn stuff.
2015-12-30 15:53:51 +02:00
Paul Sokolovsky
fce0036a67
esp8266: mac() function belongs to network module per the latest API.
2015-12-27 10:03:32 +02:00
Damien George
84b245f187
lib/utils: Add pyexec_frozen_module to load and execute frozen module.
...
This is a convenience function similar to pyexec_file. It should be used
instead of raw mp_parse_compile_execute because the latter does not catch
and report exceptions.
2015-12-26 12:32:33 +00:00
Paul Sokolovsky
abd0fcfc86
esp8266: Remove superfluous includes.
2015-12-21 22:08:06 +02:00
Paul Sokolovsky
e13d462f77
esp8266/modesp: flash_read() takes 2 args (fix typo).
2015-12-21 22:07:11 +02:00
Paul Sokolovsky
90202b4c0d
esp8266/modesp: Implement flash_read(offset, size_bytes) function.
...
Based on vendor API documentation, untested on real hardware.
2015-11-24 23:29:26 +02:00
Paul Sokolovsky
73ff0687f2
lib/utils/printf: Move from stmhal/ .
...
This file contains various MicroPython-specific helper functions, so isn't
good fit for lib/libc/.
2015-11-10 18:58:58 +02:00
Damien George
40274fec9c
lib/pyexec: Move header pyexec.h from stmhal directory.
2015-11-09 13:13:09 +00:00
Paul Sokolovsky
0ec51441de
stmhal: pyexec.c is common module, move to lib/utils/ .
2015-10-31 19:35:10 +03:00
Damien George
731f359292
all: Add py/mphal.h and use it in all ports.
...
py/mphal.h contains declarations for generic mp_hal_XXX functions, such
as stdio and delay/ticks, which ports should provide definitions for. A
port will also provide mphalport.h with further HAL declarations.
2015-10-31 19:14:30 +03:00
Paul Sokolovsky
6a09e7d7ae
esp8266: Switch to standard mp_hal_ticks_ms() MPHAL function.
2015-10-29 19:40:05 +03:00
Paul Sokolovsky
ebd9f550e8
esp8266: Switch to standard mp_hal_delay_ms() MPHAL function.
2015-10-29 13:03:59 +03:00
Paul Sokolovsky
5699fc9d0e
esp8266: Switch to standard mp_hal_delay_us() MPHAL function.
2015-10-29 02:06:58 +03:00
Paul Sokolovsky
0dbd928cee
Makefiles: Remove duplicate object files when linking.
...
Scenario: module1 depends on some common file from lib/, so specifies it
in its SRC_MOD, and the same situation with module2, then common file
from lib/ eventually ends up listed twice in $(OBJ), which leads to link
errors.
Make is equipped to deal with such situation easily, quoting the manual:
"The value of $^ omits duplicate prerequisites, while $+ retains them and
preserves their order." So, just use $^ consistently in all link targets.
2015-10-24 15:46:53 +03:00
Damien George
f09f8097d5
esp8266: Put more code in irom0 section, to get it building again.
2015-10-20 22:59:31 +01:00
Paul Sokolovsky
e0f5df579b
all: Make netutils.h available to all ports by default.
...
Generally, ports should inherit INC from py.mk, append to it, not
overwrite it. TODO: Likely should do the same for other vars too.
2015-10-19 18:32:42 +03:00
Damien George
0334058fa4
Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc.
2015-10-12 00:06:25 +01:00
Bill Owens
e2bfa471fa
esp8266: Added wlan.isconnected() to maintain parity with other ports.
2015-09-15 20:07:50 +03:00
Damien George
229b908d2e
esp8266: Remove "time" command from deploy target.
2015-09-12 22:22:30 +01:00
Bill Owens
a66a99bfd8
esp8266: Added wifi_mode() to read and set WiFi operating mode.
2015-08-29 16:58:51 +03:00
Damien George
75b1d881ec
esp8266: Use m_new/m_renew/m_del funcs instead of private gc_xxx.
2015-07-20 12:14:21 +01:00
Paul Sokolovsky
ab14c30493
esp8266: modesp: Update for gc_realloc() refactor.
...
TODO: Contributed code in modesp incorrectly uses private gc_* API.
2015-07-19 00:28:16 +03:00