Commit Graph

71 Commits (28f7e8009b55f672738d6ef9a15523e59763b796)

Author SHA1 Message Date
Alvaro Viebrantz 28f7e8009b ht16k33: add support for LED alphanumeric display (#298)
Add support to rainbowhat which is a composite of multiple devices.
8 years ago
NeuralSpaz 38804e4864 as7262: initial experimental support for AMS AS7262 Spectral ID i2c sensor (#300)
Add initial support for AMS 6 visible colour spectral ID sensor.
8 years ago
Marc-Antoine Ruel fb97d9d25d testing.T.Run was introduced in Go 1.7, not Go 1.8
Make tests that were locked on 1.8 to run on Go 1.7.

Fix ina219 tests to only compile on Go 1.7 since it uses testing.t.Run().
8 years ago
Marc-Antoine Ruel 7bc669b0cf experimental: fix gofmt for two packages
Travis was broken so I hadn't caught these regressions.
8 years ago
Will Meitzler 7f2de9c07f nrzled: Add SPI driver for Neopixel LEDs (#291)
Add support and tests for WS2812B Neopixel LEDs.
This commit has been tested with a strip of 50 LEDs.
8 years ago
Alvaro Viebrantz b2ab8ea899 pca9685: Add support for pwm module (#296) 8 years ago
Vlad Korniev 93d2236e21 mfrc522: improvements to gain and wait (#297)
- Antenna Gain
- Terminating Wait if Halt received
- Renamed SetOperationtimeout to SetOperationTimeout
8 years ago
Marc-Antoine Ruel d3144fa1d2 gpioutil: fix a race condition in TestDebounce_WaitForEdge_Got 8 years ago
Marc-Antoine Ruel 717ef921fa gpioutil: add PollEdge for polling based edge detection.
This function returns a gpio.PinIO implementing edge detection via polling.
8 years ago
Marc-Antoine Ruel 6853591d2a gpioutil: add minimal Deboune implementation.
No algorithm yet.
8 years ago
NeuralSpaz f54b53f207 ina219: add i2c driver for high side current and voltage sensor (#292) 8 years ago
Seán C. McCord 97f5f4fe5d bitbang/spi: move pin init to Connect() from NewSPI() (#278)
Move pin init to Connect() from NewSPI()

Fixes #277
8 years ago
Seán C. McCord cd27930fe4 bitbang/spi: disable CS before manipulating CLK (#276)
Fixed #275
8 years ago
Marc-Antoine Ruel f325631d2a Bring back compatibility with go1.4.2
- apa102 benchmark used image.CMYK, which was added in go 1.5. This has the side
  effect of making benchmark BenchmarkDrawSlowpath a bit faster.
- mpu9250 used type aliasing by accident, which was added in go1.9.
- periph-web used http.Server.Shutdown(), which was added in go1.8.
8 years ago
Marc-Antoine Ruel e8b2fc3174 switch from fmt.Stringer to conn.Resource
- conn.Resource is a superset of fmt.Stringer.
- lirc: implement conn.Resource.
8 years ago
Seán C. McCord 34b6d1d3d2 bitbang/spi cleanup (#268)
- precalculate clock idle polarity and remove clockOn()/clockOff()
 - check for higher (unknown) modes and reject them
 - move internal functions down, to be grouped together
- idle clock on Connect
8 years ago
Seán C. McCord d2f71ca23c bitbang/spi: improve mode handling (#267)
- Handles clock-related Mode options for bitbanging SPI.
- Adds error handling for each errorable operation in spiConn.Tx
- Adds support for NoCS mode option
- Re-adds early catch for unhandled modes, now just HalfDuplex and
  LSBFirst

Fixes #266
8 years ago
Marc-Antoine Ruel 5b5d0de02f Explicitly ignore error at many call sites for clarity
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.
8 years ago
Eugene 206686751e MPU9250 experimental driver, largely inspired by https://github.com/kriswiner/MPU9250/ (#265)
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>
8 years ago
Jorge D. Ortiz Fuentes afdedaf59d UnicornHD driver implementation (#250)
- Unicorn HD (https://shop.pimoroni.com/products/unicorn-hat-hd) driver.
- Implements display.Drawer.
- Test for partial update as required in the interface.
8 years ago
Marc-Antoine Ruel 0e0bb7e7dc bitbang: fix SPI with the new v3.0.0 spi interfaces
I had forgot to update it in time, resulting in a completely broken
implementation.

It's still broken, but it was even more broken.
8 years ago
Marc-Antoine Ruel cbaeada391 cap1xxx: move out of experimental 8 years ago
Marc-Antoine Ruel f7ddfe8f13 cap1xxx: generalize cap1188 to support more devices
cap1166 can be found in Display-O-Tron HAT by Pimoroni.
8 years ago
Marc-Antoine Ruel e634bc9fab Fix a ton of golint messages.
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.
8 years ago
Marc-Antoine Ruel 501558c627 conn/display: simplify Drawer
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.
8 years ago
Marc-Antoine Ruel f7d0d4e3d5 travis: run on 1.5.4
- 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. :)
8 years ago
Marc-Antoine Ruel 6f8bd69f03 Consistently cache display device Bounds()
Improve Draw() performance.
8 years ago
Marc-Antoine Ruel 0a22d3193e nrzled: change to Opts pattern
This makes it coherent with other drivers.
8 years ago
Marc-Antoine Ruel dfd55c438e Tweak package doc for many executables 8 years ago
M-A 10ef55d6b0 cap1188: tweaks in the device driver (#244)
- 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.
8 years ago
Marc-Antoine Ruel e1decce7e5 gpiostream: replace Resolution with Frequency
It's easier for people to think in term of frequency when working with bitstream
than with the clock cycle duration in µs.
8 years ago
Marc-Antoine Ruel 332037c25e Update use of frequency to use physic.Frequency
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.
8 years ago
Marc-Antoine Ruel 46ea7926cc gpiostream: Add BitStream.LSBF
Remove Bits.

Fixes #189
8 years ago
Marc-Antoine Ruel 989d5f693d Benchmarks: call ReportAllocs() explicitly everywhere
This removes the need to specify the flag -benchmem.
8 years ago
Marc-Antoine Ruel 5b5083e8fb Move code around to make drivers follow a common pattern
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. :/
8 years ago
Marc-Antoine Ruel 89531ab87e Reduce references to devices.Device
This interface will be removed in v3.
8 years ago
Eugene 4251b6f3e3 Fixed MFRC522 trailing sector overflow (#224)
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>
8 years ago
Eugene 1bd781af86 Hitachi HD44780U Dot Matrix Liquid Crystal Display (#223)
Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
8 years ago
Eugene 46011cfcbf MFRC522: Code review follow-up (#221)
Catch errors
Update formatting

Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
8 years ago
Eugene ddf7ca2519 Initial support for the Mifare MFRC522 RFID Reader (#220)
Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
8 years ago
M-A 2f8171ed6c cap1188: refactor a bit. (#203)
- 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.
8 years ago
Marc-Antoine Ruel 089b8dccab Reduce number of errcheck lint messages from 117 to 2.
- 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.
9 years ago
Matt Aimonetti 68f531c751 cap1188 experimental device (#192)
This driver was tested against a adafruit version of the cap1188
https://learn.adafruit.com/adafruit-cap1188-breakout/overview and the
pimoroni drumhat:
https://shop.pimoroni.com/collections/raspberry-pi/products/drum-hat
(which has its LED reversed and uses a different i2c address).
9 years ago
M-A 11522179a3 gpiostream: Implement LSB and MSB variations. (#188)
Make the encoding clear via examples.

Comment that the non-marked version is deprecated and will be removed in the
next major version.
9 years ago
M-A 0b05c62a9e nrzled: add support for ws281x and clones (#165)
- Includes driver and CLI. Completely untested.
9 years ago
M-A 70fd9082bb bmp180: promote to stable; fix bug in bme280 (#152)
- 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.
9 years ago
M-A ea63dac2c6 devices: Add Environmental.SenseContinuous(); implement for bme280 (#150)
- 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.
9 years ago
M-A 24ef228ca1 spi: Rename Port.DevParams to Connect (#149)
It better conveys the purpose of the function, which is to create a Conn over a
Port.
9 years ago
M-A e1b4eec42a spi: rename variables 'bus' to 'port' where applicable (#143)
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.
9 years ago
Alexander Neumann 61c1b2c139 Add driver for Bosch BMP180 temp/pressure sensor (#132) 9 years ago