Commit Graph

398 Commits

Author SHA1 Message Date
Paul Sokolovsky
0e52ee957d zephyr/modzsensor: Zephyr sensor subsystem bindings. 2018-05-21 10:35:16 +10:00
Paul Sokolovsky
080b0be1c8 zephyr/mpconfigport.h: Enable uhashlib and ubinascii modules.
To be able to use data integrity checks in various tests.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
9480c188e8 zephyr/main: After builtin testsuite, drop to REPL.
It makes sense to make even testsuite-enabled builds be suitable for
interactive use.
2018-05-21 10:35:16 +10:00
Paul Sokolovsky
1050045979 zephyr/README: Hint about existence of qemu_x86_nommu. 2018-05-21 10:35:16 +10:00
Tobias Badertscher
769e37b646 stm32/boards: Add config files for new board, STM32L496GDISC. 2018-05-18 22:39:49 +10:00
Tobias Badertscher
4005c63571 stm32/boards: Add board ld and af.csv files for STM32L496 MCU. 2018-05-18 22:39:44 +10:00
Tobias Badertscher
708cdb6276 stm32: Add support for STM32L496 MCU. 2018-05-18 22:37:30 +10:00
Damien George
58331e3c28 esp8266/modmachine: Allow I2C and SPI to be configured out of the build.
I2C costs about 3000 bytes of code, and SPI costs about 4400 bytes.
2018-05-17 23:37:12 +10:00
Damien George
dd13065843 esp8266/modnetwork: Raise ValueError when getting invalid WLAN id.
Instead of crashing due to out-of-bounds array access.  Fixes #3348.
2018-05-17 22:12:24 +10:00
Damien George
f8a5cd24d8 esp8266/modnetwork: Return empty str for hostname if STA is inactive.
Instead of crashing due to NULL pointer dereference.  Fixes issue #3341.
2018-05-17 22:11:22 +10:00
Damien George
94a79f340d esp8266/mpconfigport.h: Add some weak links to common Python modules.
To make it easier/simpler to write code that can run under both CPython and
on an ESP8266 board.
2018-05-17 13:27:18 +10:00
Ryan Shaw
b9ff46f1ed stm32: Enable UART7/8 on F4 series that have these peripherals. 2018-05-16 11:55:07 +10:00
Damien George
cdaace1fdf esp32/modnetwork: Fix STA/AP activate/deactivate for new IDF API.
WIFI_MODE_NULL is no longer supported by the ESP IDF, instead one must use
esp_wifi_start/esp_wifi_stop.
2018-05-15 11:50:37 +10:00
Damien George
e6b66f1092 stm32/usb: Initialise cdc variable to prevent compiler warnings.
Some compilers cannot deduce that cdc will always be written before being
used.
2018-05-15 00:18:03 +10:00
Damien George
47ecbbbecb stm32/usb: Add ability to have 2x VCP interfaces on the one USB device.
This patch adds the configuration MICROPY_HW_USB_ENABLE_CDC2 which enables
a new USB device configuration at runtime: VCP+VCP+MSC.  It will give two
independent VCP interfaces available via pyb.USB_VCP(0) and pyb.USB_VCP(1).
The first one is the usual one and has the REPL on it.  The second one is
available for general use.

This configuration is disabled by default because if the mode is not used
then it takes up about 2200 bytes of RAM.  Also, F4 MCUs can't support this
mode on their USB FS peripheral (eg PYBv1.x) because they don't have enough
endpoints.  The USB HS peripheral of an F4 supports it, as well as both the
USB FS and USB HS peripherals of F7 MCUs.
2018-05-14 23:44:45 +10:00
Damien George
2e565cc0d4 stm32/usb: Change HID report funcs to take HID state, not usbdev state. 2018-05-14 17:04:43 +10:00
Damien George
91bca340ec stm32/usb: Change CDC tx/rx funcs to take CDC state, not usbdev state. 2018-05-14 16:55:04 +10:00
Damien George
68271a27e6 stm32/usb: Make CDC endpoint definitions private to core usbdev driver. 2018-05-14 16:53:45 +10:00
Damien George
ed92d62326 stm32/usb: Combine HID lower-layer and interface state into one struct. 2018-05-14 16:34:31 +10:00
Damien George
bf08a99ccd stm32/usb: Combine CDC lower-layer and interface state into one struct. 2018-05-14 16:15:58 +10:00
Damien George
ed32284b70 stm32/usb: Use usbd_cdc_itf_t pointer directly in USB_VCP class. 2018-05-14 15:24:44 +10:00
Damien George
fb25c81062 stm32/modpyb: Remove unused includes and clean up comments.
The documentation (including the examples) for elapsed_millis and
elapsed_micros can be found in docs/library/pyb.rst so doesn't need to be
written in full in the source code.
2018-05-14 14:01:50 +10:00
Damien George
88c26a48b4 stm32/pyb_i2c: Put pyb.I2C under MICROPY_PY_PYB_LEGACY setting.
When disabled, the pyb.I2C class saves around 8k of code space and 172
bytes of RAM.  The same functionality is now available in machine.I2C
(for F4 and F7 MCUs).

It is still enabled by default.
2018-05-14 13:53:46 +10:00
Damien George
92c5e2708d stm32/modpyb: Introduce MICROPY_PY_PYB_LEGACY config option for pyb mod.
This is enabled by default.  When it is disabled all legacy functions and
classes in the pyb module are excluded from the build.
2018-05-14 13:49:22 +10:00
Damien George
a0f7b4c678 stm32/accel: Switch pyb.Accel to use new C-level I2C API. 2018-05-14 13:23:18 +10:00
Damien George
ce824bb67e stm32/machine_i2c: Use new F4 hardware I2C driver for machine.I2C class.
And remove the old one based on ST code.
2018-05-14 13:22:12 +10:00
Damien George
b21415ed4f stm32/i2c: Add new hardware I2C driver for F4 MCUs.
This driver uses low-level register access to control the I2C peripheral
(ie it doesn't rely on the ST HAL) and provides the same C-level API as the
existing F7 hardware driver.
2018-05-14 13:19:03 +10:00
Peter D. Gray
ca36645410 stm32/usbd_hid_interface: Address possible race condition vs. interrupt.
The USB IRQ may fire once USBD_HID_ClearNAK() is called and then change the
last_read_len value.
2018-05-14 12:08:34 +10:00
Peter D. Gray
1f1623d3b7 stm32/usbdev: Be honest about data not being written to HID endpoint.
USB_HID.send() should now return 0 if it could not send the report to the
host.
2018-05-14 12:01:27 +10:00
Bas Wijnen
67e1a4f8be esp32: Update to latest ESP IDF version.
- Updated supported git hash to current IDF version.
- Added missing targets and includes to Makefile.
- Updated error codes for networking module.
- Added required constant to sdkconfig configuration.
2018-05-14 11:42:46 +10:00
Damien George
aeaace0737 stm32/usbdev: Remove unused RxState variable, and unused struct. 2018-05-11 23:20:59 +10:00
Damien George
abde0fa226 stm32/usbdev: Convert files to unix line endings.
Also remove trailing whitespace and convert tabs to spaces.
2018-05-11 23:03:52 +10:00
Damien George
56a273ebff stm32/usbd_conf: Changes files to unix line endings and apply styling.
This patch is only cosmetic and has no functional change.
2018-05-11 22:17:58 +10:00
Damien George
9f4eda542a stm32/usbd_conf.h: Remove unused macros and clean up header file. 2018-05-11 22:04:56 +10:00
Damien George
b208aa189e stm32/README: Update to reflect current MCU support. 2018-05-11 10:36:46 +10:00
Damien George
c1115d931f stm32/usb: Use correct type for USB HID object. 2018-05-09 16:00:19 +10:00
Damien George
e1bc85416a stm32/usb: Fix broken pyb.have_cdc() so it works again. 2018-05-09 15:59:48 +10:00
Damien George
e638defff4 stm32/i2c: Make sure stop condition is sent after receiving addr nack. 2018-05-09 15:53:09 +10:00
Damien George
aea71dbde0 stm32/Makefile: Use -O2 to optimise compilation of lib/libc/string0.c. 2018-05-04 15:53:51 +10:00
Damien George
cb3456ddfe stm32: Don't use %lu or %lx for formatting, use just %u or %x.
On this 32-bit arch there's no need to use the long version of the format
specifier.  It's only there to appease the compiler which checks the type
of the args passed to printf.  Removing the "l" saves a bit of code space.
2018-05-04 15:52:03 +10:00
Damien George
b614dc73b0 stm32/dma: Fix duplicate typedef of struct, it's typedef'd in dma.h. 2018-05-04 15:35:43 +10:00
Damien George
12a3fccc7e esp32/modsocket: Check for pending events during blocking socket calls. 2018-05-03 00:09:25 +10:00
Damien George
4fa7d36cee esp32: Use mp_rom_map_elem_t and MP_ROM_xxx macros for const dicts. 2018-05-02 22:33:41 +10:00
Damien George
6681eb809a esp32/modsocket: Correctly handle reading from a peer-closed socket.
If a socket is cleanly shut down by the peer then reads on this socket
should continue to return zero bytes.  The lwIP socket API does not have
this behaviour (it only returns zero once, then blocks on subsequent calls)
so this patch adds explicit checks and logic for peer closed sockets.
2018-05-02 22:31:00 +10:00
Torwag
fb7dabb971 esp32/README: Add --init to submodule update command.
Add --init to the submodule update example, thus, all submodules get
initialised including the nested (--recursive) ones.  Without it there
might not be a submodule init.
2018-05-02 17:24:17 +10:00
Damien George
6410e174c5 esp8266: Disable DEBUG_PRINTERS for 512k build.
Disabling this saves around 6000 bytes of code space and gets the 512k
build fitting in the available flash again (it increased lately due to an
increase in the size of the ESP8266 SDK).
2018-05-02 15:51:19 +10:00
Damien George
051686b0a8 stm32/main: Clean up and optimise initial start-up code of the MCU. 2018-05-02 15:20:24 +10:00
Damien George
a03e6c1e05 stm32/irq: Define IRQ priorities directly as encoded hardware values.
For a given IRQn (eg UART) there's no need to carry around both a PRI and
SUBPRI value (eg IRQ_PRI_UART, IRQ_SUBPRI_UART).  Instead, the IRQ_PRI_UART
value has been changed in this patch to be the encoded hardware value,
using NVIC_EncodePriority.  This way the NVIC_SetPriority function can be
used directly, instead of going through HAL_NVIC_SetPriority which must do
extra processing to encode the PRI+SUBPRI.

For a priority grouping of 4 (4 bits for preempt priority, 0 bits for the
sub-priority), which is used in the stm32 port, the IRQ_PRI_xxx constants
remain unchanged in their value.

This patch also "fixes" the use of raise_irq_pri() which should be passed
the encoded value (but as mentioned above the unencoded value is the same
as the encoded value for priority grouping 4, so there was no bug from this
error).
2018-05-02 14:41:02 +10:00
Peter D. Gray
266446624f stm32/dma: Always deinit/reinit DMA channels on L4 MCUs.
The problem is the existing code which tries to optimise the
reinitialisation of the DMA breaks the abstraction of the HAL.  For the
STM32L4 the HAL's DMA setup code maintains two private vars (ChannelIndex,
DmaBaseAddress) and updates a hardware register (CCR).

In HAL_DMA_Init(), the CCR is updated to set the direction of the DMA.
This is a problem because, when using the SD Card interface, the same DMA
channel is used in both directions, so the direction bit in the CCR must
follow that.

A quick and effective fix for the L4 is to simply call HAL_DMA_DeInit() and
HAL_DMA_Init() every time.
2018-05-02 13:41:23 +10:00
Damien George
4c0f664b1a stm32/flash: Remove unused src parameter from flash_erase(). 2018-05-02 13:11:56 +10:00