Commit Graph

12424 Commits

Author SHA1 Message Date
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
Damien George aebd9701a7 stm32/adc: Optimise read_timed_multi() by caching buffer pointers. 2018-04-11 14:09:09 +10:00
Peter Hinch 4f40fa5cf4 stm32/adc: Add read_timed_multi() static method, with docs and tests. 2018-04-11 13:36:17 +10:00
Damien George 0096a4bd00 tests/pyb/adc.py: Fix test so that it really does test ADC values.
Reading into a bytearray will truncate values to 0xff so the assertions
checking read_timed() would previously always succeed.

Thanks to @peterhinch for finding this problem and providing the solution.
2018-04-11 13:21:57 +10:00
Damien George de9528d12c stm32/adc: Fix verification of ADC channel 16 for F411 MCUs. 2018-04-11 13:16:54 +10:00
Scott Shawcroft f02cbeabab
Merge pull request #747 from dhalbert/reformat
add storage.erase_filesystem() to erase and reformat CIRCUITPY
2018-04-10 10:26:07 -07:00
Dan Halbert eaa9923a8f force_create rename got lost due to editing error 2018-04-10 12:24:27 -04:00
Dan Halbert 1b12c42477 Merge remote-tracking branch 'adafruit/master' into reformat 2018-04-10 12:17:00 -04:00
Dan Halbert 80fb61ea44 remove more unneeded includes 2018-04-10 12:16:46 -04:00
Dan Halbert 04b2c8be5a remove unnecessary includes in esp8266 common-hal storage code 2018-04-10 12:13:21 -04:00
Dan Halbert 5f98953ed8 esp8266 and nrf: raise NotImplementedError 2018-04-10 12:08:41 -04:00
Peter D. Gray 59dda71038 stm32/main: Guard usb_mode lines in default boot.py by relevant #if. 2018-04-10 23:52:51 +10:00
Damien George 4ff05ae4e9 esp32/machine_uart: Remove UART event queue object.
This event queue has UART events posted to it and they need to be drained
for it to operate without error.  The queue is not used by the uPy UART
class so it should be removed to prevent the IDF emitting errors.

Fixes #3704.
2018-04-10 15:24:10 +10:00
Damien George ef12a4bd05 py: Refactor how native emitter code is compiled with a file per arch.
Instead of emitnative.c having configuration code for each supported
architecture, and then compiling this file multiple times with different
macros defined, this patch adds a file per architecture with the necessary
code to configure the native emitter.  These files then #include the
emitnative.c file.

This simplifies emitnative.c (which is already very large), and simplifies
the build system because emitnative.c no longer needs special handling for
compilation and qstr extraction.
2018-04-10 15:06:47 +10:00
Damien George 5ad27d4b8b tests: Move recursive tests to the tests/stress/ subdir.
Keeping all the stress related tests in one place makes it easier to
stress-test a given port, and to also not run such tests on ports that
can't handle them.
2018-04-10 14:43:52 +10:00
Damien George 605fdcf754 tests/stress/recursive_gen: Add test for recursive gen with iter. 2018-04-10 14:39:51 +10:00
Damien George 22f1414abb stm32/i2c: Fully support peripheral I2C4. 2018-04-10 14:33:18 +10:00
Damien George 69bf23c9cf stm32/i2c: Update HAL macros to use new __HAL_RCC prefix. 2018-04-10 14:28:39 +10:00
iabdalkader e1e49adb86 stm32/boards/NUCLEO_H743ZI: Enable DAC peripheral. 2018-04-10 14:21:26 +10:00
iabdalkader 90bb98e83d stm32/dac: Add support for H7 MCUs.
Includes a fix for H7 DAC DMA requests.
2018-04-10 14:21:26 +10:00
Jeff Epler cbf981f330 py/objgenerator: Check stack before resuming a generator.
This turns a hard crash in a recursive generator into a 'maximum recursion
depth exceeded' exception.
2018-04-10 14:06:26 +10:00
armink 6a693db71d extmod/re1.5: Fix compilecode.c compile problem on IAR tool chain.
The 2nd and 3rd args of the ternary operator are treated like they are in
the same expression and must have similar types.  void is not compatible
with int so that's why the compiler is complaining.
2018-04-10 13:54:22 +10:00
Damien George cf31d384f1 py/stream: Switch stream close operation from method to ioctl.
This patch moves the implementation of stream closure from a dedicated
method to the ioctl of the stream protocol, for each type that implements
closing.  The benefits of this are:

1. Rounds out the stream ioctl function, which already includes flush,
   seek and poll (among other things).

2. Makes calling mp_stream_close() on an object slightly more efficient
   because it now no longer needs to lookup the close method and call it,
   rather it just delegates straight to the ioctl function (if it exists).

3. Reduces code size and allows future types that implement the stream
   protocol to be smaller because they don't need a dedicated close method.

Code size reduction is around 200 bytes smaller for x86 archs and around
30 bytes smaller for the bare-metal archs.
2018-04-10 13:41:32 +10:00
T S 8f11d0b532 docs/library/pyb.ADC.rst: Document new features for ADCAll. 2018-04-10 13:06:26 +10:00
Jeff Epler 1e9a27177c esp8266: Disable "strict aliasing" in compiler like in atmel-samd
This caused a fatal compiler diagnostic after #750.  This compiler
flag is already specified in the atmel-samd builds, so it makes
sense to do it here for the same reasons.
2018-04-09 22:23:39 -04:00
Scott Shawcroft fd70383aa0 Fix rom qstr pool length. 2018-04-09 22:23:39 -04:00
Scott Shawcroft 3b511e503a Prevent a heap pointer from living on the stack longer than we need. 2018-04-09 22:23:39 -04:00
Jeff Epler eb7d0e317a Create genhdr/ directory in time 2018-04-09 22:23:39 -04:00
Dan Halbert a0cd94c184
Merge pull request #752 from jepler/esp8266-strict-aliasing
esp8266: Disable "strict aliasing" in compiler like in atmel-samd
2018-04-09 22:21:21 -04:00
Jeff Epler c5d2a0da04 esp8266: Disable "strict aliasing" in compiler like in atmel-samd
This caused a fatal compiler diagnostic after #750.  This compiler
flag is already specified in the atmel-samd builds, so it makes
sense to do it here for the same reasons.
2018-04-09 21:17:26 -05:00
Dan Halbert 3883a9fb7a
Merge pull request #749 from tannewt/analyze_heap_dump
Fix rom qstr pool length.
2018-04-09 20:35:34 -04:00
Dan Halbert d203d1c1cb
Merge pull request #750 from tannewt/parse_tree_memory
Prevent a heap pointer from living on the stack longer than we need.
2018-04-09 20:34:40 -04:00
Scott Shawcroft 7dd1d6afcc Prevent a heap pointer from living on the stack longer than we need. 2018-04-09 16:02:32 -07:00
Scott Shawcroft 619b0ec164 Fix rom qstr pool length. 2018-04-09 15:59:52 -07:00
Dan Halbert e7b8b13186
Merge pull request #748 from jepler/genhdr-output-directory
Create genhdr/ directory in time
2018-04-09 14:48:21 -04:00
Jeff Epler 88bbe425db Create genhdr/ directory in time 2018-04-09 13:31:44 -05:00
Dan Halbert aa8c262d14 add storage.erase_filesystem() to erase and reformat CIRCUITPY 2018-04-09 12:52:42 -04:00
Scott Shawcroft 4e053cea0d
Merge pull request #628 from sommersoft/super_status
Added Function To Check the Serial Connection From CircuitPython Layer
2018-04-08 22:06:09 -07:00
Scott Shawcroft 93e09e7ee5
Merge pull request #738 from dhalbert/3.0_hid
3.0 hid
2018-04-08 22:02:23 -07:00
Dan Halbert 1e87a785b9 Move CDC Comm back to Interface 0 for compat with Win7 drivers. 2018-04-08 15:59:19 -04:00
Dan Halbert e7305ce15f update usb_descriptor again 2018-04-08 10:15:47 -04:00
Dan Halbert 726d5e52a3 Merge branch 'master' into 3.0_hid 2018-04-08 09:52:29 -04:00
Dan Halbert 32048cdeeb tools/usb_descriptor updates 2018-04-08 09:51:45 -04:00