Used the following:
go get github.com/kisielk/errcheck
errcheck -ignore 'Close|rintf' ./...
While some are irrelevant, there were some genuine issues so this is worth
enforcing, hence a few innocuous places were 'fixed' so that the list could go
down to zero.
Do not enforce this in travis yet, but should be done soon.
Provides some basic functionality for initialization, self-test,
calibrarion and reading the gyroscope and accelerometer data.
Uses SPI interface, I2C is yet to be implemented via the separate
transport.
Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
The remainder is ALL_CAPS, underscores and golint confusion when multiple
exported variables are defined on a single line.
No functional change except one error string tweaked.
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.
- Move go1.8+ test code using t.Run() into separate file conditionally compiled
on go1.8+. It's not a big deal to partially lose test coverage on <1.8 as long
as the main code runs fine.
- Run coverage before race checker to help get results faster.
- Fix typo.
- No need to run travis on recent versions, they are handed by gohci workers and
they are faster. :)
- Change DefaultOpts to be a struct instead of a function. This makes the godoc
much more descriptive.
- Change InputStatus() to accept a slice, so that the driver will be able to
eventually support the flavors cap1155 and cap1166.
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.
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. :/
If the passed key is longer than 6 bytes, it will corrupt the access
bits for the trailing sector.
Fixed the bit calculation, updates tests.
Changed signatures to accept 6-byte long arrays instead of slices.
Minor typo for HD44780
Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
- Make errors consistents.
- Standardize comments.
- Make unit test much faster by not sleeping.
- Reduce the number of properties of Dev.
- Do not export Opts.
- Commented out I/O for unused data.
- Slightly reduce memory usage.
- Comment out NewSPI() since it is not implemented.
- Remove verbosity by default.
- Ran github.com/kisielk/errcheck on the code base, and either trapped errors or
marked them as ignored explicitly. The stats was calculated via:
errcheck ./... | grep -v defer | wc -l
- Stop registering gpio.INVALID, it can't be registered.
- Fix a go vet issue in cap1188.
- bme280: fix hang in Halt() if SenseContinuous() listener is hung.
- bmp180: Add unit tests; increase test coverage to 96%.
- bmp180: Remove Reset(). There's no known use case.
- bmp180: Implement SenseContinuous().
- Consistently wrap errors in both packages.
- Various typos.
- 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 enables more complex use case like write-then-read, 3-wire SPI and when
the number of bits per word changes accross packets.
- Remove the transparent Tx() buffer cutting, the Raspberry Pi 3 spi_bcm2835
driver asserts the CS line even if csChange = 0 on the last packet. This broke
some use case (like FLIR Lepton).
spi-io: improve with more use cases. Used for adhoc testing of the SPI bus and
looking at the results over an oscilloscope.
- 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.
Now each connection can report if the underlying communication channel is
half-duplex or full-duplex.
This information is leveraged by some clients, like memory mapped registers
helper struct, to change their behavior or deny use on certain kind of
communication channel.
- 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.
- Remove fmt.Stringer and io.Writer from conn.Conn. This makes it compatible
with exp/io.
- Rename i2c.Conn to i2c.Bus since this was confusion. This clarifies the
distinction between a point-to-point connection and a bus.
- Add these to bus specific interfaces, i2c.Bus, spi.Conn, uart.Conn.
Fixes#15.