Commit Graph

13 Commits

Author SHA1 Message Date
iabdalkader
20f8ce1982 stm32/pyb_can: Add ability to calculate CAN bit timing from baudrate.
Calculate the bit timing from baudrate if provided, allowing sample point
override.  This makes it a lot easier to make CAN work between different
MCUs with different clocks, prescalers etc.

Tested on F4, F7 and H7 Y/V variants.
2020-12-17 23:01:15 +11:00
Damien George
1e4e2644ec stm32: Add support for a board to reserve certain peripherals.
Allows reserving CAN, I2C, SPI, Timer and UART peripherals.  If reserved
the peripheral cannot be accessed from Python.

Signed-off-by: Damien George <damien@micropython.org>
2020-12-07 17:22:08 +11:00
iabdalkader
c299cc94e3 stm32/pyb_can: Handle timeout arg for FDCAN in pyb_can_send.
Following the documented pyb can_send behavior in pyb.CAN docs.
2020-07-09 00:38:56 +10:00
stijn
84fa3312cf all: Format code to add space after C++-style comment start.
Note: the uncrustify configuration is explicitly set to 'add' instead of
'force' in order not to alter the comments which use extra spaces after //
as a means of indenting text for clarity.
2020-04-23 11:24:25 +10:00
Jim Mussared
def76fe4d9 all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
Damien George
1a3e386c67 all: Remove spaces inside and around parenthesis.
Using new options enabled in the uncrustify configuration.
2020-03-28 23:36:44 +11:00
Damien George
69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George
ad7213d3c3 py: Add mp_raise_msg_varg helper and use it where appropriate.
This commit adds mp_raise_msg_varg(type, fmt, ...) as a helper for
nlr_raise(mp_obj_new_exception_msg_varg(type, fmt, ...)).  It makes the
C-level API for raising exceptions more consistent, and reduces code size
on most ports:

   bare-arm:   +28 +0.042%
minimal x86:  +100 +0.067%
   unix x64:   -56 -0.011%
unix nanbox:  -300 -0.068%
      stm32:  -204 -0.054% PYBV10
     cc3200:    +0 +0.000%
    esp8266:   -64 -0.010% GENERIC
      esp32:  -104 -0.007% GENERIC
        nrf:  -136 -0.094% pca10040
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
2020-02-13 11:52:40 +11:00
Damien George
d980d51807 stm32: Fix to build in nanbox mode. 2019-12-27 22:54:53 +11:00
Damien George
09376f0e47 py: Introduce MP_ROM_NONE macro for ROM to refer to None object.
This helps to prevent mistakes, and allows easily changing the ROM value of
None if needed.
2019-12-27 22:51:17 +11:00
Damien George
ca8ff99e8c stm32: Use mp_printf with MICROPY_ERROR_PRINTER for uncaught exceptions. 2019-09-23 17:15:07 +10:00
iabdalkader
f7a07b3605 stm32: Add support for FDCAN peripheral, exposed as pyb.CAN.
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.
2019-09-23 17:00:54 +10:00
Damien George
d06fd384c2 stm32/can: Factor CAN driver into low-level and Python bindings.
can.c now contains the low-level C interface to the CAN peripheral, and
pyb_can.c the Python-level class/methods/constants.
2019-09-23 16:58:08 +10:00