From 45480704257f59dec54e9249e2b32f43d8a79d59 Mon Sep 17 00:00:00 2001 From: FoniksFox Date: Sat, 9 May 2026 00:44:42 +0200 Subject: [PATCH 1/3] feat: Make ST-LIB::instance_of() constexpr (it works, trust me) --- Inc/ST-LIB.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Inc/ST-LIB.hpp b/Inc/ST-LIB.hpp index 74f2f9753..7315e1cae 100644 --- a/Inc/ST-LIB.hpp +++ b/Inc/ST-LIB.hpp @@ -364,7 +364,7 @@ template struct Board { } } - template static auto& instance_of() { + template constexpr static auto& instance_of() { using DevT = std::remove_cvref_t; using Domain = typename DevT::domain; From 4e697dfa933c219677fea1d4ece05b077c3f4b41 Mon Sep 17 00:00:00 2001 From: FoniksFox Date: Sat, 9 May 2026 00:48:10 +0200 Subject: [PATCH 2/3] chore: Add changeset --- .changesets/feat-stlib-constexpr-instanceof().md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .changesets/feat-stlib-constexpr-instanceof().md diff --git a/.changesets/feat-stlib-constexpr-instanceof().md b/.changesets/feat-stlib-constexpr-instanceof().md new file mode 100644 index 000000000..8a08f11e6 --- /dev/null +++ b/.changesets/feat-stlib-constexpr-instanceof().md @@ -0,0 +1,2 @@ +release: minor +summary: It is just a one word change, makes it possible to use `Board::instanceof()` to get a `constexpr auto& obj`. It works perfectly as long as you don't try using the reference before `Board::init()`. \ No newline at end of file From e376fb38e4c6c697b23a5405a94175bd8e0fb965 Mon Sep 17 00:00:00 2001 From: FoniksFox Date: Sat, 9 May 2026 00:52:23 +0200 Subject: [PATCH 3/3] style: Wtf, stupid style --- .changesets/feat-stlib-constexpr-instanceof().md | 2 +- CHANGELOG.md | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.changesets/feat-stlib-constexpr-instanceof().md b/.changesets/feat-stlib-constexpr-instanceof().md index 8a08f11e6..68dadfed4 100644 --- a/.changesets/feat-stlib-constexpr-instanceof().md +++ b/.changesets/feat-stlib-constexpr-instanceof().md @@ -1,2 +1,2 @@ release: minor -summary: It is just a one word change, makes it possible to use `Board::instanceof()` to get a `constexpr auto& obj`. It works perfectly as long as you don't try using the reference before `Board::init()`. \ No newline at end of file +summary: It is just a one word change, makes it possible to use `Board::instanceof()` to get a `constexpr auto& obj`. It works perfectly as long as you don't try using the reference before `Board::init()`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f37bf6b3..adea158ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,18 +12,18 @@ Historical releases that predate this file remain available in Git tags such as - Redesign fault handling, protections, and Board bootstrap around explicit fault policies This PR changes the public integration contract for applications built on ST-LIB. - + Breaking changes: - + - `Board` now takes the fault policy type as its first template parameter. - The global `FAULT` runtime is owned exclusively by `FaultController`. - User state machines are now nested under the global `OPERATIONAL` state through `FaultPolicy` or `FaultPolicyNoMachine`. - Protections are now compile-time `Board` request objects evaluated through `Board::ProtectionEngine`; the previous `ProtectionManager` and boundary split is no longer the active model. - Runtime reporting is unified under `PANIC(...)`, `FAULT(...)`, `WARNING(...)`, and `INFO(...)`. - The real bootstrap path is `Board::init()`. Legacy `STLIB::start()`, `STLIB::update()`, `STLIB_LOW::start()`, and `STLIB_HIGH::start()` must not be used as the integration path. - + Migration notes: - + - Declare the board as `Board`. - Use `FaultPolicy` when you want an operational state machine nested under the global runtime. - Use `FaultPolicyNoMachine` when you only need a fault-entry callback. @@ -39,7 +39,7 @@ Historical releases that predate this file remain available in Git tags such as timerwrapper: - Add `set_callback(void (*callback)(void*), void* callback_data)` to set the callback and its data instead of needing to call `configurexxbit()` and set the period. - `set_limit_value(uint32_t arr)` to set the arr, this will likely be changed to use a `uint32_t` type only when using a 32 bit timer, for now it is just an alias to `instance->tim->ARR = arr;`. Was not added in this pr but also wasn't mentioned before. - + spi: - Add `transceive` with ptr + data explicitly instead of using a span since it's sometimes a pain in the ass to use.