Skip to main content

consortium_hmi_input/
lib.rs

1// Copyright 2026 Ethan Wu
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// SPDX-License-Identifier: Apache-2.0
16
17#![cfg_attr(not(test), no_std)]
18
19//! Backend-neutral input event model for Consortium HMI runtimes.
20//!
21//! HMI backends (`consortium-hmi-pocket`, and later a WebKit adapter) and the
22//! event *sources* that drive them speak different concrete APIs — winit on a
23//! desktop, `libinput`/`evdev` on a Linux kiosk, `embedded-hal` drivers on a
24//! bare-metal core, or a Consortium IPC channel carrying events from a
25//! real-time core. This crate is the neutral middle: a single [`InputEvent`]
26//! type expressed in **logical UI coordinates**, plus a pull-based
27//! [`InputSource`] contract that every source implements.
28//!
29//! [`InputEvent`] derives [`consortium_ipc::IpcSafe`] and `serde`, so a
30//! real-time core can serialize events with a Consortium codec and forward
31//! them across IPC to a Linux HMI host exactly like any other cross-core
32//! message. The type is `no_std` and allocation-free, so the same definition
33//! compiles for firmware and for the Linux host.
34
35mod event;
36mod source;
37
38pub use event::{ButtonCode, InputEvent, PointerButton, ScrollAxis, TouchPhase};
39pub use source::{InputSource, SliceSource};