Code cleanup

This commit is contained in:
Christoffer Martinsson 2023-07-02 11:22:59 +02:00
parent 967d544bbc
commit 8d2d31fa42
2 changed files with 26 additions and 3 deletions

View File

@ -1,6 +1,8 @@
// TODO: Add license header // Project: CMtec CMDR Keyboard 42
// TODO: Add documentation header // Date: 2023-07-01
// TODO: GUI lock button support // Author: Christoffer Martinsson
// Email: cm@cmtec.se
// License: Please refer to LICENSE in root directory
#![no_std] #![no_std]
#![no_main] #![no_main]

View File

@ -6,6 +6,14 @@ use smart_leds::{SmartLedsWrite, RGB8};
use ws2812_pio::Ws2812Direct; use ws2812_pio::Ws2812Direct;
/// Status LED modes /// Status LED modes
///
/// * OFF = Syatem offline
/// * OK = All system Ok
/// * ACTIVE1 = System active 1
/// * ACTIVE2 = System active 2
/// * WARNING = Warning
/// * ERROR = Error
/// * BOOTLOADER = Bootloader active
#[derive(PartialEq, Eq, Copy, Clone)] #[derive(PartialEq, Eq, Copy, Clone)]
pub enum StatusMode { pub enum StatusMode {
OFF = 0, OFF = 0,
@ -17,6 +25,19 @@ pub enum StatusMode {
BOOTLOADER = 6, BOOTLOADER = 6,
} }
/// Status LED driver
/// This driver uses the PIO state machine to drive a WS2812 LED
///
/// # Example
///
/// ```
/// let mut status_led = Ws2812StatusLed::new(
/// pins.neopixel.into_mode(),
/// &mut pio,
/// sm0,
/// clocks.peripheral_clock.freq(),
/// );
/// ```
pub struct Ws2812StatusLed<P, SM, I> pub struct Ws2812StatusLed<P, SM, I>
where where
I: PinId, I: PinId,