Compare commits

...

2 Commits

Author SHA1 Message Date
occheung 0816220065 scpi: use forked 0.3.4, changing round 2020-08-29 23:44:27 +08:00
occheung c39aa289d5 toml: add rounding library for f64 2020-08-28 16:32:45 +08:00
2 changed files with 7 additions and 3 deletions

View File

@ -15,8 +15,10 @@ stm32h7xx-hal = {version = "0.6.0", features = [ "stm32h743v", "rt", "unproven"
stm32h7-ethernet = { version = "0.2.0", features = [ "phy_lan8742a", "stm32h743v" ] } stm32h7-ethernet = { version = "0.2.0", features = [ "phy_lan8742a", "stm32h743v" ] }
smoltcp = { version = "0.6.0", default-features = false, features = [ "ethernet", "proto-ipv4", "proto-ipv6", "socket-raw" ] } smoltcp = { version = "0.6.0", default-features = false, features = [ "ethernet", "proto-ipv4", "proto-ipv6", "socket-raw" ] }
nb = "1.0.0" nb = "1.0.0"
scpi = {path = "../scpi-rs/scpi", version = "0.3.4"} # scpi = {path = "../scpi-rs/scpi", version = "0.3.4"}
scpi = { git = "https://github.com/occheung/scpi-rs", branch = "issue-4" }
lexical-core = { version="0.7.1", features=["radix"], default-features=false } lexical-core = { version="0.7.1", features=["radix"], default-features=false }
libm = { version = "0.2.0" }
# Logging and Panicking # Logging and Panicking
panic-itm = "0.4.1" panic-itm = "0.4.1"

View File

@ -29,6 +29,8 @@ use stm32h7xx_hal::rcc::CoreClocks;
use stm32h7xx_hal::{pac, prelude::*, stm32, stm32::interrupt}; use stm32h7xx_hal::{pac, prelude::*, stm32, stm32::interrupt};
use Speed::*; use Speed::*;
use libm::round;
/* /*
#[cfg(feature = "itm")] #[cfg(feature = "itm")]
use cortex_m_log::log::{trick_init, Logger}; use cortex_m_log::log::{trick_init, Logger};
@ -271,8 +273,8 @@ fn main() -> ! {
(buffer.len(), buffer) (buffer.len(), buffer)
}).unwrap(); }).unwrap();
hprintln!("{:?}", data).unwrap(); hprintln!("{:?}", data).unwrap();
let result = lexical_core::parse_partial::<f32>(data).unwrap(); let result = lexical_core::parse_partial::<f64>(data).unwrap();
writeln!(socket, "{}", (result.0 * 2.0)); writeln!(socket, "{}", round(result.0 * 2.0));
} }
else if socket.can_recv() { else if socket.can_recv() {
// hprintln!("{:?}", socket.can_recv()); // hprintln!("{:?}", socket.can_recv());