The rationale is that both intensity limiting and temperature correction can
still be used with 8 bits resolution, but perceptual mapping can't.
Make the documentation clearer about the implications. Add global PassThruOpts
to make its clear for users.
Add example for ToRGB() using PassThruOpts.
Add unit tests.
Add flag -g to cmd/apa102.
Extracts a condition from the inner raster loop, increasing performance by up to
25%.
Fix bug in dst overrun.
- Convert existing tests to table-driven
- Make reading []byte diffs easier by aligning lines
- Should be a no-op in terms of what's being tested and with what data
display: move devices.Display as display.Drawer
This removes the last interface from devices, which was misplaced due to
historical accident. The new package display will also be the location for an
interface for text output only devices.
Remove io.Writer from this interface. While it's a good performance optimization
for some drivers, it shouldn't be required.
Change Draw():
- Return an error, so that communication erorr can be surfaced correctly,
instead of an adhoc driver specific Err() method.
This is borderline pedantic but enables 30*physic.MegaHertz which I think is
more readable than 30000000, reducing the risk of typos.
Do not change Stream.Resolution() gpiostream yet, but I'll likely change it too
to match in a follow up.
While it may not look necessary to some drivers, it is useful to have a
consistent pattern. The Opts never specify connectivity, only other parameters.
Issue #194
- .gohci.yml: Run with both -cover and -bench on odroid and win10 and make the
benchtime 1000ms instead of 10ms to increase precision, as this was lacking.
- apa102: add benchmark for toRGBFast()
- bmxx80: add benchmark for conversion functions.
- gpiotest: silence test (was leaking output during benchmarks)
- physic: add benchmark for the current int64 String() implementation compared
to an hypothetical (simpler) float64 based implementation.
The idea is to enable navigating across the code more easily by using similar
layout amongs the drivers.
Similar to gofmt, it's not about making a stylistic choice, but having a single
style.
Use the following layout for drivers:
- exported support types
- Opts struct
- New func
- Dev struct and methods
- Private support code
No functional change.
A lot of code moved around, so it will likely break any pending PR or fork. :/
This creates an example_test.go for each package with at least one
Example, and move all examples in it. Make the example_test.go file live
into a separate package 'foo_test' so it can call host.Init() and thus
can be copied as-is.
In practice I want to be able for gpioreg.Register() to eventually enforce that
Halt() is implemented on gpio.Pin, so that three's a consistent way to stop
gpiostream operations or PWM() output. This requires the interface to live in
conn, not in devices.
Do not use go1.9 type alias to not break compatibility with older Go version
yet.
- Disallow writing a buffer longer than the number used. Silently
dropping data is always annoying to debug. Clear failure is better.
- Rename private variables and document them better.
- Replace 'lights' by 'pixels'. This is more precise.
- devices: Add SenseContinuous() to Environmental.
- devices: Add Device to Display and Environmental.
- devices: Remove fmt.Stringer from Device.
- devices: Add more type assertions to variaous devices and corresponding unit test.
- bme280: Unexport the Standby parameter.
- bme280: Have SenseContinuous accept time.Duration period instead.
- bme280: Do not enable automatic sensing upon initialization.
- bme280: Use forced mode by default.
- bme280smoketest: improved.
As people like to copy paste code, make sure that the semantic of the variable
names is always relevant w.r.t. the object they refer to. In particular, do not
use 'bus' to refer to an spi.Port or spi.PortCloser, as this is blur the
distinction.
Also rename a few fooName to fooID.
This clarifies the difference on ownership and makes it clear that DevParams()
is essentially a 'connection factory'.
The flow is:
Bus -> Port -> Conn
Doing this caught inconsistencies in the unit tests. Made the structs in spitest
enforce the fact that DevParams() can only be called once.
In a follow up, I'll rename a lot of 'bus' to 'port' to be more consistent but
punting to not make this change unreviewable.
- Allow both app and device drive set max bus speed.
- Make DevParams callable only exactly once.
- sysfs-spi: make SPI implement io.Reader.
- sysfs-spi: Fix Tx() with write only or read only.
This shortens OpenByName() to Open() and removes OpenByNumber(). The concept of
number is not removed, it's still possible to open a bus by number, but a base10
string representation of the number is now needed. In practice, I haven't found
a real use for OpenByNumber().
This simplify the API surface, less functions leads to simpler to understand
API.
This is a breaking change.
Because of the way the SPI bus is exposed via sysfs, do not use the same pattern
as i2c. This may change as more OSes are supported.
Increase test coverage for spi and spitest to 100%.
- Make error more consistent and more helpful. Not all errors are wrapped yet
but a fair part is now.
- Remove the 'first' pattern in i2c, spi, uart and make it work.
- Add allwinner.Pin.wrap() for coherence with PinPL and bcm283x.Pin.
- headers.All() return a copy.
Ran:
git sed 's/pio/periph/g
git sed 's/gperiph/gpio/g'
git sed 's/Gperiph/Gpio/g'
git sed 's/PIO/Periph/g'
git sed 's/GPeriph/GPIO/g'
git mv pio.go periph.go
git mv pio_test.go periph_test.go
cd cmd
git mv pio-info periph-info
git mv pio-setup periph-setup
where 'git sed' is an alias to run sed over all files in git ls-files.
Fixes#11.