Zephyr's NTC thermistor driver reads the ADC on demand, which is not
possible while the ADC is continuously sampled by the DAQ driver. The new
sensor driver calculates the temperature from the filtered reading of a
DAQ channel using the beta equation.
The DAQ channel is referenced via phandle, the pull-up resistor, the
nominal resistance and the beta value are configured in the devicetree.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The functions for timer clock, reset and pinctrl setup are not specific
to half bridges and will also be used by the PWM power switch driver.
They are moved to a separate library enabled by the hidden Kconfig
symbol LIBRESOLAR_STM32_TIM.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a driver class for power switches, e.g. used for load and USB
outputs. Besides switching on and off, drivers may provide a power-good
feedback and report faults that were already handled in hardware.
Two backends are available:
- libresolar,gpio-power-switch: Switch driven by a GPIO with optional
latching power-good feedback and charge pump PWM for high-side gate
drivers. The latch time is handled by delayable work instead of
blocking the caller.
- libresolar,stm32-lptim-power-switch: Switch driven by LPTIM1 of
STM32L0, which is triggered by COMP2 to switch off within a few
microseconds in case of a short circuit (PWM 2420 LUS).
The GPIO backend is tested on native_sim using the GPIO emulator and the
fake PWM driver.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Zephyr driver for the data acquisition (DAQ), i.e. continuous
sampling of all analog inputs with 1 kHz, low-pass filtering of the
readings and checking them against upper and lower limits. It is based
on the existing implementation in the application.
The driver consists of a common part (filtering, alerts, scaling and
calibration) and backends for the different ADC types:
- STM32 ADCs with a fixed channel sequence (STM32F0, STM32L0 and newly
supported STM32G0)
- STM32 ADCs with a configurable channel sequence (STM32G4)
- Emulated DAQ for tests on native_sim
Compared to the application implementation, the position of the
readings in the DMA buffer is determined by the driver, so that the
inputs can be specified in any order in the devicetree. The factory
calibration values for the internal reference voltage and temperature
sensor are taken from the STM32 LL headers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add infrastructure for out-of-tree drivers in this Zephyr module and
define a driver API for half bridges consisting of two complementary
PWM outputs with dead time, as used in the DC/DC converter.
The API is defined as a __subsystem so that drivers can use the
DEVICE_API() macro. Integer-based compare values allow to change the
PWM with minimum step size, while inline helpers provide the float
duty cycle interface known from the previous application code.
A libresolar vendor prefix is added for the new bindings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>