Updated documentation. Renamed to only CMDR Joystick
This commit is contained in:
parent
1799f765dc
commit
d937f4b256
4
Justfile
4
Justfile
@ -10,8 +10,8 @@ test:
|
|||||||
|
|
||||||
build-uf2:
|
build-uf2:
|
||||||
cd rp2040 && cargo build --release --target thumbv6m-none-eabi
|
cd rp2040 && cargo build --release --target thumbv6m-none-eabi
|
||||||
cd rp2040 && cargo objcopy --release --target thumbv6m-none-eabi -- -O binary target/thumbv6m-none-eabi/release/cmdr-joystick-25.bin
|
cd rp2040 && cargo objcopy --release --target thumbv6m-none-eabi -- -O binary target/thumbv6m-none-eabi/release/cmdr-joystick.bin
|
||||||
cd rp2040 && python3 uf2conv.py target/thumbv6m-none-eabi/release/cmdr-joystick-25.bin --base 0x10000000 --family 0xe48bff56 --convert --output target/firmware.uf2
|
cd rp2040 && python3 uf2conv.py target/thumbv6m-none-eabi/release/cmdr-joystick.bin --base 0x10000000 --family 0xe48bff56 --convert --output target/firmware.uf2
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cargo clean --manifest-path rp2040/Cargo.toml
|
cargo clean --manifest-path rp2040/Cargo.toml
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
# CMDR Joystick 25
|
# CMDR Joystick
|
||||||
|
|
||||||
USB HID joystick firmware + hardware: 2 hall‑effect gimbals, 2 physical hat
|
USB HID joystick firmware + hardware: 2 hall‑effect gimbals, 2 physical hat
|
||||||
switches, and a 5x5 button matrix (plus 2 extra buttons). The firmware exposes
|
switches, and a 5x5 button matrix (plus 2 extra buttons). The firmware exposes
|
||||||
@ -111,7 +111,7 @@ Config Layer (holding CONFIG button)
|
|||||||
- 1x Bottom case (3D printed)
|
- 1x Bottom case (3D printed)
|
||||||
- 1x Top plate (3D printed)
|
- 1x Top plate (3D printed)
|
||||||
- 2x Hat swith top (3D printed) [stl](/mCAD/Hat_Castle_Short_scale_99_99_130.stl)
|
- 2x Hat swith top (3D printed) [stl](/mCAD/Hat_Castle_Short_scale_99_99_130.stl)
|
||||||
- 1x Custom PCB (CMDR Joystick 25 rev A)
|
- 1x Custom PCB (CMDR Joystick rev A)
|
||||||
- 
|
- 
|
||||||
- 
|
- 
|
||||||
- Gerber files: [zip](/eCAD/cmdr-joystick/cmdr-joystick_rev_a_gerber.zip)
|
- Gerber files: [zip](/eCAD/cmdr-joystick/cmdr-joystick_rev_a_gerber.zip)
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cmdr-joystick-25"
|
name = "cmdr-joystick"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
# Firmware crate for the CMDR Joystick 25 (RP2040)
|
# Firmware crate for the CMDR Joystick (RP2040)
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Core embedded + RP2040 HAL stack (aligned with rp2040-hal v0.11)
|
# Core embedded + RP2040 HAL stack (aligned with rp2040-hal v0.11)
|
||||||
@ -65,7 +65,7 @@ overflow-checks = false
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "cmdr-joystick-25"
|
name = "cmdr-joystick"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
bench = false
|
bench = false
|
||||||
test = false
|
test = false
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Axis processing for CMDR Joystick 25
|
//! Axis processing for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Responsibilities
|
//! Responsibilities
|
||||||
//! - Apply gimbal mode compensation (M10/M7) to raw ADC readings
|
//! - Apply gimbal mode compensation (M10/M7) to raw ADC readings
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
//! Board bring-up and peripheral wiring for the CMDR Joystick firmware.
|
||||||
|
|
||||||
use crate::button_matrix::{ButtonMatrix, MatrixPins};
|
use crate::button_matrix::{ButtonMatrix, MatrixPins};
|
||||||
use crate::hardware::{self, BoardPins};
|
use crate::hardware::{self, BoardPins};
|
||||||
use crate::status::StatusLed;
|
use crate::status::StatusLed;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Button matrix scanner for CMDR Joystick 25.
|
//! Button matrix scanner for CMDR Joystick.
|
||||||
//!
|
//!
|
||||||
//! Mirrors the refactor performed for the keyboard firmware: the matrix owns
|
//! Mirrors the refactor performed for the keyboard firmware: the matrix owns
|
||||||
//! concrete pins, exposes a small `MatrixPinAccess` trait, and keeps the
|
//! concrete pins, exposes a small `MatrixPinAccess` trait, and keeps the
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Button processing for CMDR Joystick 25
|
//! Button processing for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Responsibilities
|
//! Responsibilities
|
||||||
//! - Integrate button matrix results and extra pins
|
//! - Integrate button matrix results and extra pins
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Calibration management for CMDR Joystick 25
|
//! Calibration management for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Responsibilities
|
//! Responsibilities
|
||||||
//! - Manage the calibration lifecycle (start/active/stop)
|
//! - Manage the calibration lifecycle (start/active/stop)
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Hardware configuration for CMDR Joystick 25 (RP2040)
|
//! Hardware configuration for CMDR Joystick (RP2040)
|
||||||
//!
|
//!
|
||||||
//! Mirrors the structure introduced for the CMDR Keyboard firmware so that
|
//! Mirrors the structure introduced for the CMDR Keyboard firmware so that
|
||||||
//! bring-up, pin management, and timing constants follow the same layout.
|
//! bring-up, pin management, and timing constants follow the same layout.
|
||||||
@ -37,7 +37,7 @@ pub const EEPROM_DATA_LENGTH: usize = 25;
|
|||||||
/// USB string descriptors.
|
/// USB string descriptors.
|
||||||
pub mod usb {
|
pub mod usb {
|
||||||
pub const MANUFACTURER: &str = "CMtec";
|
pub const MANUFACTURER: &str = "CMtec";
|
||||||
pub const PRODUCT: &str = "CMDR Joystick 25";
|
pub const PRODUCT: &str = "CMDR Joystick";
|
||||||
pub const SERIAL_NUMBER: &str = "0001";
|
pub const SERIAL_NUMBER: &str = "0001";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Runtime state for the CMDR Joystick 25.
|
//! Runtime state for the CMDR Joystick.
|
||||||
//!
|
//!
|
||||||
//! This mirrors the `KeyboardState` abstraction from the keyboard refactor and
|
//! This mirrors the `KeyboardState` abstraction from the keyboard refactor and
|
||||||
//! concentrates axis/button/calibration logic alongside USB bookkeeping.
|
//! concentrates axis/button/calibration logic alongside USB bookkeeping.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
//! CMDR Joystick 25 firmware library for RP2040.
|
//! CMDR Joystick firmware library for RP2040.
|
||||||
//!
|
//!
|
||||||
//! This crate provides the reusable building blocks that power the main
|
//! This crate provides the reusable building blocks that power the main
|
||||||
//! firmware: axis processing, button handling, calibration and storage, USB
|
//! firmware: axis processing, button handling, calibration and storage, USB
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
|
//! Firmware entry orchestrating the CMDR Joystick runtime loop.
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
|
|
||||||
use cmdr_joystick_25::buttons::SpecialAction;
|
use cmdr_joystick::buttons::SpecialAction;
|
||||||
use cmdr_joystick_25::hardware::{self, timers};
|
use cmdr_joystick::hardware::{self, timers};
|
||||||
use cmdr_joystick_25::status::StatusMode;
|
use cmdr_joystick::status::StatusMode;
|
||||||
use cmdr_joystick_25::usb_joystick_device::JoystickConfig;
|
use cmdr_joystick::usb_joystick_device::JoystickConfig;
|
||||||
use cmdr_joystick_25::{bootloader, Board, BoardParts, JoystickState};
|
use cmdr_joystick::{bootloader, Board, BoardParts, JoystickState};
|
||||||
use embedded_hal_0_2::adc::OneShot;
|
use embedded_hal_0_2::adc::OneShot;
|
||||||
use embedded_hal_0_2::timer::CountDown;
|
use embedded_hal_0_2::timer::CountDown;
|
||||||
use fugit::ExtU32;
|
use fugit::ExtU32;
|
||||||
@ -13,8 +14,8 @@ use panic_halt as _;
|
|||||||
use usb_device::prelude::*;
|
use usb_device::prelude::*;
|
||||||
use usbd_human_interface_device::prelude::{UsbHidClassBuilder, UsbHidError};
|
use usbd_human_interface_device::prelude::{UsbHidClassBuilder, UsbHidError};
|
||||||
|
|
||||||
#[unsafe(link_section = ".boot2")]
|
#[link_section = ".boot2"]
|
||||||
#[unsafe(no_mangle)]
|
#[no_mangle]
|
||||||
#[used]
|
#[used]
|
||||||
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
pub static BOOT2_FIRMWARE: [u8; 256] = rp2040_boot2::BOOT_LOADER_W25Q080;
|
||||||
|
|
||||||
@ -74,6 +75,7 @@ fn main() -> ! {
|
|||||||
usb_tick.start(timers::USB_UPDATE_INTERVAL_MS.millis());
|
usb_tick.start(timers::USB_UPDATE_INTERVAL_MS.millis());
|
||||||
|
|
||||||
let mut status_time_ms: u32 = 0;
|
let mut status_time_ms: u32 = 0;
|
||||||
|
let mut suspended_scan_counter: u8 = 0;
|
||||||
|
|
||||||
// Main control loop: service USB, process inputs, and emit reports.
|
// Main control loop: service USB, process inputs, and emit reports.
|
||||||
loop {
|
loop {
|
||||||
@ -93,12 +95,10 @@ fn main() -> ! {
|
|||||||
|
|
||||||
// Slow the scan cadence when USB is suspended to save power.
|
// Slow the scan cadence when USB is suspended to save power.
|
||||||
let should_scan = if state.usb_state().suspended {
|
let should_scan = if state.usb_state().suspended {
|
||||||
static mut SUSPENDED_SCAN_COUNTER: u8 = 0;
|
suspended_scan_counter = suspended_scan_counter.wrapping_add(1) % 10;
|
||||||
unsafe {
|
suspended_scan_counter == 0
|
||||||
SUSPENDED_SCAN_COUNTER = (SUSPENDED_SCAN_COUNTER + 1) % 10;
|
|
||||||
SUSPENDED_SCAN_COUNTER == 0
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
suspended_scan_counter = 0;
|
||||||
true
|
true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! Button-to-USB mapping for CMDR Joystick 25
|
//! Button-to-USB mapping for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! This module defines the hardware button indices (matrix layout and extras)
|
//! This module defines the hardware button indices (matrix layout and extras)
|
||||||
//! and their mapping to USB joystick button numbers and HAT directions.
|
//! and their mapping to USB joystick button numbers and HAT directions.
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! WS2812 status LED driver for CMDR Joystick 25
|
//! WS2812 status LED driver for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Provides a small helper around `ws2812_pio` to display firmware state on a
|
//! Provides a small helper around `ws2812_pio` to display firmware state on a
|
||||||
//! single WS2812 RGB LED using RP2040 PIO. The driver offers simple modes
|
//! single WS2812 RGB LED using RP2040 PIO. The driver offers simple modes
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! EEPROM storage for CMDR Joystick 25
|
//! EEPROM storage for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Provides helpers to read/write per‑axis calibration and gimbal mode to an
|
//! Provides helpers to read/write per‑axis calibration and gimbal mode to an
|
||||||
//! external 24x‑series EEPROM. The API is closure‑based to allow testing on
|
//! external 24x‑series EEPROM. The API is closure‑based to allow testing on
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
//! USB HID report generation for CMDR Joystick 25
|
//! USB HID report generation for CMDR Joystick
|
||||||
//!
|
//!
|
||||||
//! Converts processed axis values and button states into a `JoystickReport`
|
//! Converts processed axis values and button states into a `JoystickReport`
|
||||||
//! that matches the HID descriptor defined in `usb_joystick_device.rs`.
|
//! that matches the HID descriptor defined in `usb_joystick_device.rs`.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user