aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/timer.c
AgeCommit message (Collapse)Author
2020-12-07stm32: Add support for a board to reserve certain peripherals.Damien George
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-06-29stm32/timer: Properly initialise timer deadtime/brk on WB MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-06-25stm32/timer: Support TIM1 on WB MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2020-05-15stm32: Add support for F412 MCUs.Thomas Roberts
2020-04-18all: Fix implicit floating point to integer conversions.stijn
These are found when building with -Wfloat-conversion.
2020-04-18all: Fix implicit conversion from double to float.stijn
These are found when building with -Wfloat-conversion.
2020-04-05all: Use MP_ERROR_TEXT for all error messages.Jim Mussared
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-13py: Add mp_raise_msg_varg helper and use it where appropriate.Damien George
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
2019-12-27py: Introduce MP_ROM_NONE macro for ROM to refer to None object.Damien George
This helps to prevent mistakes, and allows easily changing the ROM value of None if needed.
2019-12-19stm32/timer: Add missing TIM 1/15/16/17 IRQ handlers for H7 MCUs.iabdalkader
2019-10-31stm32/timer: Fix Timer.freq() calc so mult doesn't overflow uint32_t.Damien George
Fixes issue #5280.
2019-09-23stm32: Use mp_printf with MICROPY_ERROR_PRINTER for uncaught exceptions.Damien George
2019-07-05stm32: Add initial support for STM32L0xx MCUs.Damien George
2019-04-15stm32/timer: Correctly initialise extended break settings on F7/H7/L4.Damien George
Fixes issue #4693.
2019-04-01stm32/timer: Expose the PWM BRK capability of Timer 1 and 8.roland van straten
The break mode is configurable via the 'brk' keyword to the Timer constructor and init method. It's disabled by default.
2019-02-12ports: Convert legacy uppercase macro names to lowercase.Damien George
2018-12-06stm32: Add peripheral support for STM32L432.boochow
The L432 does not have: GPIOD, TIM3, SPI2, ADC dual mode operation, 2-banks flash.
2018-07-17stm32/timer: Add tick_hz arg to Timer constructor and init method.Damien George
The period of the timer can now be specified using the "period" and "tick_hz" args. The period in seconds will be: period/tick_hz. tick_hz defaults to 1000, so if period is specified on its own then it will be in units of milliseconds.
2018-07-17stm32/timer: Use enum for indexing keyword arg in pyb_timer_init_helper.Damien George
2018-07-08stm32: Support compiling with object representation D.Damien George
With this and previous patches the stm32 port can now be compiled using object representation D (nan boxing). Note that native code and frozen mpy files with float constants are currently not supported with this object representation.
2018-06-15stm32/timer: Support TIM1 on F0 MCUs.Damien George
2018-05-28stm32: Add support for STM32F0 MCUs.Damien George
2018-05-28stm32/timer: Make timer_get_source_freq more efficient by using regs.Damien George
Use direct register access to get the APB clock divider. This reduces code size and makes the code more efficient.
2018-05-04stm32: Don't use %lu or %lx for formatting, use just %u or %x.Damien George
On this 32-bit arch there's no need to use the long version of the format specifier. It's only there to appease the compiler which checks the type of the args passed to printf. Removing the "l" saves a bit of code space.
2018-05-02stm32/irq: Define IRQ priorities directly as encoded hardware values.Damien George
For a given IRQn (eg UART) there's no need to carry around both a PRI and SUBPRI value (eg IRQ_PRI_UART, IRQ_SUBPRI_UART). Instead, the IRQ_PRI_UART value has been changed in this patch to be the encoded hardware value, using NVIC_EncodePriority. This way the NVIC_SetPriority function can be used directly, instead of going through HAL_NVIC_SetPriority which must do extra processing to encode the PRI+SUBPRI. For a priority grouping of 4 (4 bits for preempt priority, 0 bits for the sub-priority), which is used in the stm32 port, the IRQ_PRI_xxx constants remain unchanged in their value. This patch also "fixes" the use of raise_irq_pri() which should be passed the encoded value (but as mentioned above the unencoded value is the same as the encoded value for priority grouping 4, so there was no bug from this error).
2018-03-17stm32: Use STM32xx macros instead of MCU_SERIES_xx to select MCU type.Damien George
The CMSIS files for the STM32 range provide macros to distinguish between the different MCU series: STM32F4, STM32F7, STM32H7, STM32L4, etc. Prefer to use these instead of custom ones.
2018-03-09stm32/timer: Add Timer support for H7 MCUs.iabdalkader
2018-02-13stm32/timer: Support MCUs that don't have TIM4 and/or TIM5.Damien George
2018-02-13stm32: Update HAL macro and constant names to use newer versions.Damien George
Newer versions of the HAL use names which are cleaner and more self-consistent amongst the HAL itself. This patch switches to use those names in most places so it is easier to update the HAL in the future.
2017-09-25stm32/timer: Enable ARPE so that timer freq can be changed smoothly.Damien George
The timer prescaler is buffered by default, and this patch enables ARPE which buffers the auto-reload register. With both of these registers buffered it's now possible to smoothly change the timer's frequency and have a smoothly varying PWM output.
2017-09-13stm32/timer: Make pyb.Timer() instances persistent.Damien George
Prior to this patch calling pyb.Timer(id) would always create a new timer instance, even if there was an existing one. This patch fixes this behaviour to match other peripherals, like UART, such that constructing a timer with just the id will retrieve any existing instances. The patch also refactors the way timers are validated on construction to simplify and reduce code size.
2017-09-06ports: Make new ports/ sub-directory and move all ports there.Damien George
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.