Commit Graph

6955 Commits

Author SHA1 Message Date
Damien George aaab6a9921 stmhal/uart: Add support for UART7 and UART8 on F7 MCUs. 2016-12-05 15:14:22 +11:00
Rami Ali 27a503f632 stmhal: Refactor UART configuration to use pin objects.
This follows the pattern of other peripherals (I2C, SPI) to specify the
pins using pin objects instead of a pair of GPIO port and pin number.  It
makes it easier to customise the UART pins for a particular board.
2016-12-05 14:26:41 +11:00
puuu 4fc607a1d7 esp8266: Move websocket_helper.py from scripts to modules for frozen BC.
websocket_helper.py is used by webrepl.  If webrepl is enabled and
websocket_helper.py is not frozen bytecode it leads to heap
fragmentation.
2016-12-05 13:01:08 +11:00
Damien George 042d5f24d6 tests/extmod/framebuf1: Add basics tests for hline, vline, rect, line. 2016-12-05 11:55:43 +11:00
Damien George 374ed317c5 extmod/modframebuf: Add hline, vline, rect and line methods.
These are basic drawing primitives.  They work in a generic way on all
framebuf formats by calling the underlying setpixel or fill_rect C-level
primitives.
2016-12-05 11:52:51 +11:00
Damien George 0db3a41f02 travis: Build STM32 F7 and L4 boards under Travis CI.
The STM32 F7 and L4 boards use significantly different code to the F4
boards so it's important to test them with CI.  To keep CI build times
within a reasonable limit the STM32F4DISC board is no longer built, it's
anyway very similar to the standard F4 build for PYBv1.0.
2016-12-05 11:25:37 +11:00
Damien George fcd10882bd stmhal/adc: Use constants from new HAL version. 2016-12-05 10:51:00 +11:00
Paul Sokolovsky e44b236ce2 tests/extmod/btree1: Exercise btree.flush(). 2016-12-05 01:55:05 +03:00
Paul Sokolovsky 4463d8a910 extmod/modbtree: Rename "sync" method to "flush" for consistency.
Rename recently introduced "sync" method to "flush" for consistency with
usual files.
2016-12-05 01:50:55 +03:00
Paul Sokolovsky 1779a62085 zephyr: Switch to Zephyr 1.6 unified kernel API.
In 1.6, Zephyr switched to "unified kernel" and new API set. Older kernel
API is supported, but marked as deprecated and leads to warnings.
2016-12-04 00:47:20 +03:00
Peter Hinch 46e59c52af docs/library/pyb.Accel: Add hardware note about pins used by accel. 2016-12-02 17:39:13 +11:00
w4kpm ec22d1739d extmod/modbtree: Add method to sync the database.
If you have longish operations on the db (such as logging data) it may
be desirable to periodically sync the database to the disk.  The added
btree.sync() method merely exposes the berkley __bt_sync function to the
user.
2016-12-02 17:30:53 +11:00
w4kpm bd476acd41 extmod/vfs_fat_file: Allow file obj to respond to ioctl flush request. 2016-12-02 17:26:37 +11:00
Damien George e50cb73b7a esp8266: Enable uselect module.
Select and poll will now work on socket objects.
2016-12-02 16:44:31 +11:00
Damien George cb53226b0c extmod/modlwip: Add ioctl method to socket, with poll implementation.
Implementation of polling may need further fine tuning, but basic
functionality works (tested on esp8266).
2016-12-02 16:41:51 +11:00
Damien George 2d329c4a56 extmod/moduselect: Use configurable EVENT_POLL_HOOK instead of WFI.
To make moduselect be usable by any port.
2016-12-02 16:40:39 +11:00
Damien George ebc8d730f1 extmod/moduselect: Use stream helper function instead of ad-hoc code. 2016-12-02 16:39:50 +11:00
Damien George 304cfda8c4 py/stream: Move ad-hoc ioctl constants to stream.h and rename them.
The constants MP_IOCTL_POLL_xxx, which were stmhal-specific, are moved
from stmhal/pybioctl.h (now deleted) to py/stream.h.  And they are renamed
to MP_STREAM_POLL_xxx to be consistent with other such constants.

All uses of these constants have been updated.
2016-12-02 16:37:29 +11:00
Damien George 6194336d81 tests/extmod/vfs_fat_fileio: Add test for constructor of FileIO type. 2016-12-02 15:37:58 +11:00
Damien George f7545b200e stmhal/moduos: Implement POSIX behaviour of rename, allow to overwrite. 2016-12-02 15:13:29 +11:00
Damien George b7df3e541a extmod/vfs_fat: Implement POSIX behaviour of rename, allow to overwrite.
If the destination of os.rename() exists then it will be overwritten if it
is a file.  This is the POSIX behaviour, which is also the CPython
behaviour, and so we follow suit.

See issue #2598 for discussion.
2016-12-02 15:06:09 +11:00
Jean-François Milants 08bd7d1d31 stmhal/sdcard: Clean/invalidate cache before DMA transfers with SD card.
Add 2 macros in mphalport.h that clean and invalidate data caches only on
STM32F7 MCUs.  They are needed to ensure the cache coherency before/after
DMA transferts.

* MP_HAL_CLEANINVALIDATE_DCACHE cleans and invalidate the data cache. It
  must be called before starting a DMA transfer from the peripheral to the
  RAM memory.

* MP_HAL_CLEAN_DCACHE cleans the data cache.  It must be called before
  starting a DMA transfert from the RAM memory to the peripheral.

These macros are called in sdcard.c, before reading from and writing to
the SDCard, when DMA is used.
2016-12-02 13:51:09 +11:00
Damien George a081b49d55 extmod/modframebuf: Optimise fill and fill_rect methods.
Fill is a very common operation (eg to clear the screen) and it is worth
optimising it, by providing a specialised fill_rect function for each
framebuffer format.

This patch improved the speed of fill by 10 times for a 16-bit display
with 160*128 pixels.
2016-12-01 16:51:31 +11:00
Damien George 81e171b7bb extmod/modframebuf: Add back legacy FrameBuffer1 "class".
For backwards compatibility.  It simple creates a frame buffer with the
MVLSB format.
2016-12-01 16:43:25 +11:00
Radomir Dopieralski eb09336e99 drivers/display/ssd1306.py: Update to use FrameBuffer not FrameBuffer1 2016-12-01 16:43:25 +11:00
Radomir Dopieralski 225e22b287 extmod/modframebuf: Make FrameBuffer handle 16bit depth.
Rename FrameBuffer1 into FrameBuffer and make it handle different bit
depths via a method table that has getpixel and setpixel.  Currently
supported formats are MVLSB (monochrome, vertical, LSB) and RGB565.

Also add blit() and fill_rect() methods.
2016-12-01 16:43:25 +11:00
Damien George 8b8242954e extmod/modurandom: Allow to build with float disabled. 2016-11-30 12:58:54 +11:00
Damien George c19a395cac stmhal/adc: Make channel "16" always map to the temperature sensor.
The temperature sensor on F4 and F7 MCUs is mostly, but not always, on
channel 16.  To retain compatibility across all these MCUs this patch
maps the user-facing channel 16 to the internal temperature sensor.
2016-11-30 12:58:54 +11:00
Damien George 390ce86a30 stmhal/adc: Add support for F767 MCU. 2016-11-30 12:58:54 +11:00
Damien George 52dfad0879 stmhal/adc: Add ADCAll.read_vref method, returning "3.3v" value. 2016-11-30 12:58:54 +11:00
Damien George e72353cc48 stmhal/adc: Make ADCAll.read_core_temp return accurate float value.
It now uses factory calibration values to get a more accurate value, and
returns a float instead of an integer.
2016-11-30 12:58:53 +11:00
Damien George 87215a0f04 stmhal/adc: Provide more accurate measure of VBAT and VREFINT.
By using factory calibration values.
2016-11-30 12:58:53 +11:00
Paul Sokolovsky 295266178c zephyr/zephyr_getchar: Update to Zephyr 1.6 unified kernel API. 2016-11-30 01:42:58 +03:00
Paul Sokolovsky a6de451a13 zephyr: Add .gitignore to ignore Zephyr's "outdir" directory.
That's where Zephyr keeps object files and produced executables.
2016-11-30 00:26:31 +03:00
Damien George 63e82dcdfe py/asmthumb: Fix build for F7 MCUs after recent code refactoring. 2016-11-30 00:11:25 +11:00
Damien George 029f215ead stmhal/adc: Add "mask" selection parameter to pyb.ADCAll constructor.
The "mask" parameter is used to select which pins the ADCAll constructor
will initialise to analog mode.  It defaults to all pins (0xffffffff),
which is backwards compatible with previous behaviour.
2016-11-29 14:32:05 +11:00
Nicholas Graumann 0d75b0d962 stmhal: Add address parameters to openocd config files.
Also make l4 config the default for STM32L476DISC board.
2016-11-28 15:27:36 +11:00
Nicholas Graumann 50a2966913 stmhal: Add OpenOCD configuration for STM32L4. 2016-11-28 15:27:36 +11:00
Damien George 139b891d6d stmhal: Add back GPIO_BSRRL and GPIO_BSRRH constants to stm module.
These were inadvertently removed with a recent upgrade to CMSIS, where
those registers were no longer defined in the CMSIS headers, and hence
no longer extracted.
2016-11-28 15:02:42 +11:00
Damien George 612599587b py: Factor out common code from assemblers into asmbase.[ch].
All assemblers should "derive" from mp_asm_base_t.
2016-11-28 09:24:50 +11:00
Dave Hylands 21e1703d37 stmhal: Add support for flash storage on STM32F415. 2016-11-26 16:47:45 +11:00
Damien George dbc09d03f6 tests/basics: Enable tests for list slice getting with 3rd arg.
Also add a test to check case when 3rd arg is 0.
2016-11-26 16:39:25 +11:00
Damien George 4c3c515bd1 tests/basics: Change dict_fromkeys test so it doesn't use generators.
And then it can run with the native emitter.
2016-11-26 16:38:38 +11:00
Damien George e6cf5fb2cc py/compile: Remove comment about TODO for short circuiting for if-stmt.
Short circuiting is handled correctly by c_if_cond, and constants within
short-circuit expressions are optimised by the parser.
2016-11-26 16:15:55 +11:00
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