There is a minor functional change with this patch, that the GPIO are now
configured in fast mode, whereas they were in high speed mode before. But
the SDIO should still work because SD CK frequency is at most 25MHz.
They are the same as the existing raw constants (namely 0, 1, 2) but we
want to explicitly show that one can use the HAL's constants if necessary
(eg the mpconfigboard.h files do use the HAL's constants to define the
pull state of certain configurable pins).
Without this the timer will have random values for its State and Lock
entries. The object can then be in a locked state leading to some HAL
functions returning immediately with an error code (which is unchecked).
This patch fixes such a bug which did manifest itself as PWM not working
correctly for LEDs.
mp_kbd_exception is now considered the standard variable name to hold the
singleton KeyboardInterrupt exception.
This patch also moves the creation of this object from pyb_usb_init() to
main().
This is a pure refactoring (and simplification) of code so that stmhal
uses the software SPI class provided in extmod, for the machine.SPI
implementation.
So long as a port defines relevant mp_hal_pin_xxx functions (and delay) it
can make use of this software SPI class without the need for additional
code.
Previous to this patch trying to construct, but not init, a UART that
didn't exist on the target board would actually succeed. Only when
initialising the UART would it then raise an exception that the UART does
not exist.
This patch adds an explicit check that the constructed UART does in fact
exist for the given board.
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.
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.
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.
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.
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.
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.
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.