device-envoy-rp 0.1.0

Build Pico applications with LED panels, easy Wi-Fi, and composable device abstractions
Documentation
// @generated by `cargo check-all`. Do not edit by hand.
//! Module containing generated LCD text sample types.
//!
//! Auto-generated.

#[cfg(all(not(doc), not(feature = "host")))]
use crate::i2cs;

#[cfg(all(not(doc), not(feature = "host")))]
i2cs! {
    i2c: I2C0,
    sda_pin: PIN_4,
    scl_pin: PIN_5,
    pub I2csGenerated {
        pub LcdTextGenerated { width: 16, height: 2, address: 0x27 },
        pub LcdTextGenerated20x4 { width: 20, height: 4, address: 0x3F },
    }
}

#[cfg(doc)]
/// Sample struct type generated by the [`i2cs!`](macro@crate::i2cs) macro.
///
/// This page exists to show constructor and methods in one place.
/// For narrative examples, see the [`lcd_text`](mod@crate::lcd_text) module.
///
/// Auto-generated.
pub struct LcdTextGenerated;

#[cfg(doc)]
use crate::Result;

#[cfg(doc)]
/// Sample I2C LCD group type generated by [`i2cs!`](macro@crate::i2cs).
pub struct I2csGenerated;

#[cfg(doc)]
/// Sample LCD text struct type generated by [`i2cs!`](macro@crate::i2cs).
pub struct LcdTextGenerated20x4;

#[cfg(doc)]
impl I2csGenerated {
    /// Construct all generated LCD text devices in this group.
    /// See the [`lcd_text` module documentation](mod@crate::lcd_text) for usage examples.
    pub fn new(
        i2c_peripheral: embassy_rp::Peri<'static, embassy_rp::peripherals::I2C0>,
        sda: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_4>,
        scl: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_5>,
        spawner: embassy_executor::Spawner,
    ) -> Result<(&'static LcdTextGenerated, &'static LcdTextGenerated20x4)> {
        static INSTANCE_16X2: LcdTextGenerated = LcdTextGenerated;
        static INSTANCE_20X4: LcdTextGenerated20x4 = LcdTextGenerated20x4;
        let _ = (i2c_peripheral, sda, scl, spawner);
        Ok((&INSTANCE_16X2, &INSTANCE_20X4))
    }
}

#[cfg(doc)]
impl LcdTextGenerated {
    /// Display width in characters.
    pub const WIDTH: usize = 16;
    /// Display height in characters.
    pub const HEIGHT: usize = 2;
    /// LCD I2C address.
    pub const ADDRESS: u8 = 0x27;

    /// Create this generated LCD text instance.
    /// See the [`lcd_text` module documentation](mod@crate::lcd_text) for usage examples.
    pub fn new(
        i2c_peripheral: embassy_rp::Peri<'static, embassy_rp::peripherals::I2C0>,
        sda: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_4>,
        scl: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_5>,
        spawner: embassy_executor::Spawner,
    ) -> Result<&'static Self> {
        static INSTANCE: LcdTextGenerated = LcdTextGenerated;
        let _ = (i2c_peripheral, sda, scl, spawner);
        Ok(&INSTANCE)
    }
}

#[cfg(doc)]
impl crate::lcd_text::LcdText<16, 2> for LcdTextGenerated {
    const ADDRESS: u8 = 0x27;

    fn write_text(&self, text: impl AsRef<str>) {
        let _ = text;
    }
}

#[cfg(doc)]
impl LcdTextGenerated20x4 {
    /// Display width in characters.
    pub const WIDTH: usize = 20;
    /// Display height in characters.
    pub const HEIGHT: usize = 4;
    /// LCD I2C address.
    pub const ADDRESS: u8 = 0x3F;

    /// Create this generated LCD text instance.
    /// See the [`lcd_text` module documentation](mod@crate::lcd_text) for usage examples.
    pub fn new(
        i2c_peripheral: embassy_rp::Peri<'static, embassy_rp::peripherals::I2C0>,
        sda: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_4>,
        scl: embassy_rp::Peri<'static, embassy_rp::peripherals::PIN_5>,
        spawner: embassy_executor::Spawner,
    ) -> Result<&'static Self> {
        static INSTANCE: LcdTextGenerated20x4 = LcdTextGenerated20x4;
        let _ = (i2c_peripheral, sda, scl, spawner);
        Ok(&INSTANCE)
    }
}

#[cfg(doc)]
impl crate::lcd_text::LcdText<20, 4> for LcdTextGenerated20x4 {
    const ADDRESS: u8 = 0x3F;

    fn write_text(&self, text: impl AsRef<str>) {
        let _ = text;
    }
}