#[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)]
pub struct LcdTextGenerated;
#[cfg(doc)]
use crate::Result;
#[cfg(doc)]
pub struct I2csGenerated;
#[cfg(doc)]
pub struct LcdTextGenerated20x4;
#[cfg(doc)]
impl I2csGenerated {
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 {
pub const WIDTH: usize = 16;
pub const HEIGHT: usize = 2;
pub const ADDRESS: u8 = 0x27;
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 {
pub const WIDTH: usize = 20;
pub const HEIGHT: usize = 4;
pub const ADDRESS: u8 = 0x3F;
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;
}
}