From 8d2d31fa429881e6319983ad6711bb2c0288a5de Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sun, 2 Jul 2023 11:22:59 +0200 Subject: [PATCH] Code cleanup --- rp2040/src/main.rs | 8 +++++--- rp2040/src/status_led.rs | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/rp2040/src/main.rs b/rp2040/src/main.rs index a2d2cca..94776c0 100644 --- a/rp2040/src/main.rs +++ b/rp2040/src/main.rs @@ -1,6 +1,8 @@ -// TODO: Add license header -// TODO: Add documentation header -// TODO: GUI lock button support +// Project: CMtec CMDR Keyboard 42 +// Date: 2023-07-01 +// Author: Christoffer Martinsson +// Email: cm@cmtec.se +// License: Please refer to LICENSE in root directory #![no_std] #![no_main] diff --git a/rp2040/src/status_led.rs b/rp2040/src/status_led.rs index cf41da5..d5eddc6 100644 --- a/rp2040/src/status_led.rs +++ b/rp2040/src/status_led.rs @@ -6,6 +6,14 @@ use smart_leds::{SmartLedsWrite, RGB8}; use ws2812_pio::Ws2812Direct; /// 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)] pub enum StatusMode { OFF = 0, @@ -17,6 +25,19 @@ pub enum StatusMode { 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 where I: PinId,