Skip to main content

hsm_firmware_logic/
lib.rs

1// Copyright (c) 2026 Tuloup Simon
2//
3// This program is free software: you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program. If not, see <https://www.gnu.org/licenses/>.
15
16//! Host-testable logic for the mini-HSM firmware.
17//!
18//! This crate exists so the parts of the firmware that are pure logic
19//! (state machine, debouncer, LED/button abstractions) can be unit-tested
20//! on the host. The firmware binary depends on this crate and supplies
21//! the hardware-facing trait impls in `hsm-firmware/src/hal_rp2040.rs`.
22
23#![cfg_attr(not(test), no_std)]
24#![deny(missing_docs)]
25#![deny(unsafe_code)]
26#![warn(clippy::pedantic)]
27
28pub mod io;
29pub(crate) mod state_machine;
30
31pub use io::{Button, Debouncer, Led, DEBOUNCE_STABLE_SAMPLES};
32pub use state_machine::{Event, LedPattern, TokenState, ERROR_DISPLAY_MS, TOUCH_TIMEOUT_MS};