Commit Graph

10674 Commits

Author SHA1 Message Date
Damien George 6b4b6d388b py/obj.h: Fix math.e constant for nan-boxing builds.
Due to a typo, math.e was too small by around 6e-11.
2018-05-01 23:25:18 +10:00
Damien George 68f4cba3d2 stm32/boards: Update pins.csv to include USB pins where needed. 2018-05-01 17:38:51 +10:00
Damien George b0ad46cd11 stm32/dac: Use mp_hal_pin_config() instead of HAL_GPIO_Init(). 2018-05-01 17:33:08 +10:00
Damien George 04ead56614 stm32/usbd_conf: Use mp_hal_pin_config() instead of HAL_GPIO_Init.
To reduce dependency on the ST HAL for pin operations.
2018-05-01 17:32:19 +10:00
Damien George a28bd4ac94 stm32/mphalport: Add mp_hal_pin_config_speed() to select GPIO speed.
It should be used after mp_hal_pin_config() or mp_hal_pin_config_alt().
2018-05-01 17:31:23 +10:00
Damien George 777e042ab5 esp32/modnetwork: Allow to get ESSID of AP that STA is connected to.
Following the same addition to esp8266 port.
2018-05-01 16:37:08 +10:00
Lars Kellogg-Stedman d8fdb77ac9 esp8266/modnetwork: Allow to get ESSID of AP that STA is connected to.
This patch enables iface.config('essid') to work for both AP and STA
interfaces.
2018-05-01 16:37:02 +10:00
Andreas Valder 298c072433 esp32: Add support for the esp32's ULP.
The ULP is available as esp32.ULP().  See README.ulp.md for basic usage.
2018-05-01 16:19:37 +10:00
Ayke van Laethem d43c737756 py/stream: Use uPy errno instead of system's for non-blocking check.
This is a more consistent use of errno codes.  For example, it may be that
a stream returns MP_EAGAIN but the mp_is_nonblocking_error() macro doesn't
catch this value because it checks for EAGAIN instead (which may have a
different value than MP_EAGAIN when MICROPY_USE_INTERNAL_ERRNO is enabled).
2018-05-01 15:54:50 +10:00
Damien George 96740be357 py/mperrno: Define MP_EWOULDBLOCK as EWOULDBLOCK, not EAGAIN.
Most modern systems have EWOULDBLOCK aliased to EAGAIN, ie they have the
same value.  But some systems use different values for these errnos and if
a uPy port is using the system errno values (ie not the internal uPy
values) then it's important to be able to distinguish EWOULDBLOCK from
EAGAIN.  Eg if a system call returned EWOULDBLOCK it must be possible to
check for this return value, and this patch makes this now possible.
2018-05-01 15:53:25 +10:00
Mike Wadsten 9f1eafc380 tests/io/bytesio_ext2: Remove dependency on specific EINVAL value
If MICROPY_USE_INTERNAL_ERRNO is disabled, MP_EINVAL is not guaranteed
to have the value 22, so we cannot depend on OSError(22,).
Instead, to support any given port's errno values, without relying
on uerrno, we just check that the args[0] is positive.
2018-05-01 15:48:43 +10:00
iabdalkader 28c9824c51 stm32/boards/NUCLEO_H743ZI: Enable ADC peripheral. 2018-05-01 15:39:03 +10:00
iabdalkader 8c12f1d916 stm32/adc: Add support for H7 MCU series.
ADC3 is used because the H7's internal ADC channels are connected to ADC3
and the uPy driver doesn't support more than one ADC.

Only 12-bit resolution is supported because 12 is hard-coded and 14/16 bits
are not recommended on some ADC3 pins (see errata).

Values from internal ADC channels are known to give wrong values at
present.
2018-05-01 15:36:11 +10:00
Damien George 23e9c3bca7 esp32/modules: Add support scripts for WebREPL.
WebREPL now works on the esp32 in the same way it does on esp8266.
2018-04-27 23:58:51 +10:00
Damien George c1d4352e65 esp32/mpconfigport: Enable webrepl module and socket events. 2018-04-27 23:57:57 +10:00
Damien George 999c8b9711 esp32/modsocket: Add support for registering socket event callbacks.
The esp8266 uses modlwip.c for its usocket implementation, which allows to
easily support callbacks on socket events (like when a socket becomes ready
for reading).  This is not as easy to do for the esp32 which uses the
ESP-IDF-provided lwIP POSIX socket API.  Socket events are needed to get
WebREPL working, and this patch provides a way for such events to work by
explicitly polling registered sockets for readability, and then calling the
associated callback if the socket is readable.
2018-04-27 23:57:26 +10:00
Damien George 98b05e3614 esp32: Add support for and enable uos.dupterm(). 2018-04-27 23:51:45 +10:00
Damien George 04dc4a5034 esp32/mphalport: Improve mp_hal_stdout_tx_XXX functions.
This makes way for enabling uos.dupterm().
2018-04-27 23:49:21 +10:00
Damien George c0dd9be606 stm32/boards/NUCLEO_H743ZI: Use priority 0 for SysTick IRQ.
This follows how all other boards are configured.
2018-04-27 15:16:45 +10:00
Ayke van Laethem deaa46aa66 py/nlrthumb: Fix Clang support wrt use of "return 0".
Clang defines __GNUC__ so we have to check for it specifically.
2018-04-27 15:10:42 +10:00
Damien George 527ba0426c stm32/system_stm32: Reconfigure SysTick IRQ priority for L4 MCUs.
After calling HAL_SYSTICK_Config the SysTick IRQ priority is set to 15, the
lowest priority.  This commit reconfigures the IRQ priority to the desired
TICK_INT_PRIORITY value.
2018-04-27 12:54:35 +10:00
Damien George 4ed5865280 esp32/mphalport: Improve mp_hal_delay_us so it handles pending events.
Thanks to @bboser for the initial idea and implementation.
2018-04-26 20:21:33 +10:00
Damien George e1fe3abd09 esp32/mphalport: Use esp_timer_get_time instead of gettimeofday.
It's more efficient and improves accuracy.
2018-04-26 20:19:31 +10:00
Damien George c7818032b1 docs/library: Add ussl module to library index for unix port. 2018-04-26 17:14:51 +10:00
Damien George 9254f365d6 stm32/machine_i2c: Provide hardware I2C for machine.I2C on F7 MCUs. 2018-04-24 23:48:04 +10:00
Damien George 19778d0a3c stm32/i2c: Add low-level I2C driver for F7 MCUs. 2018-04-24 23:48:04 +10:00
Damien George 0c54d0c288 stm32: Rename legacy pyb.I2C helper functions to start with pyb_i2c_. 2018-04-24 17:32:16 +10:00
Damien George b73adcc3d9 stm32: Rename i2c.c to pyb_i2c.c.
i2c.c implements the legacy pyb.I2C class so rename the file to make this
explicit, and also to make room for an improved I2C driver.
2018-04-24 16:23:36 +10:00
Damien George 8b91260169 stm32/dac: Support MCUs that don't have TIM4/5 and use new HAL macro. 2018-04-24 12:07:59 +10:00
Damien George 8a949ba599 stm32: Introduce MICROPY_PY_STM config to include or not the stm module.
By default the stm module is included in the build, but a board can now
define MICROPY_PY_STM to 0 to not include this module.  This reduces the
firmware by about 7k.
2018-04-24 12:01:49 +10:00
Damien George a60efa8202 stm32/uart: Allow ctrl-C to work with UARTs put on REPL via os.dupterm. 2018-04-23 20:44:30 +10:00
Damien George 513e537215 stm32/uart: Allow ctrl-C to issue keyboard intr when REPL is over UART. 2018-04-23 17:06:40 +10:00
iabdalkader d870a4e835 stm32/boards/NUCLEO_H743ZI: Enable RNG for this board. 2018-04-23 16:43:16 +10:00
iabdalkader 70a6a15f8c stm32/rng: Set RNG clock source for STM32H7. 2018-04-23 16:43:05 +10:00
Damien George bdff68db9c extmod/modlwip: Check if getaddrinfo() constraints are supported or not.
In particular don't issue a warning if the passed-in constraints are
actually supported because they are the default values.
2018-04-23 16:38:20 +10:00
Damien George f7be5f9bfa tools/upip: Upgrade upip to 1.2.4.
Uses new pypi.org URL, and now creates a socket with the address parameters
returned by getaddrinfo().
2018-04-23 16:11:27 +10:00
Shanee Vanstone b5ee3b2f21 esp32/README.md: Fix typo readme. 2018-04-20 16:23:55 +10:00
Peter D. Gray 9adfd14644 stm32/sdcard: Implement BP_IOCTL_SEC_COUNT to get size of SD card. 2018-04-20 16:09:03 +10:00
Damien George c24b0a7f2b docs/library/pyb.ADC: Fix typo of "prarmeter". 2018-04-20 15:54:09 +10:00
Peter Hinch 0600645944 docs/library/pyb.ADC: Remove outdated ADCAll code example. 2018-04-20 15:52:28 +10:00
Damien George d12483d936 tests/pyb: Add test for pyb.ADCAll class. 2018-04-11 17:12:13 +10:00
Damien George 3d5d76fb73 stm32/main: Allow a board to configure the label of the flash FS.
To change the default label a board should define:

    #define MICROPY_HW_FLASH_FS_LABEL "label"
2018-04-11 16:52:22 +10:00
Damien George cf9fc7346d stm32: Allow a board to configure the HSE in bypass mode.
To use HSE bypass mode the board should define:

    #define MICROPY_HW_CLK_USE_BYPASS (1)

If this is not defined, or is defined to 0, then HSE oscillator mode is
used.
2018-04-11 16:46:47 +10:00
Damien George 68b70fac5c stm32/stm32_it: Add IRQ handler for I2C4. 2018-04-11 16:37:45 +10:00
Damien George a7ebac2eae stm32/can: Allow CAN pins to be configured per board.
This patch allows a given board to configure which pins are used for the
CAN peripherals, in a similar way to all the other bus peripherals (I2C,
UART, SPI).  To enable CAN on a board the mpconfigboard.h file should
define (for example):

    #define MICROPY_HW_CAN1_TX (pin_B9)
    #define MICROPY_HW_CAN1_RX (pin_B8)
    #define MICROPY_HW_CAN2_TX (pin_B13)
    #define MICROPY_HW_CAN2_RX (pin_B12)

And the board config file should no longer define MICROPY_HW_ENABLE_CAN.
2018-04-11 16:35:24 +10:00
Damien George 0041396f05 stm32/pin: In pin AF object, remove union of periph ptr types.
The individual union members (like SPI, I2C) are never used, only the
generic "reg" entry is.  And the union names can clash with macro
definitions in the HAL so better to remove them.
2018-04-11 16:14:58 +10:00
Damien George f1073e747d stm32/adc: Factor common ADC init code into adcx_init_periph().
The only configuration that changes with this patch is that on L4 MCUs the
clock prescaler changed from ADC_CLOCK_ASYNC_DIV2 to ADC_CLOCK_ASYNC_DIV1
for the ADCAll object.  This should be ok.
2018-04-11 14:46:13 +10:00
Damien George 1d6c155d6a stm32/adc: Fix config of EOC selection and Ext-Trig for ADC periph.
A value of DISABLE for EOCSelection is invalid.  This would have been
interpreted instead as ADC_EOC_SEQ_CONV, but really it should be
ADC_EOC_SINGLE_CONV for the uses in this code.  So this has been fixed.

ExternalTrigConv should be ADC_SOFTWARE_START because all ADC
conversions are started by software.  This is now fixed.
2018-04-11 14:29:37 +10:00
Damien George 06807c1bde stm32/adc: Factor code to optimise adc_read_channel and adc_read.
Saves 200 bytes of code space.
2018-04-11 14:28:06 +10:00
Damien George b30e0d2f26 stm32/dac: Add buffering argument to constructor and init() method.
This can be used to select the output buffer behaviour of the DAC.  The
default values are chosen to retain backwards compatibility with existing
behaviour.

Thanks to @peterhinch for the initial idea to add this feature.
2018-04-11 14:22:21 +10:00