diondokter / device-driver

A toolkit to create better Rust device drivers, faster
https://diondokter.github.io/device-driver/
Apache License 2.0
114 stars 5 forks source link

Fix macro syntax for fields with endianness + RW or RO #5

Closed jamwaffles closed 3 years ago

jamwaffles commented 3 years ago

I ran into a strange issue with RW or RO fields. Minimal repro:

implement_registers!(
    Max17302.registers<u16> = {
        test2(RW, 0x01B, 2) = { vcell: u16:LE = RW 0..16 },
    }
);

This gives an "unexpected token ..." error. Either removing :LE or changing both occurrences of RW to RO would fix the compilation error. Eventually tracked it down to the changes in this PR.

diondokter commented 3 years ago

Ah, that looks like some sloppy copy pasting from my side... Looks good, thanks for the PR!

diondokter commented 3 years ago

Also created a new release: 0.1.2

jamwaffles commented 3 years ago

Awesome, thank you for the fast response!