-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
apa102: allow to specify SPI Mode in Opts #16
base: main
Are you sure you want to change the base?
Conversation
Hi! Thanks for the contribution! Sorry I dropped it in my emails. Frankly, I think I'd prefer to just switch to Mode0 and not make it an option. What is the downside? |
Codecov Report
@@ Coverage Diff @@
## main #16 +/- ##
=====================================
Coverage 59.8% 59.8%
=====================================
Files 48 48
Lines 4331 4331
=====================================
Hits 2590 2590
Misses 1608 1608
Partials 133 133
Continue to review full report at Codecov.
|
Ignore the test failure, I need to redo the way I do forward-testing. |
I'm not sure wether or not there might be some weird behaviour on the LED side of things due to the clock polarity being inverted. Whenever I accessed less LEDs than i connected the one LED after the last one was bright white, which might be because of the LEDs protocol (more likely for my understanding) or because of the SPI Mode. I unfortunately can't test it as I don't have access to the hardware anymore. |
Frankly I'd simply use Mode1 and see if anyone complains on the next release. Users can always revert back to the previous release if it breaks them and we will add a bool flag at that point. |
@maruel: if users note that something is broken soon enough 😅 I guess the approach in this PR has the potential to save some tears. I was initially asking because I darkly recalled that we tried some LED strips initially on the first SPI port of a rpi3 (current approach uses second port), where mode 3 (old default) was working, but mode 1 not. That led to my guess that changing the default will break things for people. |
Sorry for the delay, lots of things happening here. Thanks for the data point about some LEDs not working with mode3. I'd still prefer to use a bool defaulting to false so that a constructing a Opt{} by hand still works. Right now with this change constructing a Opt{} will result in spi.Mode0, which doesn't work. Please document the flag to explain the specific use case, and the fact that some LEDs may not work when the bool is set to true. I've finally fixed the github actions checks, so please git fetch and git rebase first. Thanks! |
Revisiting this PR: I'd really prefer to use a bool instead of a spi.Mode; this way the default bool value in Go (false) is the right one. |
Some devices such as the secondary SPI Port of the Raspberry Pi 3 don't support the default SPI Mode 3.
This Change allows to set the SPI Mode to any other by changing the Opts.