46 Commits

Author SHA1 Message Date
Liu Hancheng
03dd50316c refactor: simplify timer bits handling 2025-01-04 21:38:22 +08:00
Liu Hancheng
ff526e1604 refactor: update DMA transfer functions to use separate memory and peripheral sizes 2025-01-04 20:16:34 +08:00
Liu Hancheng
90b4164426
dev: change name to bits 2025-01-02 12:51:47 +08:00
Liu Hancheng
a3a8dee579 refactor: exclude stm32l0 for 32bit timer branch
Signed-off-by: Liu Hancheng <liuhancheng.cn@gmail.com>
2025-01-01 17:28:37 +08:00
Liu Hancheng
99ce285397 refactor: change import style 2025-01-01 17:21:33 +08:00
Liu Hancheng
89a1346d00 docs: Update PWM waveform function documentation for data alignment 2025-01-01 17:17:23 +08:00
Liu Hancheng
cbc7a9fe5b feat: Add 32-bit timer support for waveform function 2025-01-01 17:05:48 +08:00
Aurélien Jacobs
3402e76f98 stm32/timer: avoid max_compare_value >= u16::MAX
With STM32 32 bits timers, the max_compare_value (AKA, ARR register)
can currently be set greater than u16::MAX, which leads to the following
assert!(max < u16::MAX as u32) in max_duty_cycle() when setting up a 1 kHz
SimplePwm on 84 MHz MCU.

The issue is fixed by forcing a max_compare_value that fits into 16 bits
when setting the frequency for a PWM.
2024-11-20 16:21:20 +01:00
Grant Miller
df06c2bbfe wip: split by value 2024-09-07 11:17:13 -05:00
Grant Miller
b8beaba6df last oops I promise 2024-09-06 15:08:58 -05:00
Grant Miller
d24c47a3ff Missing docs 2024-09-06 14:08:22 -05:00
Grant Miller
f571ab9d60 oops again 2024-09-06 14:04:58 -05:00
Grant Miller
71e49839fc oops 2024-09-06 14:01:10 -05:00
Grant Miller
cfc76cec71 Match embedded-hal api 2024-09-06 13:29:54 -05:00
Grant Miller
f7f062e0a3 Deduplicate SimplePwm's channel methods 2024-09-06 10:25:29 -05:00
Grant Miller
8ac758bdee embassy-stm32: Add SimplePwmChannel 2024-09-06 09:09:09 -05:00
Jan Špaček
94007ce6e0 stm32/gpio: refactor AfType 2024-06-16 21:11:55 +02:00
Dario Nieuwenhuis
389cbc0a77 stm32/timer: simplify traits, convert from trait methods to struct. 2024-03-23 01:37:28 +01:00
Dario Nieuwenhuis
eca9aac194 Fix warnings in recent nightly. 2024-03-20 16:39:09 +01:00
Ralf
b7bb4b23f8 STM32 SimplePwm: Fix regression and re-enable output pin
PR #2499 implemented timer hierarchy, but removed enable_outputs()
from trait CaptureCompare16bitInstance and from SimplePwm.

This functions is required for advanced timers to set bit BDTR.MOE
and to enable the output signal.
2024-03-08 11:18:45 +01:00
eZio Pan
6c690ab259 restore original public API of timer, but keep new PAC 2024-02-10 00:00:43 +01:00
eZio Pan
d538829f2f add methods with macro 2024-02-10 00:00:43 +01:00
eZio Pan
dc4898ca89 update timer mod after stm32-metapac timer_v2 2024-02-09 23:58:13 +01:00
Dario Nieuwenhuis
7e02389995
Merge pull request #2410 from eZioPan/waveform-on-CHx
impl waveform with TIM OC Channel DMA
2024-02-01 01:02:01 +00:00
Ralf
db776c9623 stm32/simple_pwm: add set_output_compare_mode 2024-01-10 18:48:26 +01:00
eZio Pan
b16cc04036 bug fix 2024-01-08 19:18:24 +08:00
eZio Pan
890a1269d0 refactor with clippy 2024-01-06 22:48:21 +08:00
eZio Pan
424ddaf3d9 impl waveform with TIM Channel 2024-01-06 22:22:38 +08:00
Dario Nieuwenhuis
638aa313d4 stm32/pwm: simplify impl blocks. 2024-01-02 17:28:23 +01:00
eZio Pan
c276da5fcb ask a DMA Channel only when use .gen_waveform() 2024-01-02 14:01:09 +08:00
eZio Pan
873ee06151 some trivial fix
use less #[cfg] macro; reuse same variable
2023-12-30 12:01:08 +08:00
eZio Pan
24f569821c record&restore TIM OC to it's earlier state 2023-12-29 23:22:10 +08:00
eZio Pan
8c2a6df03b implement PWM waveform generating with DMA 2023-12-28 20:09:12 +08:00
Dario Nieuwenhuis
189b15c426 stm32/timer: docs. 2023-12-19 17:35:38 +01:00
Dario Nieuwenhuis
124478c5e9 stm32: more docs. 2023-12-18 19:11:23 +01:00
Dion Dokter
5b3f75dc72 Merge branch 'master' into center-align 2023-10-20 14:17:55 +02:00
Ralf
9a7fda87b0 STM32: timer enable_output does not take bool, but just enables the output 2023-10-13 18:52:10 +02:00
pbert
ecdd7c0e2f enable clock first 2023-10-12 11:04:44 +02:00
pbert
f65a96c541 STM32: combine RccPeripherals reset() and enable() to reset_and_enable() 2023-10-12 11:04:19 +02:00
randi
b217d147de Implemented Pwm trait from embedded_hal 2023-10-07 11:57:19 +13:00
Dion Dokter
137e47f98d Do affect the frequency 2023-10-02 21:14:44 +02:00
Dion Dokter
561126b0d6 stm32: Add the ability to center-align timers 2023-10-01 23:09:01 +02:00
Aurelien Jacobs
2ea17d2783 stm32: allow setting the PWM output polarity 2023-08-18 16:45:50 +02:00
Aurélien Jacobs
78bb261246 stm32: allow setting PWM duty cycle to 100%
Setting the compare_value to max_compare_value make the PWM output
go low when the timer reach the max_compare_value and go high again
on the next timer clock, when the value roll back to 0.
So to allow a 100% PWM that never goes low, the compare_value must
be set to max_compare_value + 1.
2023-08-18 16:10:49 +02:00
xoviat
0d7b005252 stm32/pwm: add output type control 2023-07-29 12:01:32 -05:00
Dario Nieuwenhuis
3690af9bea
stm32/timer: merge pwm module into timer. (#1703)
The traits there are applicable to timer use cases other than PWM.
It doesn't make sense to keep them separated.
2023-07-28 15:29:27 +02:00