toml: add rounding library for f64
This commit is contained in:
parent
f92b2ba6f5
commit
c39aa289d5
|
@ -17,6 +17,7 @@ smoltcp = { version = "0.6.0", default-features = false, features = [ "ethernet"
|
|||
nb = "1.0.0"
|
||||
scpi = {path = "../scpi-rs/scpi", version = "0.3.4"}
|
||||
lexical-core = { version="0.7.1", features=["radix"], default-features=false }
|
||||
libm = { version = "0.2.0" }
|
||||
|
||||
# Logging and Panicking
|
||||
panic-itm = "0.4.1"
|
||||
|
|
|
@ -29,6 +29,8 @@ use stm32h7xx_hal::rcc::CoreClocks;
|
|||
use stm32h7xx_hal::{pac, prelude::*, stm32, stm32::interrupt};
|
||||
use Speed::*;
|
||||
|
||||
use libm::round;
|
||||
|
||||
/*
|
||||
#[cfg(feature = "itm")]
|
||||
use cortex_m_log::log::{trick_init, Logger};
|
||||
|
@ -271,8 +273,8 @@ fn main() -> ! {
|
|||
(buffer.len(), buffer)
|
||||
}).unwrap();
|
||||
hprintln!("{:?}", data).unwrap();
|
||||
let result = lexical_core::parse_partial::<f32>(data).unwrap();
|
||||
writeln!(socket, "{}", (result.0 * 2.0));
|
||||
let result = lexical_core::parse_partial::<f64>(data).unwrap();
|
||||
writeln!(socket, "{}", round(result.0 * 2.0));
|
||||
}
|
||||
else if socket.can_recv() {
|
||||
// hprintln!("{:?}", socket.can_recv());
|
||||
|
|
Loading…
Reference in New Issue