Commit Graph

6942 Commits

Author SHA1 Message Date
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
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