Commit Graph

344 Commits (eb0d2cc2b93c03407d5986dfd79987d8a2706bd8)
 

Author SHA1 Message Date
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 8fa8a276a6 apa102: fix typo, use DefaultOpts in cmd
Reduce the number of constants by having cmd/apa102 uses the values from
apa102.DefaultOpts. This increases the default intensity from 127 to 255.
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 0b285a6cb6 cci: make Dev implement physic.SenseEnv
Remove unnecessary Sprintf() call.
8 years ago
Marc-Antoine Ruel 79423600fb ds18b20: change Dev to implement physic.SenseEnv; tweak String()
This removes the Temperature() function for coherency with the other drivers.

This removes the dependency on package fmt.
8 years ago
Marc-Antoine Ruel ecfe99ea32 physic: Add Precision to SenseEnv
Implement for bme280 and sysfs
8 years ago
Marc-Antoine Ruel e9544992d9 physic: increase RelativeHumidity precision by 10x
MicroRH comment are incorrect.

It's actually too low for BME280's sensitivity.
8 years ago
Marc-Antoine Ruel 458e322fcf lepton: complete the lepton driver overhaul
- New(): Remove cs argument.
- Frame uses image14bit.Gray14 instead of image.Gray16.
- ReadImg(): Removed in favor to NextFrame().
8 years ago
Marc-Antoine Ruel 3e5b1a8345 ssd1306: switch to use DefaultOpts pattern 8 years ago
Marc-Antoine Ruel ffc32d2881 ds248x: switch to use DefaultOpts pattern
Simplifies the expectations a bit, and the code too.

I²C address is not an option, for consistency with the other drivers.
8 years ago
Marc-Antoine Ruel ad7ff7dcea bmxx80: switch to a required Opts pattern
Issue #194
8 years ago
Marc-Antoine Ruel caf4bf4327 apa102: switch to an Opts pattern
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
8 years ago
Marc-Antoine Ruel 46ea7926cc gpiostream: Add BitStream.LSBF
Remove Bits.

Fixes #189
8 years ago
Marc-Antoine Ruel fc241bc91d devices: Move interfaces and structs into physic
This made otherwise a weird import DAG.

Fixes #137
8 years ago
Marc-Antoine Ruel cd1516dfb2 devices: Remove devices.Device
Use conn.Resource instead.

Fixes #184
8 years ago
Marc-Antoine Ruel 79501ae489 bmxx80: change bmx280 tests
Make the float calibration calculation to use float64 instead of float32. It's
the same performance on all platforms.
Include conversion back to physic units for the float based benchmark, to be
more realistic.
8 years ago
Marc-Antoine Ruel f15a60524d Benchmark related changes
- .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.
8 years ago
Menno Finlay-Smits 66af77a36a lepton: Add new image14bit subpackage
This defines a image/draw compatible Gray14 image type and Intensity14
pixel type. These will soon be used to store the frames return by the
lepton driver.

This is part of the work for #218.
8 years ago
Marc-Antoine Ruel 9660271642 lepton: add NextFrame, explicit Halt, deprecation warnings
Both New() cs argument and ReadImg() will be removed, add warnings.

Done as part of issue #217 and #218.
8 years ago
Marc-Antoine Ruel ce57d1e222 lepton: add Dev.Bounds()
This is in preparation to support the lepton 3 and refactor the driver to be in
better shape.
8 years ago
Marc-Antoine Ruel 84ee99bd88 Fix remaining misuses of °K and one KPa 8 years ago
Marc-Antoine Ruel 7abb5ac69e conn/physic: redo the package that was added in 0bc4d173ac
It realized I did it wrong. Decouple and disambiguate the 'measurement type'
from the 'unit used'.

While trying to micro-optimize for 32 bits architecture, I missed the greater
picture. Use int64 for most types.

Include 100% test coverage and examples.
8 years ago
Marc-Antoine Ruel 3b9eef0d46 Fix travis failure in c7b6b899f1
Looks like my gofmt and the one used by travis do not agree on a comment inside
an empty struct. Move the comment outside the struct to work around the problem.
8 years ago
Marc-Antoine Ruel c7b6b899f1 Fix Makefile go vet to use -unsafeptr=false, formatting in bmp180_test.go 8 years ago
Marc-Antoine Ruel f4eadbf1e1 Follow up on 0bc4d173ac
Had forgotten to git add conn/physic/example_test.go.
Typoed the replacements in devices/devices.go.
8 years ago
Marc-Antoine Ruel 0bc4d173ac conn/physic: add units and sensing devices
This is to provide a saner abstraction and also stop host from depending on
devices.

Add Ampere, Centi and Volt.

This is to fix #137.
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 c9255b11f7 apa102: remove allocation in Halt
Document where Draw() cause a memory allocation in the case of an image format
other than NRGBA.
8 years ago
Marc-Antoine Ruel 53e3ff1b30 lepton: Add String() in preparation to conn changes
Soon most objects will have to implement String.
8 years ago
Marc-Antoine Ruel cf6b4f08f0 devices: stop using fmt for units
Use strconv directly instead.
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
Marc-Antoine Ruel 7306448a6d devices: replace bus reference to port 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
Marc-Antoine Ruel 124fa6f98b I was so happy with recent Example refactors, did it for all packages
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.
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
Marc-Antoine Ruel 1f328237e7 README.md: add slack, remove gitter
The gitter channel is not used much.

Add a title for the example to state what it does, since it may not be obvious
for everyone.
8 years ago
Cássio Botaro 6287555122 Add Cássio Botaro as contributor (#216) 8 years ago
Cássio Botaro eccbfb4b4d removing redundant code (#213) 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
M-A b46e37feba Remove all time.Sleep calls during tests (#204)
It slows down tests, nobody wants that.
9 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