Add // comments to all use statements in driver .rs files

- Add // comments above top-level use imports in uart.rs, blink.rs, button.rs
- Add // comments above test module use imports (use super::*, Infallible,
  ErrorType) in all 8 driver .rs files
- All 8 drivers build, all 75 tests pass
This commit is contained in:
Kevin Thomas
2026-03-25 18:54:19 -04:00
parent 450f84ef75
commit 0b207fd8b4
8 changed files with 21 additions and 0 deletions

View File

@@ -25,12 +25,19 @@
//! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//! SOFTWARE.
// Rate extension trait for .Hz() baud rate construction
use fugit::RateExtU32;
// Non-blocking I/O helper for UART read/write
use nb::block;
// Alias our HAL crate
use rp235x_hal as hal;
// Clock trait for accessing system clock frequency
use hal::Clock;
// UART configuration and peripheral types
use hal::uart::{DataBits, Enabled, StopBits, UartConfig, UartPeripheral};
// GPIO pin types and function selectors
use hal::gpio::{FunctionNull, FunctionUart, Pin, PullDown, PullNone};
// UART0 peripheral singleton type
use hal::pac::UART0;
/// Type alias for the configured TX pin (GPIO 0, UART function, no pull).
@@ -158,6 +165,7 @@ impl UartDriver {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]

View File

@@ -25,6 +25,7 @@
//! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//! SOFTWARE.
// Embedded HAL digital output traits for GPIO pin control
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
/// GPIO output / LED blink driver that owns a single output pin.
@@ -95,8 +96,11 @@ impl<P: OutputPin + StatefulOutputPin> BlinkDriver<P> {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
// Infallible error type for mock pin implementations
use core::convert::Infallible;
// Error type trait for mock pin implementations
use embedded_hal::digital::ErrorType;
struct MockPin {

View File

@@ -25,6 +25,7 @@
//! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//! SOFTWARE.
// Embedded HAL digital I/O traits for GPIO pin control
use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin};
/// Push-button GPIO input driver with debounce.
@@ -123,8 +124,11 @@ impl<L: OutputPin + StatefulOutputPin> ButtonLed<L> {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
// Infallible error type for mock pin implementations
use core::convert::Infallible;
// Error type trait for mock pin implementations
use embedded_hal::digital::ErrorType;
struct MockInputPin {

View File

@@ -79,6 +79,7 @@ pub fn duty_to_level(percent: u8, wrap: u32) -> u32 {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]

View File

@@ -124,6 +124,7 @@ pub fn calc_clk_div(sys_hz: u32, servo_hz: f32, wrap: u32) -> f32 {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]

View File

@@ -65,6 +65,7 @@ pub fn raw_to_celsius(raw: u16) -> f32 {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]

View File

@@ -116,6 +116,7 @@ pub fn format_scan_entry(buf: &mut [u8], addr: u8, found: bool) -> usize {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]

View File

@@ -130,6 +130,7 @@ pub fn format_counter(buf: &mut [u8], count: u32) -> usize {
#[cfg(test)]
mod tests {
// Import all parent module items
use super::*;
#[test]