Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions cross/send_data_tcp/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,7 @@ fn main() -> ! {
mode,
&mut delay,
&mut |tcp_client| {
defmt::info!(
"TCP connection to {:?}:{:?} successful",
hostname,
port
);
defmt::info!("TCP connection to {:?}:{:?} successful", hostname, port);
defmt::info!("Hostname: {:?}", tcp_client.server_hostname());
defmt::info!("Sending HTTP Document: {:?}", http_document.as_str());
match tcp_client.send_data(&http_document) {
Expand Down
6 changes: 4 additions & 2 deletions esp32-wroom-rp/src/gpio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
//! };
//! ```

use core::hint;

use embedded_hal::blocking::delay::DelayMs;
use embedded_hal::digital::v2::{InputPin, OutputPin};

Expand Down Expand Up @@ -131,13 +133,13 @@ where

fn wait_for_esp_ready(&self) {
while !self.get_esp_ready() {
//cortex_m::asm::nop(); // Make sure rustc doesn't optimize this loop out
hint::spin_loop(); // Make sure rustc doesn't optimize this loop out
}
}

fn wait_for_esp_ack(&self) {
while !self.get_esp_ack() {
//cortex_m::asm::nop(); // Make sure rustc doesn't optimize this loop out
hint::spin_loop(); // Make sure rustc doesn't optimize this loop out
}
}

Expand Down
17 changes: 6 additions & 11 deletions esp32-wroom-rp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ use network::NetworkError;

use protocol::ProtocolError;

const ARRAY_LENGTH_PLACEHOLDER: usize = 8;

/// Highest level error types for this crate.
#[derive(Debug, Eq, PartialEq)]
pub enum Error {
Expand Down Expand Up @@ -212,17 +210,15 @@ pub struct FirmwareVersion {
}

impl FirmwareVersion {
fn new(version: [u8; ARRAY_LENGTH_PLACEHOLDER]) -> FirmwareVersion {
fn new(version: &[u8]) -> FirmwareVersion {
Self::parse(version)
}

// Takes in 8 bytes (e.g. 1.7.4) and returns a FirmwareVersion instance
fn parse(version: [u8; ARRAY_LENGTH_PLACEHOLDER]) -> FirmwareVersion {
let major_version: u8;
let minor_version: u8;
let patch_version: u8;

[major_version, _, minor_version, _, patch_version, _, _, _] = version;
fn parse(version: &[u8]) -> FirmwareVersion {
let major_version: u8 = version[0];
let minor_version: u8 = version[2];
let patch_version: u8 = version[4];

FirmwareVersion {
major: major_version,
Expand All @@ -248,8 +244,7 @@ mod tests {

#[test]
fn firmware_new_returns_a_populated_firmware_struct() {
let firmware_version: FirmwareVersion =
FirmwareVersion::new([0x1, 0x2e, 0x7, 0x2e, 0x4, 0x0, 0x0, 0x0]);
let firmware_version: FirmwareVersion = FirmwareVersion::new(&[0x1, 0x2e, 0x7, 0x2e, 0x4]);

assert_eq!(
firmware_version,
Expand Down
Loading