Commit Graph

186 Commits

Author SHA1 Message Date
Paul Sokolovsky
e8e116e7fc esp8266/moduos: Factor out VFS method proxy helper. 2016-03-28 12:44:36 +03:00
Paul Sokolovsky
8b08a0d9ed esp8266/moduos: Add listdir() proxy for MP_STATE_PORT(fs_user_mount)[0].
I.e. os.listdir(...) will redirect to
MP_STATE_PORT(fs_user_mount)[0].listdir(...).
2016-03-28 12:29:47 +03:00
Damien George
61230e007d esp8266/moduos: Use mp_rom_map_elem_t for static const dictionary. 2016-03-28 12:08:36 +03:00
Paul Sokolovsky
b01a373adb esp8266: deploy: Use --flash_size=8m option to esptool.py.
Most esp8266 modules have at least 1MB (8Mbit) of flash. If not set, vendor
functions allow to access only first 512K.
2016-03-28 11:28:16 +03:00
Paul Sokolovsky
cd6194aefc esp8266/esp8266.ld: Put FatFs to FlashROM. 2016-03-27 17:15:25 +03:00
Paul Sokolovsky
374654f2b8 esp8266: Enable FatFs support. 2016-03-27 17:13:47 +03:00
Paul Sokolovsky
fe9bc0c573 esp8266/README: Update for the current status of the port. 2016-03-27 16:10:58 +03:00
Paul Sokolovsky
bbc65d4eda esp8266/modesp: flash_read(): Accept buffer to read to as a second argument. 2016-03-27 15:34:35 +03:00
Paul Sokolovsky
fd86bf5917 esp8266/modesp: flash_write(): Writes in multiples of 4 bytes. 2016-03-27 15:32:58 +03:00
Paul Sokolovsky
53302f1616 esp8266: Set up UART handling task soon into init process.
Otherwise, events may be posted to non-initialized task, which leads to
segfaults.
2016-03-27 14:33:17 +03:00
Paul Sokolovsky
935e021250 esp8266: Put modpybi2c.o to FlashROM. 2016-03-26 10:59:25 +02:00
Damien George
c33a76059f esp8266/tests: Add neopixel.py test. 2016-03-26 10:55:29 +02:00
Damien George
3962766be0 esp8266: Add esp.neopixel_write function to bit-bang WS2812 data. 2016-03-26 10:55:21 +02:00
Damien George
b62beadae0 esp8266: Link ADC class into machine module. 2016-03-26 00:41:37 +02:00
Paul Sokolovsky
f71c0699a5 esp8266: Put utils.o to FlashROM. 2016-03-26 00:39:51 +02:00
Paul Sokolovsky
9c7e3353e5 esp8266: Put lexerstr32.o into FlashROM. 2016-03-26 00:39:02 +02:00
Paul Sokolovsky
ba640bde55 esp8266/esppwm.c: Fix IRQ handler prototype. 2016-03-26 00:34:28 +02:00
Damien George
632d8efa05 esp8266: Add PWM support.
PWM implementation uses a timer and interrupts (FRC1), taken from
Espressif's/NodeMCU's implementation and adapted for our use.

8 channels are supported, on pins 0, 2, 4, 5, 12, 13, 14, 15.

Usage:

    import machine
    pwm0 = machine.PWM(machine.Pin(0))
    pwm0.freq(1000)
    pwm0.duty(500)

Frequency is shared (ie the same) for all channels.  Frequency is
between 1 and 1000.  Duty is between 0 and 1023.
2016-03-26 00:32:37 +02:00
Damien George
82b95f625e esp8266: Implement software SPI class.
Supports speeds up to 500k baud, polarity=0/1, phase=0/1, and using any
pins.  Only supports MSB output at the moment.
2016-03-25 23:28:13 +02:00
Paul Sokolovsky
ac671546d1 esp8266/README: Remove outdated reference to initial port heap size. 2016-03-25 15:02:23 +02:00
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