Commit Graph

980 Commits

Author SHA1 Message Date
Krzysztof Blazewicz 6a8f6c119c stmhal/hal/sd: reapply HAL commit 09de030 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz e2b4822189 stmhal/hal/rcc: reapply HAL commit c568a2b for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 4f7c5fa647 stmhal/hal: reapply HAL commit 9db719b for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz c79ff9930a stmhal/hal/sd: reapply HAL commit 1d7fb82 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz a9fb88e1dc stmhal/hal/i2c: reapply HAL commit ea040a4 for f4 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz e8b435d1f8 stmhal: apply STM32CubeF4 v1.13.1 patch - upgrade HAL driver to v1.5.2 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz c1fa33b493 stmhal: upgrade to STM32CubeF4 v1.13.0 - HAL v1.5.1 2016-11-16 12:43:27 +01:00
Krzysztof Blazewicz 4f5c4fdd98 stmhal: upgrade to STM32CubeF4 v1.13.0 - CMSIS/Device 2.5.1 2016-11-16 12:43:27 +01:00
Damien George e5ef15a9d7 py/lexer: Provide generic mp_lexer_new_from_file based on mp_reader.
If a port defines MICROPY_READER_POSIX or MICROPY_READER_FATFS then
lexer.c now provides an implementation of mp_lexer_new_from_file using
the mp_reader_new_file function.
2016-11-16 18:13:51 +11:00
Damien George 6b239c271c py: Factor out persistent-code reader into separate files.
Implementations of persistent-code reader are provided for POSIX systems
and systems using FatFS.  Macros to use these are MICROPY_READER_POSIX and
MICROPY_READER_FATFS respectively.  If an alternative implementation is
needed then a port can define the function mp_reader_new_file.
2016-11-16 18:13:50 +11:00
Paul Sokolovsky 59a1201da9 all: Remove readall() method, which is equivalent to read() w/o args.
Its addition was due to an early exploration on how to add CPython-like
stream interface. It's clear that it's not needed and just takes up
bytes in all ports.
2016-11-14 00:24:22 +03:00
Damien George 1375c52772 stmhal: Rename mp_hal_pin_set_af to _config_alt, to simplify alt config.
This way the caller doesn't need to initialise a big GPIO_InitTypeDef
struct, and HAL_GPIO_Init is no longer called.
2016-11-11 17:53:45 +11:00
Damien George 74fb5d6932 stmhal/i2c: Reset the I2C peripheral if there was an error on the bus.
If an I2C send/recv fails then the peripheral is now checked to see if
it's in a "stuck" state waiting for the stop bit, and if so then it is
reset so that the next I2C transaction can proceed.

This patch also de-inits the I2C peripheral in the init() method, before
init'ing it again.
2016-11-11 17:38:52 +11:00
Damien George c4e58eaa98 stmhal/i2c: Add option to I2C to enable/disable use of DMA transfers.
New keyword option in constructor and init() method is "dma=<bool>".
DMA is now disabled by default for I2C transfers because it currently does
not handle I2C bus errors very well (eg if slave device doesn't ACK or
NACK correctly during a transfer).
2016-11-11 17:36:19 +11:00
Damien George e6da6a720f stmhal/dma: De-init the DMA peripheral properly before initialising.
The DMA state is always HAL_DMA_STATE_RESET because of the memset clearing
all the data, so prior to this patch HAL_DMA_DeInit was never called.  Now
it is always called to make sure the DMA is properly reset.
2016-11-11 17:24:18 +11:00
Damien George bdf33bc136 py: Move frozen bytecode Makefile rules from ports to common mk files.
Now, to use frozen bytecode all a port needs to do is define
FROZEN_MPY_DIR to the directory containing the .py files to freeze, and
define MICROPY_MODULE_FROZEN_MPY and MICROPY_QSTR_EXTRA_POOL.
2016-11-08 14:28:30 +11:00
Ryan Shaw 8ebd53afc9 stmhal: enable SD power save (disable CLK on idle) 2016-11-07 16:49:29 +11:00
Damien George 7bb0f7b0f6 drivers: Add "from micropython import const" when const is used.
Following best-practice use of the const feature, to make it compatible
with Python.
2016-11-03 12:41:11 +11:00
Damien George cd527bb324 lib/libm: Move Thumb-specific sqrtf function to separate file.
This allows it to be used only when the hardware supports VFP
instructions, preventing compile errors.
2016-11-03 12:26:32 +11:00
Paul Sokolovsky 369233105b stmhal/modutime: Consistently convert to MP_ROM_QSTR/MP_ROM_PTR. 2016-10-29 17:46:47 +03:00
Paul Sokolovsky d86cac4b82 extmod/utime_mphal: Implement ticks_add(), add to all maintained ports. 2016-10-29 17:30:05 +03:00
Damien George 4ebdb1f2b2 py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.
In order to have more fine-grained control over how builtin functions are
constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific,
with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW.  These names now
match the MP_DEFINE_CONST_FUN_OBJ macros.
2016-10-21 16:26:01 +11:00
Paul Sokolovsky 3967ca7390 stmhal/Makefile: Use standard rules for frozen module generation.
As defined in py/py.mk.
2016-10-21 01:27:17 +03:00
Damien George b4cc68e4a4 stmhal/led: Refactor LED to use mp_hal_pin_output() init function.
As part of this patch the MICROPY_HW_LED_OTYPE setting is removed because
it is now unused (all boards anyway had this as OUTPUT_PP).
2016-10-18 14:43:05 +11:00
Damien George d49d81b167 stmhal: Refactor pin usage to use mp_hal_pin API. 2016-10-18 14:34:08 +11:00
Damien George cd9b14bb11 stmhal/modutime: Refactor to use extmod's version of ticks_cpu. 2016-10-18 14:34:08 +11:00
Damien George 48feb8ac6e stmhal: Enable str.center(), str.[r]partition() and builtin compile().
Also adds "machine" to the list of modules that the parser can search for
constants.
2016-10-17 13:17:19 +11:00
Damien George 57226a2b7f stmhal: Implement machine.soft_reset(). 2016-10-17 13:16:47 +11:00
Paul Sokolovsky 799ccdc789 esp8266, stmhal, unix: MAKE_FROZEN is consistently defined in mkenv.mk. 2016-10-16 10:49:36 +03:00
Paul Sokolovsky f059563507 stmhal/modutime: Refactor to use extmod/utime_mphal.c.
This includes making sure that utime_mphal's sleep_ms() and sleep_us()
don't sleep on negative arguments.
2016-10-14 20:42:42 +03:00
Damien George 8298251215 stmhal/pybstdio: Use size_t instead of mp_uint_t. 2016-10-14 00:07:32 +11:00
Damien George a2bfcbe029 stmhal: Use mp_raise_OSError helper function. 2016-10-07 13:58:25 +11:00
Damien George 0bb3c7d3b7 stmhal: Enable machine.time_pulse_us() function. 2016-10-06 12:12:20 +11:00
Dave Hylands c08f50bcf7 stmhal: Disable network and usocket for ESPRUINO_PICO 2016-10-06 11:47:45 +11:00
Damien George b89ac9db78 stmhal/moduos: Implement total-number-of-blocks field in statvfs. 2016-10-05 15:52:36 +11:00
Damien George b1537a5752 stmhal/mphalport: Change pin obj type to const pointer, to avoid casts. 2016-10-05 15:51:40 +11:00
Dave Hylands 7a9c183c20 stmhal: Fix ESPRUINO_PICO by adding ld scripts with correct flash size. 2016-10-05 11:42:50 +11:00
Pavol Rusnak 99d62c4def stmhal/usb: Use real packet size (not maximum) in HID receive. 2016-10-04 15:39:31 +11:00
Pavol Rusnak 8f3cf6e6a8 stmhal/usb: Use correct ClassData structure for HID receive. 2016-10-04 15:38:32 +11:00
Philip Potter eb239b8398 stmhal/usb: Add support to receive USB HID messages from host. 2016-10-04 15:38:01 +11:00
Philip Potter 03de5a13cf stmhal/usbdev: Add OUT endpoint to HID interface. 2016-10-04 15:20:11 +11:00
Dave Hylands 1f433c719b stmhal: Fix linker map for STM32L476 chips.
In particular, this makes the L4 .isr_vector section 16K in size so it's
the same as the F4/F7 MCUs.  The patch also moves the L4 filesystem to
the end of flash, which allows for 512K filesystem on the 1Mb devices
like the STM32L476DISC.
2016-10-04 14:31:19 +11:00
Damien George bd925b59c3 stmhal/spi: Enable use of fast software SPI. 2016-10-04 13:51:30 +11:00
Damien George b932b2dd1f extmod/machine_spi: Use delay_half, not baudrate, for internal timing.
The delay_half parameter must be specified by the port to set up the
timing of the software SPI.  This allows the port to adjust the timing
value to better suit its timing characteristics, as well as provide a
more accurate printing of the baudrate.
2016-10-04 13:43:02 +11:00
Damien George 9f1e395c16 stmhal/spi: Use software SPI if no periph id given, even if pins given.
It's simpler to just default to always using software SPI if no specific
peripheral id/name is given.  To use hardware SPI users must specify a
hardware peripheral id as the first parameter to the SPI constructor.
2016-10-04 13:38:11 +11:00
Damien George 5deedd6685 stmhal/mphalport: Fix mp_hal_pin_write to use correct pin_mask. 2016-10-03 18:06:58 +11:00
Damien George d4a5ca5056 stmhal/spi: Make machine.SPI class conform to correct API.
Includes both software and hardware SPI implementations.
2016-10-03 17:12:43 +11:00
Damien George 077dbf4a86 stmhal/mphalport: Implement mp_hal_pin_{input,output,write}. 2016-10-03 16:44:34 +11:00
Damien George a22a67661a stmhal/spi: Simplify spi_transfer function to take only one buf len arg. 2016-10-03 12:47:56 +11:00
Damien George 5bb28c7f10 extmod/machine_spi: Simplify SPI xfer function to only take one buf len.
There is no need to take src_len and dest_len arguments.  The case of
reading-only with a single output byte (originally src_len=1, dest_len>1)
is now handled by using the output buffer as the input buffer, and using
memset to fill the output byte into this buffer.  This simplifies the
implementations of the spi_transfer protocol function.
2016-10-03 12:39:31 +11:00