Print AT responses to screen

This commit is contained in:
Sofia 2026-05-16 21:12:50 +03:00
parent f5e2775a04
commit d03b00e3f0

View File

@ -103,26 +103,10 @@ fn main() -> ! {
});
display.set_tearing(display::TearingMode::Off);
display.draw_rect(
Position::new(0, 0),
Position::new(32, 32),
Rgb565::yellow().as_color(),
);
let font_renderer = FontRenderer::create(30);
font_renderer.render(
&mut display,
"Hello\nWorld!",
Position::new(0, 0),
HorizontalAlignment::LeftToRight,
VerticalAlignment::TopToBottom,
Rgb565::black(),
Rgb565::white(),
);
let sim_rst = Output::new(peripherals.GPIO15, Level::High, OutputConfig::default());
let sim_pwr_key = Output::new(peripherals.GPIO33, Level::High, OutputConfig::default());
let sim_rst = Output::new(peripherals.GPIO27, Level::High, OutputConfig::default());
let sim_pwr_key = Output::new(peripherals.GPIO12, Level::High, OutputConfig::default());
let uart = Uart::new(
peripherals.UART2,
@ -143,20 +127,44 @@ fn main() -> ! {
delay: Delay::new(),
};
// at_commands.init();
// log::info!("{}", at_commands.raw_command("ATI".to_owned()));
// log::info!("{}", at_commands.raw_command("AT+CMGF?".to_owned()));
// log::info!("{}", at_commands.raw_command("AT+CPIN=1234".to_owned()));
// log::info!("{}", at_commands.raw_command("AT+CPIN?".to_owned()));
// log::info!("{}", at_commands.raw_command("AT+CMGF=1".to_owned()));
// log::info!("{}", at_commands.raw_command("AT+CSCS=?".to_owned()));
font_renderer.render(
&mut display,
"Hello\nWorld!",
Position::new(0, 0),
HorizontalAlignment::LeftToRight,
VerticalAlignment::TopToBottom,
Rgb565::black(),
Rgb565::white(),
);
// log::info!(
// "{}",
// at_commands.raw_two_part_command(
// "AT+CMGS=\"number\"".to_owned(),
// "hello".to_owned()
// )
let mut render_response = |response: alloc::string::String| {
log::info!("Rendering: {}", response);
display.draw_rect(
Position::new(0, 0),
Position::new(240, 240),
Rgb565::black().as_color(),
);
font_renderer.render(
&mut display,
response,
Position::new(0, 0),
HorizontalAlignment::LeftToRight,
VerticalAlignment::TopToBottom,
Rgb565::black(),
Rgb565::white(),
);
};
at_commands.init();
render_response(at_commands.raw_command("ATI".to_owned()));
render_response(at_commands.raw_command("AT+CMGF?".to_owned()));
render_response(at_commands.raw_command("AT+CPIN=1234".to_owned()));
render_response(at_commands.raw_command("AT+CPIN?".to_owned()));
render_response(at_commands.raw_command("AT+CMGF=1".to_owned()));
render_response(at_commands.raw_command("AT+CSCS=?".to_owned()));
// render_response(
// at_commands.raw_two_part_command("AT+CMGS=\"number\"".to_owned(), "hello".to_owned()),
// );
let pull_down_cfg = InputConfig::default().with_pull(esp_hal::gpio::Pull::None);