Skip to content

Commit

Permalink
Shorter command creation
Browse files Browse the repository at this point in the history
  • Loading branch information
lukipuki committed Nov 16, 2024
1 parent 0377486 commit 977f46a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nrf52840/src/at_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use embassy_nrf::uarte::{UarteRxWithIdle, UarteTx};
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
use embassy_sync::channel::Channel;
use embassy_time::{with_deadline, Duration, Instant};
use heapless::{String, Vec};
use heapless::{format, String, Vec};

use crate::error::Error;

Expand Down Expand Up @@ -239,8 +239,7 @@ impl AtUart {
}

async fn write(&mut self, command: &str) -> Result<(), Error> {
let mut command: String<AT_COMMAND_SIZE> = String::try_from(command).unwrap();
command.push('\r').unwrap();
let command = format!(AT_COMMAND_SIZE; "{command}\r").unwrap();

self.tx
.write(command.as_bytes())
Expand Down

0 comments on commit 977f46a

Please sign in to comment.