1 unstable release

0.1.0 Dec 22, 2024

#560 in Hardware support

Download history 360/week @ 2024-12-22 670/week @ 2024-12-29 630/week @ 2025-01-05 385/week @ 2025-01-12 467/week @ 2025-01-19 61/week @ 2025-01-26 105/week @ 2025-02-02 108/week @ 2025-02-09 444/week @ 2025-02-16 165/week @ 2025-02-23 382/week @ 2025-03-02 478/week @ 2025-03-09 473/week @ 2025-03-16

1,536 downloads per month
Used in cargo-hex-to-uf2

Custom license

720KB
367 lines

hex_to_uf2

This crate converts .hex files to .uf2 files according to the following standard: https://github.com/microsoft/uf2

usage

use hex_to_uf2::hex_to_uf2;

fn main() {
    let static_string = ":020000041000EA
:1000000000B5324B212058609868022188439860DF
:10001000D860186158612E4B002199600221596106
:100020000121F02299502B49196001219960352056
:1000300000F044F80222904214D00621196600F024
:1000400034F8196E01211966002018661A6600F04E
:100050002CF8196E196E196E052000F02FF8012189
:100060000842F9D1002199601B49196000215960AB";

    let uf2_bytes = hex_to_uf2(static_string.lines(), None);
    println!("{uf2_bytes:X?}");
}
use hex_to_uf2::hex_to_uf2_file;

fn main() {
    hex_to_uf2_file(
        Path::new("./test/rmk-central.hex"),
        Path::new("./test/rmk-central.uf2"),
        None,
    )
    .unwrap();
}

Attributions

The algorithm for conversion is taken out of the python code: https://github.com/HaoboGu/rmk/blob/main/scripts/uf2conv.py (MIT) I hereby grant the RMK project to use code from this library under the terms of MIT. Everyone else please stick to AGPL :)

Dependencies