Commit Graph

120 Commits (cb7e526cec0f6f38d62539f46bccffa7f8d81a07)

Author SHA1 Message Date
M-A afa0c2bedd Officially drop support for pre-go1.7 (#365)
- Remove conditional tests on go 1.7.
- Stop running on travis with go 1.5.4.
- Bump go1.11 to go1.11.4.
7 years ago
Marc-Antoine Ruel 12263dcb53 Stop using t.Fail() and FailNow
This is bad habit and maked diagnosing test failure hard. It's not
something we want to encourag,e so remove all traces from the code.
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
David Sansome 5d01024987 ssd1306: add options to customize the hardware pin layout (#282)
Fixes #166
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 6e81933d56 Start standardizing function names
This is important to enable portability across platforms.

- UART_TX, UART_RX, UART_RTS, UART_CTS
- SPI_MISO, SPI_MOSI, SPI_CLK

This could break users who were depending on the previous wording but that would
be highly surprising.
8 years ago
Marc-Antoine Ruel ccd14fb9e1 Fine tune fmt usage
- Replace fmt.Printf("%s\n", x) with fmt.Println(x)
- Replace fmt.Printf(".. %s ..", hex.EncodeToString(x)) with fmt.Printf(".. %x ..", x)
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
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
Marc-Antoine Ruel 161a9035d2 bmxx80: fix humidity sensing
It regressed in e9544992d9. :( This is due to
integer overflow. Tested against the executable compiled from periph v2.

Refactor the tests to make the error messages clearer.

Fixes #256
8 years ago
M-A 8e1f781a4d apa102: change from RawColors to DisableGlobalPWM (#261)
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.
8 years ago
Ben Lazarus bbc377d76a apa102: Add RawColors option (#260)
This adds a new option to bypass the perceptual remapping code and
directly write the RGB values to the APA102.
8 years ago
Ben Lazarus 70adef3f63 apa102: refactor raster functions (#254)
- rasterImg() now calls raster() instead of duplicating it
- Add a fast path for RGBA
- Add tests for Draw()s called with src and dst offsets supplied
8 years ago
Ben Lazarus e2aca639ef apa102: add new benchmarks for raster refactor (#259) 8 years ago
Ben Lazarus 82d2ba2f9b apa102: simplify Draw() benchmark (#253) 8 years ago
Ben Lazarus a90b2edbb3 apa102: refactor benchmarks (#252) 8 years ago
Ben Lazarus a948b6ab2e apa102: Refactor tests (#251)
- 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
8 years ago
Marc-Antoine Ruel cbaeada391 cap1xxx: move out of experimental 8 years ago
Marc-Antoine Ruel 98e2118731 devices: overhaul documentation
- Standardize package documentation into doc.go
- Link back to the web site in a standardized way
- Update datasheet links for lepton
8 years ago
Marc-Antoine Ruel d0b2e0937c bmxx80: update datasheet URLs 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 6f8bd69f03 Consistently cache display device Bounds()
Improve Draw() performance.
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 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 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