This is supposed to be sent out in GRB order (and the comment below also
below claims it), but the code (and corresponding unit tests) did output
RGB order.
First I imported the commits from v3.6.6 with:
PKG=devices
git init $PKG
cd $PKG
git remote add origin https://github.com/google/periph
git fetch origin
git filter-repo \
--path AUTHORS \
--path CONTRIBUTING.md \
--path CONTRIBUTORS \
--path LICENSE \
--path README.md \
--path $PKG --path experimental/$PKG $@
git remote add origin git@github.com:periph/$PKG
git fetch origin
# Use the occasion to rename from master to main since we are starting from
# scratch.
git branch -m main
git push origin main
Then I fixed the layout to get rid of experimental with:
git rm experimental/devices/README.md
git mv experimental/devices/* .
git mv devices/* .
The import paths will be fixed in a follow up.
This adds experimental support for the st7567 LCD device which is used by the GFX HAT from Pimoroni.
The example just places some pixels on the device and iterates over the possible contrast values, going into power save mode and waking up.
The command line tool can take a PNG image and paints the black pixels onto the LCD.
Example and command line tool have been tested with a GFX Hat.
Take inspiration from the workflows used in gohci and bootstrap but
disable many checks because it's going to take a while to fix them all.
Update go generate to make it work without prerequisites preinstalled.
Remove the corresponding checks from .travis.yml. There are still checks
that haven't been transitioned, this will be done in a follow up.
It now passes when run as:
staticcheck -checks all,-U1000,-ST1003,-SA5002,-SA1019 ./...
The disabled checks will be enabled later since they are less trivial to
enable, as this is already a non-trivial number of modifications.
- Temporarily disable caching of sources, it seems corrupted.
- Fix copyright on a few sources.
- Codecov is very aggressive about code coverage, reduce the
expectations.
- Remove deprecated sudo:false
- Add missing os:linux and update to dist:bionic
- Update to go1.14.x
- Convert from matrix to jobs
- Reformat to try to make it slightly more readable
Fix a go formatting that crept in.
* Fix white border color
* Add convenience functions DrawAll and SetModelColor
* Tidy up the initialisation code and apply bugfixes from the upstream
Python library
Now running:
! go vet -vettool=$(which shadow) ./... |& grep -v '"err"' | grep -e '^[^#]'
Which means that "err" aliasing is not checked, but others are. I may
enforce "err" aliasing later but it's more noisy so I'm not 100% sure
yet it's a good idea. Enforcing it for non-err variables looked like a
reasonable initial trade-off.
Ran the following command:
golint -min_confidence 0 ./... | grep -v ALL_CAPS | \
grep -v underscores | grep -v 'another file'
and fixed the comments that made sense.
- Converting the alert registers and the ambient temp register to a
physic.Temperature can use the same procedure. Unify them and document
why this is possible.
- Use != instead of > for bit checks
- Inline bitsToTemperature calls in SenseWithAlerts
The datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf)
says that negative temperatures are stored in two's complement. See
page 22 for alert registers and pages 24-25 for the ambient temperature
register.
However, the code currently assumes negative values are stored in a
sign-and-magnitude representation. Fix this to handle two's complement
values correctly.
For register bits to temperature conversion this implementation follows
the datasheet, but the code in the datasheet isn't quite right -- it
should be `temp - 256` instead of `256 - temp` -- but the fact that the
256 figure is in Microchip's code backs up the idea stated in the text
that negative values are in two's complement. Others seem to agree that
this is correct: https://electronics.stackexchange.com/a/244826
For temperature to bits conversion this implementation relies on the
fact that Go also uses two's complement. I've added a long comment in
the code about this.
Add internal context.context
Fixes some fragile time based tests.
Halt() is now synchronous, will only return if the context has been cancelled.
Remove go routine leak in New().
Fix spelling.
- Improve rounding and add unit tests to confirm.
- Period() is the same function than Duration() but better describes what
is returned.
- Fix support for negative value.
- Upgrade all call sites inside periph.
- Fix Frequency documentation that incorrectly stated it's an int32,
it's in fact an int64.
- Duration() will be removed in v4.0.0 as part of issue #379.
This causes a few breaking changes in experimental code:
- hx711.TimeoutError was renamed to ErrTimeout
- unicornhd.NewUnicornhd() was stuttering and was renamed to New()
- Remove Strip, now unnecessary.
- Rename New() to NewStream().
- Merge SPIDev into Dev.
- Rename all unit tests.
- Unexport ToRGB(), this was in a unit test.
- Increase test coverage to 93.8%.
- Fix package documentation.
- Switch the main code to use a lookup array (and not slices!).
- Add unit test to test the lookup table against the algorithm.