Add LPUART1 as a standard UART. No low power features are supported, yet.
LPUART1 is enabled as the next available UART after the standard U(S)ARTs:
STM32WB: LPUART1 = UART(2)
STM32L0: LPUART1 = UART(6)
STM32L4: LPUART1 = UART(6)
STM32H7: LPUART1 = UART(9)
On all ports: LPUART1 = machine.UART('LP1')
LPUART1 is enabled by defining MICROPY_HW_LPUART1_TX and
MICROPY_HW_LPUART1_RX in mpconfigboard.h.
Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
The new fdcan.c file provides the low-level C interface to the FDCAN
peripheral, and pyb_can.c is updated to support both traditional CAN and
FDCAN, depending on the MCU being compiled for.
Works with pins declared normally in mpconfigboard.h, eg. (pin_XX), as well
as (pyb_pin_XX).
Provides new mp_hal_pin_config_alt_static(pin_obj, mode, pull, fn_type)
function declared in pin_static_af.h to allow configuring pin alternate
functions by name at compile time.
This patch allows a given board to configure which pins are used for the
CAN peripherals, in a similar way to all the other bus peripherals (I2C,
UART, SPI). To enable CAN on a board the mpconfigboard.h file should
define (for example):
#define MICROPY_HW_CAN1_TX (pin_B9)
#define MICROPY_HW_CAN1_RX (pin_B8)
#define MICROPY_HW_CAN2_TX (pin_B13)
#define MICROPY_HW_CAN2_RX (pin_B12)
And the board config file should no longer define MICROPY_HW_ENABLE_CAN.
The individual union members (like SPI, I2C) are never used, only the
generic "reg" entry is. And the union names can clash with macro
definitions in the HAL so better to remove them.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
Blanket wide to all .c and .h files. Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.
Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
This is an attempt to clean up the Micro Python API on the pyboard.
Gpio functionality is now in the Pin object, which seems more natural.
Constants for MODE and PULL are now in pyb.Pin. Names of some
classes have been adjusted to conform to CamelCase. Other
miscellaneous changes and clean up here and there.
Added support for the ADC channels and mappings to make_pins.py
I'm not sure if the hal properly deals with the channel 16/18 differences
between the 40x and 42x. It seems to deal with it partially. This particular
aspect will need testing on a 42x or 43x.
This commit also introduces board directories and moves board
specific config into the appropriate board directory.
boards/stm32f4xx-af.csv was extracted from the STM32F4xx datasheet
and hand-tweaked.
make-pins.py takes boards/stm32f4xx-af.csv, boards/stm32f4xx-prefix.c,
and boards/BOARD-NAME/pins.csv as input and generates the file
build/pins_BOARD_NAME.c
The generated pin file for PYBOARD4 looks like this:
https://gist.github.com/dhylands/9063231
The generated pins file includes all of the supported alternate
functions, and includes upsupported alternate functions as comments.
See the commnet block at the top of stm/pin_map.c for details on
how to use the pin mapper.
I also went ahead and modified stm/gpio.c to use the pin mapper.