periph / devices

Go·Hardware·Lean - Device drivers
https://periph.io
Apache License 2.0
85 stars 42 forks source link

[Inky] autodetect board opts and pHAT v2 support #12

Closed Thereatra closed 3 years ago

Thereatra commented 3 years ago

I have added auto opts detect and dev struct creationg with defaults from the detected opts as mentioned in #11.

While I was at it I also added support for pHAT v2 which is simply a pHAT with a small resolution difference.

codecov-io commented 3 years ago

Codecov Report

Merging #12 (918ef54) into main (c53a296) will decrease coverage by 0.7%. The diff coverage is 0.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main     #12     +/-   ##
=======================================
- Coverage   60.7%   59.9%   -0.7%     
=======================================
  Files         48      48             
  Lines       4250    4302     +52     
=======================================
  Hits        2578    2578             
- Misses      1541    1593     +52     
  Partials     131     131             
Impacted Files Coverage Δ
inky/inky.go 0.0% <0.0%> (ø)

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 c53a296...918ef54. Read the comment docs.

googlebot commented 3 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Thereatra commented 3 years ago

@googlebot I signed it!

googlebot commented 3 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Thereatra commented 3 years ago

I've changed it so DetectOpts and the related functions all use an open port instead.

I guess I just assumed that the display would always run on a raspberry pi with linux as it is built for. I have removed the hardcoded SPI port as specified, however the NewDetected still relies on the assumption that the Inky is used as a pi hat with the specific gpio ports. I personally feel like this makes sense due to the nature of the board, but if it's out of scope/too specific for a device driver, then it's probably better to just remove the function rather than make it take the same parameters as New minus the opts param.

maruel commented 3 years ago

Thanks! Apologies for the slow back and forth.

One potential follow up: I think it would be interesting to add an example about how to leverage the new function in https://github.com/periph/devices/blob/main/inky/example_test.go.