DeviceStatus becomes struct device_status with prefixed functions. The
error flag helpers are static inline functions in the header.
The implementation stays in C++ for now, as it reads data from objects
which are not converted yet. The header doesn't include the headers of
these objects anymore.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DcBus and PowerPort become struct dc_bus and struct power_port with
prefixed functions instead of member functions.
The default member initializers are replaced by dc_bus_init() and
power_port_init(). The only non-zero default value is the series
multiplier of the bus, which is set to 1 by dc_bus_init() and in the
static initializers of the global buses.
The optional voltage parameter of the control voltage functions has to
be passed explicitly now, 0 still selects the voltage intercept of the
bus.
LoadOutput and PwmSwitch still inherit from the C struct until they are
converted, and initialize it with power_port_init().
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the function pointers for the load and USB switches by power
switch devices. The register-level code for the short-circuit comparator
of the PWM 2420 LUS moved to the STM32 LPTIM power switch driver, which
reports short circuits via the fault callback. load_driver.c is removed.
The load and USB switches are now standalone devicetree nodes with the
labels load_switch and usb_switch instead of children of the outputs
node. The separate charge_pump node is replaced by the charge-pump-pwms
property of the load switch.
The comparator interrupt now only clears its own EXTI pending flag
instead of all pending flags.
Note for out-of-tree boards and overlays: The load and usb-pwr children
of the outputs node must be converted to nodes with the compatible
libresolar,gpio-power-switch and the labels load_switch and usb_switch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Also use new Zephyr CI environment and compile all boards.
Board migration script example:
python ../zephyr/scripts/utils/board_v1_to_v2.py --board-root . \
-v libresolar -g libresolar -b pwm_2420_lus -s stm32l072xx
The format tries to maintain the previously used Libre Solar firmware coding
style as much as possible.
Applying the format fixed some issues and re-ordered some parts of the code.
https://docs.zephyrproject.org/latest/guides/west/workspaces.html
Previously, west manifest and CMake entry point were in zephyr subfolder
as required for PlatformIO. As PlatformIO support was dropped, we can
follow the default Zephyr folder structure more closely.
The application is built and flashed from app subfolder, where as unit
tests are run from tests subfolder.