Crates.io | serial_write |
lib.rs | serial_write |
version | 0.1.0 |
source | src |
created_at | 2023-04-10 06:39:45.064006 |
updated_at | 2023-04-10 06:39:45.064006 |
description | Simplifying serial output in a no_std environment, both string and numeric. |
homepage | |
repository | |
max_upload_size | |
id | 834885 |
size | 48,240 |
Simplifying serial output in a no_std
environment, both string and numeric.
&str
i8
, i16
, i32
, i64
, isize
u8
, u16
, u32
, u64
, usize
f32
, f64
&[i8]
, &[i16]
, &[i32]
, &[i64]
, &[isize]
&[u8]
, &[u16]
, &[u32]
, &[u64]
, &[usize]
&[f32]
, &[f64]
SerialPort
// Set the USB bus
let usb_bus = UsbBusAllocator::new(hal::usb::UsbBus::new(...));
// Set the serial port
let mut serial = SerialPort::new(&usb_bus);
Writer
let mut writer = Writer::new();
// Output "123".
writer.write_usize(123, &mut serial);
// Output "123" and break line.
writer.writeln_usize(123, &mut serial);
// Output to 2 decimal places ("12.34").
writer.write_usize(12.3456, 2, &mut serial);