wezm / ssd1675

Rust driver for SSD1675 e-Paper display controller
Apache License 2.0
63 stars 14 forks source link

Replace custom error type in favour of Debug constraints #10

Closed wezm closed 4 years ago

wezm commented 4 years ago

@etrombly I came up with this to avoid the need for the error type. It seems the v1/v2 GPIO traits are a bit of a mess. There some discussion on the embedded-hal repo about a v3 that would address some of the issues like we're seeing here. Hopefully that will get sorted eventually and we can move to that.

codecov-io commented 4 years ago

Codecov Report

Merging #10 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #10   +/-   ##
=======================================
  Coverage   92.14%   92.14%           
=======================================
  Files           4        4           
  Lines         191      191           
=======================================
  Hits          176      176           
  Misses         15       15

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9d8b68d...f27c2c6. Read the comment docs.

etrombly commented 4 years ago

looks a lot cleaner than what I came up with. I think the linux traits may be able to fail, so at some point you may want to handle the errors. I use mostly stm32, so this works well for me.

wezm commented 4 years ago

I think the linux traits may be able to fail, so at some point you may want to handle the errors.

Yes this is true. My first attempt was to extend your error type so it could hold an SPI error and a GPIO error and then add From impls for it. The generics make it really awkward though.

Since this is effectively how it worked with the v1 traits I'm not too fussed. I've subscribed to that v3 issue and hopefully they come up with something that's a bit nice to use.