5 releases
Uses new Rust 2024
| 0.2.0 | Oct 24, 2025 |
|---|---|
| 0.1.3 | Feb 5, 2024 |
| 0.1.2 | Jan 28, 2024 |
| 0.1.1 | Jan 25, 2024 |
| 0.1.0 | Jan 22, 2024 |
#473 in Hardware support
174 downloads per month
37KB
765 lines
Utilities for M5Stack Cardputer and Cardputer-Adv
Features
- Initialize ST7789 driver
- LCD backlight control
- Decode 74HC138 and convert to keycode
- Initialize I2C driver for Grove I/F
- Key event capture for Cardputer-Adv keyboard
Usage
Dependencies:
[dependencies]
cardputer = "0.2"
Code:
use cardputer::keyboard::Keyboard;
let peripherals = Peripherals::take().unwrap();
let mut keyboard = Keyboard::new(
peripherals.pins.gpio8,
peripherals.pins.gpio9,
peripherals.pins.gpio11,
peripherals.pins.gpio13,
peripherals.pins.gpio15,
peripherals.pins.gpio3,
peripherals.pins.gpio4,
peripherals.pins.gpio5,
peripherals.pins.gpio6,
peripherals.pins.gpio7,
)
.unwrap();
let mut keyboard_state = KeyboardState::default();
keyboard_state.update(&mut keyboard).unwrap();
let keys = keyboard_state.pressed_keys();
Examples
Simple example that just outputs the pressed keys to log:info
% cargo run --example key_monitor
:
I (2642) key_monitor: [Q]
I (3142) key_monitor: [W]
I (3642) key_monitor: [E]
I (4142) key_monitor: [R]
I (4642) key_monitor: [T]
I (5142) key_monitor: [Y]
I (5642) key_monitor: [Space]
:
Dependencies
~7–12MB
~225K SLoC