Commit Graph

12081 Commits

Author SHA1 Message Date
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
Damien George
edb600b6a2 stm32/mphalport: Optimise the way that GPIO clocks are enabled. 2018-05-02 13:08:58 +10:00
Damien George
00a659f3ee stm32/dac: Implement printing of a DAC object. 2018-05-02 12:17:45 +10:00
Damien George
dcfd2de5c2 stm32/dac: Make deinit disable the output buffer on H7 and L4 MCUs. 2018-05-02 12:17:45 +10:00
Damien George
d4f8414ebd stm32/adc: Use mp_hal_pin_config() instead of HAL_GPIO_Init().
This makes ADCAll work correctly on L4 MCUs.
2018-05-02 12:17:45 +10:00
Damien George
3022947343 stm32/mphalport: Support ADC mode on a pin for L4 MCUs. 2018-05-02 12:17:45 +10:00
Dan Halbert
e565282da9 fix minor comment typos 2018-05-01 22:04:11 -04:00
Dan Halbert
3a2b4af830 Implement microcontroller.cpu.temperature on '21 and '51. 2018-05-01 21:35:55 -04:00
Noralf Trønnes
681399f8db atmel-samd: RTC: Improve precision when setting datetime
The prescaler is not reset when setting the counter so we can be off by
as much as 1023/1024 seconds. Fix this by resetting the RTC module.
2018-05-01 21:35:24 -04:00
Jeff Epler
c2f0c57a26 ubinascii: masquerade as binascii for python3 compatibility 2018-05-01 17:10:53 -05:00
Scott Shawcroft
cfea51ec68 Re-enable PDMIn without ASF and using the helpers added with
I2SOut.

The API is almost the same except the frequency attribute has been
renamed to sample_rate so that its less likely to be confused with
frequencies within the audio itself.

Fixes #263.
2018-05-01 14:35:43 -07:00
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
Jeff Epler
0f869bbbf1 ubinascii: some functions should refuse unicode for python3 compatibility
.. this maybe should be subject to MICROPY_CPYTHON_COMPAT, except that
is not defined in the main circuitpython ports so it would be a change
that makes no difference.
2018-04-30 20:06:29 -05:00
Jeff Epler
e7f463320f tests: Add new tests for ubinascii differences
.. some of these tests currently fail, but a subsequent commit will
fix them.
2018-04-30 20:06:29 -05:00
Scott Shawcroft
dd0f8689a1
Merge pull request #786 from notro/rtc_set_datetime_precision
atmel-samd: RTC: Improve precision when setting datetime
2018-04-29 20:30:37 -07:00
Scott Shawcroft
6855541e33
Merge pull request #780 from sommersoft/esp8266_gpio16
Fix GPIO16 Board Reset; Updated Usage
2018-04-29 20:09:52 -07:00
Noralf Trønnes
62d7a800d7 atmel-samd: RTC: Improve precision when setting datetime
The prescaler is not reset when setting the counter so we can be off by
as much as 1023/1024 seconds. Fix this by resetting the RTC module.
2018-04-29 20:43:07 +02:00
sommersoft
396e4ffc34 implemented 'claim_pin' methodology; updated 'open_drain' handling 2018-04-28 17:27:23 +00: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
sommersoft
4e1f7d43eb added exception for PULL_UP; corrected open_drain handling 2018-04-27 02:51:07 +00: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
sommersoft
441ce2a78f reset GPIO16 to input on deinit 2018-04-26 01:35:58 +00:00
Scott Shawcroft
83e390714f
Merge pull request #779 from tannewt/replace_logos
Replace MicroPython logos with CircuitPython logos
2018-04-25 18:04:00 -07:00
Scott Shawcroft
3d6a6b81a0 Replace MicroPython logos with CircuitPython logos
Fixes #306
2018-04-25 15:41:18 -07:00
sommersoft
bd5a5daaae updated GPIO16 construct and handling 2018-04-25 03:59:36 +00:00
sommersoft
e70ece4c41 now checks for proper pin in is_pin_free; initialize GPIO16 as input in reset_pins 2018-04-25 03:57:09 +00:00
Dan Halbert
8cadcc8e83
Merge pull request #776 from dhalbert/hid_gamepad
HID gamepad support
2018-04-24 14:27:04 -04:00
Dan Halbert
48f595ee13 convert wrapper class to just a module 2018-04-24 13:28:26 -04:00