Expand description
Format numbers into byte arrays.
Functions for converting numbers (i8
s, i16
s, i32
s or f32
s) into arrays of bytes
that can be sent to a TM1637 display.
There are versions of these functions that are meant for 4-digit displays and for 6-digit displays. The 6-digit versions take into account that the order of the bytes does not directly correlate with the order of the physical digits.
All numbers are aligned to the right.
§Example
use tm1637_embedded_hal::{formatters::i16_to_4digits, mock::Noop, TM1637Builder};
let mut tm = TM1637Builder::new(Noop, Noop, Noop).build_blocking::<4>();
tm.init().ok();
tm.display_slice(0, &i16_to_4digits(1234));
Functions§
- celsius_
to_ 4digits - Formats a
i8
clamped between-9
and99
, appending the degrees symbol(°)
and anuppercase C
, for a4-digit display
. - clock_
to_ 4digits - Formats two
u8
s between0
and99
, with an optional colon between them. - degrees_
to_ 4digits - Formats a
i16
clamped between-99
and999
, appending the degrees symbol(°)
, for a4-digit display
. - f32_
to_ 6digits - Formats a
f32
with the given amount of decimal digits, for a6-digit display
. - i16_
to_ 4digits - Formats a
i16
clamped between-999
and9999
, for a4-digit display
. - i16_
to_ upside_ down_ 4digits - Formats a
i16
clamped between-999
and9999
, for anupside-down 4-digit display
. - i32_
to_ 6digits - Formats a
i32
clamped between-99999
and999999
, for a6-digit display
.