Commit Graph

477 Commits

Author SHA1 Message Date
Paul Sokolovsky
4d45f286eb esp8266/Makefile: Use latest esptool.py flash size auto-detection. 2016-10-18 00:06:59 +03:00
Paul Sokolovsky
799ccdc789 esp8266, stmhal, unix: MAKE_FROZEN is consistently defined in mkenv.mk. 2016-10-16 10:49:36 +03:00
Paul Sokolovsky
a97284423e extmod/utime_mphal: Factor out implementations in terms of mp_hal_* for reuse.
As long as a port implement mp_hal_sleep_ms(), mp_hal_ticks_ms(), etc.
functions, it can just use standard implementations of utime.sleel_ms(),
utime.ticks_ms(), etc. Python-level functions.
2016-10-14 20:14:01 +03:00
Damien George
ed878275b0 esp8266: Enable micropython.alloc_emergency_exception_buf(). 2016-10-14 01:27:53 +11:00
Damien George
af8d791bd0 esp8266: Enable importing of precompiled .mpy files. 2016-10-12 11:03:58 +11:00
Damien George
11fc6553e8 esp8266: Enable sys.{stdin,stdout,stderr}.buffer for raw serial access. 2016-10-12 11:03:58 +11:00
Radomir Dopieralski
db4e009217 esp8266/mpconfigport: Enable MICROPY_PY_BUILTINS_SLICE_ATTRS 2016-10-11 12:22:36 +02:00
Paul Sokolovsky
3b3612c65b esp8266: Make neopixel support configurable.
To save iRAM.
2016-10-09 00:56:46 +03:00
Damien George
23a568240d esp8266: Use mp_raise_OSError helper function. 2016-10-07 14:00:51 +11:00
dmanso
0363e1d7b5 esp8266: Add FLASH_MODE,FLASH_SIZE options for make deploy target.
Added options to make deploy so it can be used for ESP8266 boards with
other flash configurations.  For example NodeMCU DEVKIT V1.0 can now use:

    $ make FLASH_MODE=dio FLASH_SIZE=32m deploy
2016-10-07 13:18:48 +11:00
Damien George
056da75a8a esp8266: Make PY_UHASHLIB_SHA1 config depend on PY_USSL and SSL_AXTLS.
SHA1 can only be supported if ussl module is compiled in, and it uses
axtls.
2016-10-06 12:28:28 +11:00
puuu
bcf60b43ee esp8266/modpybrtc.c: Implement machine.RTC.alarm_left()
Implementation of machine.RTC.alarm_left(), like described in the
documentation.
2016-10-05 12:20:30 +11:00
Paul Sokolovsky
161e9f4115 esp8266/main: Put /lib before / in sys.path.
upip will use first non-empty component in sys.path as an install path
(if MICROPYPATH envvar is not set, like it will be for baremetal targets).
2016-10-05 00:02:51 +03:00
Paul Sokolovsky
52784bf595 esp8266/modmachine: idle(): Return number of CPU cycles spent idling.
Useful to better understand esp8266 inner workings and compare behavior
in different cases.
2016-10-04 21:20:47 +03:00
Damien George
b932b2dd1f extmod/machine_spi: Use delay_half, not baudrate, for internal timing.
The delay_half parameter must be specified by the port to set up the
timing of the software SPI.  This allows the port to adjust the timing
value to better suit its timing characteristics, as well as provide a
more accurate printing of the baudrate.
2016-10-04 13:43:02 +11:00
Damien George
bd87375202 esp8266/moduos: Move stat/statvfs funcs to sit within #if VFS guard. 2016-10-03 21:48:32 +11:00
Damien George
d434ce3fca extmod/machine_spi: Factor out software SPI code from esp8266 to extmod. 2016-10-03 16:43:44 +11:00
Damien George
5bb28c7f10 extmod/machine_spi: Simplify SPI xfer function to only take one buf len.
There is no need to take src_len and dest_len arguments.  The case of
reading-only with a single output byte (originally src_len=1, dest_len>1)
is now handled by using the output buffer as the input buffer, and using
memset to fill the output byte into this buffer.  This simplifies the
implementations of the spi_transfer protocol function.
2016-10-03 12:39:31 +11:00
Paul Sokolovsky
6ab2c5e6cc lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.
Utility functions for keyboard interrupt handling, to be reused across
(baremetal) ports.
2016-09-29 10:15:38 -07:00
Alex March
4fb72fe624 esp8266: Add uos.statvfs() to get filesystem status. 2016-09-27 13:49:05 +10:00
Damien George
93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10: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
Paul Sokolovsky
4b3f1d712b esp8266/esp_mphal: Add tentative change to mp_hal_stdin_rx_chr() to wait IRQ.
Instead of busy-looping waiting for UART input. Not enabled by default,
needs more testing.
2016-09-19 00:23:38 +03:00
Paul Sokolovsky
3fe047f08f esp8266/ets_alt_task: ets_post: Should return 0 on success, !0 - failure. 2016-09-18 23:01:58 +03:00
Paul Sokolovsky
f28efa1971 py: Move frozen modules rules from esp8266 port for reuse across ports.
A port now just needs to define FROZEN_DIR var and add $(BUILD)/frozen.c
to SRC_C to support frozen modules.
2016-09-17 21:00:40 +03:00
Paul Sokolovsky
8ae885a0c6 esp8266/Makefile: Rename SCRIPTDIR to FROZEN_DIR for consistency.
With FROZEN_MPY_DIR.
2016-09-17 21:00:04 +03:00
Damien George
f3b5480be7 stmhal,cc3200,esp8266: Consistently use PWRON_RESET constant.
machine.POWER_ON is renamed to machine.PWRON_RESET to match other
reset-cause constants that all end in _RESET.  The cc3200 port keeps a
legacy definition of POWER_ON for backwards compatibility.
2016-09-08 12:50:38 +10:00
Paul Sokolovsky
742d8bdbe4 esp8266/modmachine: Map PWR_ON_RESET to vendor's REASON_DEFAULT_RST.
When dealing with a board which controls chip reset with UART's DTR/RTS,
we never see REASON_DEFAULT_RST (0), only REASON_EXT_SYS_RST (6). However,
trying a "raw" module with with just TXD/RXD UART connection, on power up
it has REASON_DEFAULT_RST as a reset reason.
2016-09-07 00:59:02 +03:00
Damien George
b4be5a8f34 esp8266/modnetwork: Fix wlan.scan() method so it returns all networks.
According to the Arduino ESP8266 implementation the first argument to the
wifi scan callback is actually a bss_info pointer.  This patch fixes the
iteration over this data so the first 2 entries are no longer skipped.

Fixes issue #2372.
2016-09-06 15:30:39 +10:00
Torsten Wagner
69768c97c0 esp8266/espneopixel: Disable IRQs during eps.neopixel_write.
Interrupts during neopixel_write causes timing problems and therefore
wrong light patterns.  Switching off IRQs should help to keep the strict
timing schedule.
2016-09-06 11:51:35 +10:00
Damien George
9526e24234 unix,stmhal,esp8266: When find'ing frozen files follow symbolic links.
It's useful to be able to use symbolic links to add files and directories
to the set of scripts to be frozen.
2016-09-05 12:35:05 +10:00
Delio Brignoli
e2ac8bb3f1 py: Add MICROPY_USE_INTERNAL_PRINTF option, defaults to enabled.
This new config option allows to control whether MicroPython uses its own
internal printf or not (if not, an external one should be linked in).
Accompanying this new option is the inclusion of lib/utils/printf.c in the
core list of source files, so that ports no longer need to include it
themselves.
2016-09-05 12:18:53 +10:00
Paul Sokolovsky
dba40afa70 esp8266/modmachine: Simplify SPI class implementation multiplexing.
modpybhspi now does the needed multiplexing, calling out to modpybspi
(bitbanging SPI) for suitable peripheral ID's. modmachinespi (previous
multiplexer class) thus not needed and removed.

modpybhspi also updated to following standard SPI peripheral naming:
SPI0 is used for FlashROM and thus not supported so far. SPI1 is available
for users, and thus needs to be instantiated as:

spi = machine.SPI(1, ...)
2016-09-04 20:33:11 +03:00
Paul Sokolovsky
7ddd1a58f6 esp8266/modmachine: Don't expose internal SoftSPI and HSPI classes.
There functionality is available via standard SPI class.
2016-09-04 19:57:16 +03:00
Paul Sokolovsky
1708fe3cc7 esp8266/modmachine: Add WDT_RESET and SOFT_RESET constants.
Both tested to work. (WDT_RESET can be seen by issuing machine.disable_irq()
and waiting for WDT reset, SOFT_RESET - by machine.reset()).
2016-09-04 19:45:58 +03:00
Paul Sokolovsky
015774a04f esp8266/modmachinewdt: Add .deinit() method. 2016-09-03 20:45:11 +03:00
Paul Sokolovsky
4a33677c97 esp8266/esp8266.ld: Move modmachinewdt to FlashROM. 2016-09-03 20:44:24 +03:00
Damien George
3be8b688c0 esp8266/modpybhspi: Simplify HSPI driver by using 1 function for xfers. 2016-09-01 16:40:12 +10:00
Damien George
5863e15a23 esp8266/modpybspi: Use generic SPI helper methods to implement SPI. 2016-09-01 16:39:42 +10:00
Damien George
9c04ef2a67 unix,stmhal,esp8266: When find'ing frozen files don't use extra slash.
This extra forward slash for the starting-point directory is unnecessary
and leads to additional slashes on Max OS X which mean that the frozen
files cannot be imported.

Fixes #2374.
2016-08-31 15:12:57 +10:00
Damien George
59a9509703 esp8266/modules/ds18x20.py: Add support for DS18S20 devices. 2016-08-29 12:45:07 +10:00
Damien George
8e9b98e974 esp8266/modules/onewire: Change onewire.read() to onewire.readinto().
This allows 1-wire drivers (eg DS18X20) to perform in-place operations and
hence do less memory allocations.
2016-08-29 12:27:21 +10:00
Damien George
9fba618356 esp8266/modules: Split onewire.py into OneWire and DS18X20 driver.
The OneWire class is now in its own onewire.py module, and the temperature
sensor class is in its own ds18x20.py module.  The latter is renamed to
DS18X20 to reflect the fact that it will support both the "S" and "B"
variants of the device.

These files are moved to the modules/ subdirectory to take advantage of
frozen bytecode.
2016-08-29 12:12:49 +10:00
Paul Sokolovsky
263aaa7030 esp8266/modmachinewdt: Implement machine.WDT class. 2016-08-28 14:48:49 +03:00
Radomir Dopieralski
d29ca28288 esp8266/modous: Add os.umount method to unmount a filesystem.
This is an object-oriented approach, where uos is only a proxy for the
methods on the vfs object.  Some internals had to be exposed (the STATIC
keyword removed) for this to work.

Fixes #2338.
2016-08-26 12:45:21 +10:00
Radomir Dopieralski
891479e62a esp8266/hspi: Enable duplex operation of hardware SPI
Without this, spi.read(1, 0xff) would use 16 clock cycles,
first to send 0xff and then to receive one byte, as visible
with a logic analyzer.
2016-08-25 21:24:22 +03:00
Damien George
d09b6b9aa1 esp8266/modpybrtc: Use 64-bit arithmetic when computing alarm expiry. 2016-08-25 14:10:25 +10:00
Paul Sokolovsky
f2a21a2489 esp8266/esp_mphal: No longer disable watchdog on startup.
Disabling it was an omission from early development stages.
2016-08-20 16:33:04 +03:00
Radomir Dopieralski
d076fae219 esp8266/modmachinespi: Add a factory method for SoftSPI/HSPI 2016-08-19 21:19:59 +03:00
Radomir Dopieralski
8e7dfea803 esp8266/modpybhspi: Add a HSPI module for hardware SPI support
This module uses ESP8266's SPI hardware, which allows much higher
speeds. It uses a library from
https://github.com/MetalPhreak/ESP8266_SPI_Driver
2016-08-19 21:19:59 +03:00