Files
charge-controller-firmware/drivers/half_bridge/Kconfig
T
Martin JägerandClaude Opus 5.5 0164841139 drivers: half_bridge: split STM32 timer driver into advtim and gptim
The STM32 timer half-bridge driver supported two operating modes, which
only shared the clock, reset and pinctrl setup, but branched in every
API function. Split it into two drivers with separate compatibles:

- libresolar,stm32-advtim-half-bridge: Advanced-control timers (e.g.
  TIM1) with complementary outputs and hardware dead time generation.
- libresolar,stm32-gptim-half-bridge: General-purpose timers (e.g. TIM3)
  without dead time generator, using two independent channels with dead
  time generated in software.

This allows the devicetree bindings to only contain the properties
valid for the respective timer type (e.g. adc-trigger only for advtim,
high-side-channel and low-side-channel required for gptim) and removes
most of the preprocessor conditionals for MCUs without advanced-control
timers. The common timer setup is moved to half_bridge_stm32_tim.c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 21:43:58 +02:00

69 lines
2.2 KiB
Plaintext

# Copyright (c) The Libre Solar Project Contributors
# SPDX-License-Identifier: Apache-2.0
menuconfig HALF_BRIDGE
bool "Half-bridge drivers"
default y if DT_HAS_LIBRESOLAR_STM32_ADVTIM_HALF_BRIDGE_ENABLED
default y if DT_HAS_LIBRESOLAR_STM32_GPTIM_HALF_BRIDGE_ENABLED
default y if DT_HAS_LIBRESOLAR_STM32_HRTIM_HALF_BRIDGE_ENABLED
default y if DT_HAS_LIBRESOLAR_HALF_BRIDGE_EMUL_ENABLED
help
Enable drivers for half bridges consisting of two complementary PWM outputs with dead time,
e.g. used in DC/DC converters.
if HALF_BRIDGE
config HALF_BRIDGE_INIT_PRIORITY
int "Half-bridge init priority"
default KERNEL_INIT_PRIORITY_DEVICE
help
Half-bridge driver device initialization priority.
module = HALF_BRIDGE
module-str = half_bridge
source "subsys/logging/Kconfig.template.log_config"
config HALF_BRIDGE_STM32_TIM
bool
select USE_STM32_LL_TIM
select PINCTRL
select RESET
help
Common functions for half-bridge drivers using STM32 timers (TIM).
config HALF_BRIDGE_STM32_ADVTIM
bool "STM32 advanced-control timer half-bridge driver"
default y
depends on DT_HAS_LIBRESOLAR_STM32_ADVTIM_HALF_BRIDGE_ENABLED
select HALF_BRIDGE_STM32_TIM
help
Enable half-bridge driver for STM32 advanced-control timers (e.g. TIM1) using
complementary outputs with hardware dead time generation.
config HALF_BRIDGE_STM32_GPTIM
bool "STM32 general-purpose timer half-bridge driver"
default y
depends on DT_HAS_LIBRESOLAR_STM32_GPTIM_HALF_BRIDGE_ENABLED
select HALF_BRIDGE_STM32_TIM
help
Enable half-bridge driver for STM32 general-purpose timers (e.g. TIM3) using two
independent channels with dead time generated by software.
config HALF_BRIDGE_STM32_HRTIM
bool "STM32 HRTIM half-bridge driver"
default y
depends on DT_HAS_LIBRESOLAR_STM32_HRTIM_HALF_BRIDGE_ENABLED
select PINCTRL
select RESET
help
Enable half-bridge driver for the STM32 high-resolution timer (HRTIM).
config HALF_BRIDGE_EMUL
bool "Emulated half-bridge driver"
default y
depends on DT_HAS_LIBRESOLAR_HALF_BRIDGE_EMUL_ENABLED
help
Enable emulated half-bridge driver for tests on native_sim.
endif # HALF_BRIDGE