//! Send random raw data to the display, emulating an old untuned TV. This example retrieves the //! underlying display properties struct and allows calling of the low-level `draw()` method, //! sending a 1024 byte buffer straight to the display. //! //! This example is for the STM32F103 "Blue Pill" board using I2C1. //! //! Wiring connections are as follows for a CRIUS-branded display: //! //! ``` //! Display -> Blue Pill //! (black) GND -> GND //! (red) +5V -> VCC //! (yellow) SDA -> PB7 //! (green) SCL -> PB6 //! ``` //! //! Run on a Blue Pill with `cargo run --example noise_i2c`. Best results when using `--release`. #![no_std] #![no_main] use cortex_m_rt::entry; use defmt_rtt as _; use embassy_stm32::time::Hertz; use panic_probe as _; use rand::prelude::*; use ssd1306::{prelude::*, I2CDisplayInterface, Ssd1306}; #[entry] fn main() -> ! { let p = embassy_stm32::init(Default::default()); let i2c = embassy_stm32::i2c::I2c::new_blocking( p.I2C1, p.PB6, p.PB7, Hertz::khz(400), Default::default(), ); let interface = I2CDisplayInterface::new(i2c); let mut display = Ssd1306::new(interface, DisplaySize128x64, DisplayRotation::Rotate0); display.init().unwrap(); let mut buf = [0x00u8; 1024]; let mut rng = SmallRng::seed_from_u64(0xdead_beef_cafe_d00d); loop { rng.fill_bytes(&mut buf); display.draw(&buf).unwrap(); } }