43 lines
1.6 KiB
Rust
43 lines
1.6 KiB
Rust
#![cfg_attr(not(feature = "std"), no_std)]
|
|
|
|
//! CMDR Joystick 25 firmware library for RP2040.
|
|
//!
|
|
//! This crate provides the reusable building blocks that power the main
|
|
//! firmware: axis processing, button handling, calibration and storage, USB
|
|
//! HID reporting, and hardware/status abstractions.
|
|
|
|
/// Axis processing for gimbal and virtual axes (smoothing, expo, holds).
|
|
pub mod axis;
|
|
/// Row/column scanned button matrix driver with debouncing.
|
|
pub mod button_matrix;
|
|
/// Button state machine (short/long press, timing, special actions).
|
|
pub mod buttons;
|
|
/// Calibration workflow and persistence orchestration.
|
|
pub mod calibration;
|
|
/// Exponential response curves and helpers.
|
|
pub mod expo;
|
|
/// Hardware constants, pin definitions, timing, and helper macros.
|
|
pub mod hardware;
|
|
/// Button-to-USB mapping tables and HAT constants.
|
|
pub mod mapping;
|
|
/// WS2812 status LED driver and status model.
|
|
pub mod status;
|
|
/// EEPROM storage layout and read/write helpers.
|
|
pub mod storage;
|
|
/// USB HID joystick descriptor and writer.
|
|
pub mod usb_joystick_device;
|
|
/// Convert runtime state into USB HID joystick reports.
|
|
pub mod usb_report;
|
|
|
|
/// Re-exports for convenient access in `main` and downstream consumers.
|
|
pub use axis::{AxisManager, GimbalAxis, VirtualAxis};
|
|
pub use calibration::CalibrationManager;
|
|
pub use expo::{apply_expo_curve, constrain, generate_expo_lut, ExpoLUT};
|
|
pub use storage::{read_axis_calibration, read_gimbal_mode, write_calibration_data, StorageError};
|
|
pub use usb_report::{axis_12bit_to_i16, get_joystick_report};
|
|
|
|
/// Common ADC range constants used across modules.
|
|
pub const ADC_MIN: u16 = 0;
|
|
pub const ADC_MAX: u16 = 4095;
|
|
pub const AXIS_CENTER: u16 = ADC_MAX / 2;
|