Commit Graph

6961 Commits

Author SHA1 Message Date
Damien George a4f96c8c2a tests/basics: Add tests for if-expressions. 2016-11-26 16:15:31 +11:00
Damien George a31a3a9fd5 tests/basics: Add test for dict.fromkeys where arg is a generator.
Improves coverage because it tests the case where the arg does not have a
__len__ slot.
2016-11-26 15:38:48 +11:00
Damien George f8b71aabb4 stmhal/machine_i2c: Provide HW implementation of I2C peripherals for F4.
With this patch machine.I2C() uses HW I2C peripheral blocks on F4 MCUs.
Software I2C is used for other MCUs.
2016-11-25 16:31:43 +11:00
Damien George 49dcc253e3 stmhal/i2c: Expose the pyb_i2c_obj_t struct and some relevant functions.
So they can be used by other parts of the code.
2016-11-25 16:30:51 +11:00
Damien George 652ca2017d stmhal/i2c: Add support for I2C4 hardware block on F7 MCUs. 2016-11-25 11:21:18 +11:00
Damien George 3053748987 stmhal: Add beginnings of port-specific machine.I2C implementation.
This allows one to construct an I2C object using ids that are specific
to the stmhal port, eg machine.I2C('X').  Right now the implementation
of I2C uses software I2C but the idea is to just change the C-level I2C
protocol functions to hardware implementations later on.
2016-11-24 00:20:51 +11:00
Damien George 5d2279bec1 extmod/machine_i2c: Add hook to constructor to call port-specific code.
If MICROPY_PY_MACHINE_I2C_MAKE_NEW is defined then it is called when an
I2C object is constructed with an id which is not -1.
2016-11-24 00:12:51 +11:00
Damien George 8b74048d2a extmod/machine_i2c: Expose soft I2C obj and readfrom/writeto funcs.
For external use by ports if needed.
2016-11-24 00:11:45 +11:00
Damien George 4c905616f0 extmod/machine_i2c: Remove trivial function wrappers. 2016-11-23 17:05:38 +11:00
Damien George 37333cb00a extmod/machine_i2c: Add 'stop' argument to i2c readfrom/writeto meths. 2016-11-23 17:05:38 +11:00
Damien George 0bc99b4836 extmod/machine_i2c: Make i2c.write[to] methods return num of ACKs recvd. 2016-11-23 17:05:38 +11:00
Damien George 07e83573c8 extmod/machine_i2c: Add 'nack' argument to i2c.readinto. 2016-11-23 17:05:38 +11:00
Damien George ced240e72a extmod/machine_i2c: Make C-level functions return -errno on I2C error. 2016-11-23 17:05:38 +11:00
Damien George 946f8dd46f extmod/machine_i2c: Remove unneeded i2c_write_mem/i2c_read_mem funcs. 2016-11-23 17:05:38 +11:00
Damien George 96c3911a0a extmod/machine_i2c: Rewrite mem xfer funcs in terms of C-level protocol. 2016-11-23 17:05:37 +11:00
Damien George c81247f1ab extmod/machine_i2c: Rewrite i2c.scan in terms of C-level protocol. 2016-11-23 17:05:37 +11:00
Damien George bc4ea69795 extmod/machine_i2c: Add argument to C funcs to control stop generation. 2016-11-23 17:05:37 +11:00
Damien George b983cfaf41 extmod/machine_i2c: Add a C-level I2C-protocol, refactoring soft I2C. 2016-11-23 17:05:37 +11:00
Damien George 63a5df3cb4 docs/library/machine.I2C: Refine definitions of I2C methods. 2016-11-23 17:05:02 +11:00
Damien George a3320e7811 stmhal/i2c: Remove use of legacy I2C_NOSTRETCH_DISABLED option.
In the new HAL this is renamed to I2C_NOSTRETCH_DISABLE.
2016-11-22 17:40:50 +11:00
Rami Ali 2eff9c29a1 tests/basics: Improve user class coverage. 2016-11-22 15:49:02 +11:00
Rami Ali 1b41cacac7 tests/extmod: Improve ujson coverage. 2016-11-22 15:48:42 +11:00
Paul Sokolovsky 037e6912c6 py/objtype: Implement __call__ handling for an instance w/o heap alloc.
By refactoring and reusing code from objboundmeth.
2016-11-22 01:33:55 +03:00
Damien George 7e820792da stmhal: Updates to get F411 MCUs compiling with latest ST HAL. 2016-11-21 23:24:24 +11:00
Damien George 1f43d49f9e tests/micropython: Move alloc-less traceback test to separate test file.
The native emitter doesn't provide proper traceback info so this test
should not be run in that case.
2016-11-21 17:39:23 +11:00
Damien George d70f87aaa2 tests/micropython: Add test for creating traceback without allocation. 2016-11-21 17:10:17 +11:00
Damien George 21d82421cd stmhal/i2c: Use the HAL's I2C IRQ handler for F7 and L4 MCUs.
The custom IRQ handler only works for F4 MCUs, which have the SR1
register.
2016-11-21 16:12:09 +11:00
Damien George e30ca0e102 unix/Makefile: Update freedos target for change of USELECT config name. 2016-11-21 15:49:46 +11:00
Damien George 0d56c65d3e extmod/moduselect: Fix comment describing endif. 2016-11-21 15:47:48 +11:00
Paul Sokolovsky 5362bcc487 extmod/machine_mem: Typo fix in comment. 2016-11-21 01:09:17 +03:00
Paul Sokolovsky f14e9187ac cc3200: Update for moduselect moved to extmod/. 2016-11-21 01:08:15 +03:00
Paul Sokolovsky 87dfc76570 unix: Rename define for unix moduselect to MICROPY_PY_USELECT_POSIX.
To not conflict with recently made available globally baremetal
moduselect.
2016-11-21 00:48:55 +03:00
Paul Sokolovsky 8f5bc3ffc0 stmhal/moduselect: Move to extmod/ for reuse by other ports. 2016-11-21 00:05:56 +03:00
Damien George c28fed6b64 examples/accellog.py: Change 1: to /sd/, and update comment about FS. 2016-11-18 17:00:54 +11:00
Paul Sokolovsky 00d6f99cf1 examples/hwapi: Add hwconfig for console tracing of LED operations. 2016-11-18 07:20:26 +03:00
Radomir Dopieralski e81a5353cb extmod/machine_i2c: Release SDA on bus error 2016-11-17 12:43:13 +11:00
Radomir Dopieralski 9a82b67f39 extmod/machine_i2c: Raise an error when clock stretching times out 2016-11-17 12:43:13 +11:00
Radomir Dopieralski 702928915c extmod/machine_i2c: Make the clock stretching timeout configurable 2016-11-17 12:43:12 +11:00
Paul Sokolovsky b188d6e9db examples/hwapi: Add example for machine.time_pulse_us(). 2016-11-17 01:10:00 +03:00
Krzysztof Blazewicz 5e9057210a stmhal: Update HALCOMMITS due to change to hal. 2016-11-16 14:05:37 +01:00
Damien George e01e214259 stmhal/make-stmconst.py: Restore Python 2 compatibility. 2016-11-16 23:53:55 +11:00
Damien George 87f18c08c9 stmhal: Update HALCOMMITS due to change to hal. 2016-11-16 23:43:02 +11:00
Damien George c5621529c9 stmhal/make-stmconst.py: Add support for files with invalid utf8 bytes. 2016-11-16 23:29:02 +11:00
Krzysztof Blazewicz 4d9dce7759 stmhal/mphalport.h: use single GPIOx->BSRR register 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 13400e1375 stmhal/hal: do not include <stdio.h> in HAL headers
stdio.h was included in all HAL files only to provide
definition of NULL symbol

"stdio.h" includes "types.h" which contains some conflicting definitions
with "drivers/cc3000/inc/socket.h"
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 8fa0733647 stmhal/i2c: provide custom IRQ handlers
Use custom handlers providing minimal required functionality
because those provided by ST increase code size by almost 2 KiB.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 7604de3fc2 stmhal/can: clear FIFO flags in IRQ handler
HAL Driver before v1.4.2 had a bug which caused clearing all pending
flags in MSR, TSR, RF0R and RF1R instead of only the requested one.

This is why micropython got away without explicitly clearing flags
in IRQ handler.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz dc1ac5dc3a stmhal/dma: mark DMA sate as READY even if HAL_DMA_Init is skipped
Current version of HAL drivers checks if `hdma->State == HAL_DMA_STATE_READY`
before executing some functions.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 63ca7a211a stmhal/dma: precalculate register base and bitshift on handle init
Current version of HAL drivers optimize IRQ handler by using precalculated
DMA register address and stream bitshift instead of calculating it on every interrupt.

Since we skip call to `HAL_DMA_Init` on reused DMA, fields StreamBaseAddress and StreamIndex
of DMA handle are not initialized and thus leads to SegFault in `DMA_IRQHandler`.

HAL_DMA_Init is a big routine and we do not need to call it on each use of DMA
(ex.: series of I2C operations) and DMA_CalcBaseAndBitshift is really small and
releasing it increases code size by only 8 bytes.
2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 0280b2c1b1 stmhal/i2c: handle I2C IRQs
This is required by HAL Driver for error handling since v1.5.0
2016-11-16 12:43:27 +01:00