esp-hal/esp32c6-lp-hal/examples/uart.rs
Juraj Sadel bc96351c17
C6: Basic LP_UART driver (#1113)
* WIP

* Add basic LP_UART C6 driver

* Add lp-uart example for C6

* modify entry macro and fmt

* final cleanups

* revert lp_core_basic example and add lp_core_uart and uart examples

* changelog

* review changes

* second changelog

---------

Co-authored-by: Jesse Braham <jesse@beta7.io>
2024-01-25 16:22:14 +00:00

24 lines
661 B
Rust

//! Uses `LP_UART` and logs "Hello World from LP Core".
//! Uses GPIO4 for RX and GPIO5 for TX. GPIOs can't be changed.
//! It is neccessary to use Serial-Uart bridge connected to TX and RX to see
//! logs from LP_UART. Make sure the LP RAM is cleared before loading the code.
#![no_std]
#![no_main]
use core::fmt::Write;
use esp32c6_lp_hal::{delay::Delay, prelude::*, uart::LpUart};
use panic_halt as _;
#[entry]
fn main(mut uart: LpUart) -> ! {
let _peripherals = esp32c6_lp::Peripherals::take().unwrap();
let mut delay = Delay::new();
loop {
writeln!(uart, "Hello World from LP Core").unwrap();
delay.delay_ms(1500);
}
}