#bcd #no-std

no-std nobcd

A simple BCD number primitive for no_std environments

3 unstable releases

0.2.0 Apr 24, 2023
0.1.1 Feb 3, 2023
0.1.0 Feb 3, 2023

#762 in Embedded development

Download history 14/week @ 2024-02-12 1/week @ 2024-02-19 27/week @ 2024-02-26 12/week @ 2024-03-11 53/week @ 2024-04-01

65 downloads per month

MIT/Apache

10KB
199 lines

A simple BCD number primitive

CI crates.io

This crate provides a simple BcdNumber type that can be used in embedded no_std environments.

If you are missing a feature, please raise an issue or a PR.

Example

let bcd = BcdNumber::<2>::try_new(1234u16).unwrap();
assert_eq!(1234u16, bcd.value());
assert_eq!([0x12, 0x34], bcd.bcd_bytes());
assert_eq!(bcd, BcdNumber::try_from([0x12, 0x34]).unwrap());

Dependencies

~98–320KB