Commit Graph

25 Commits (441dfbc2a4303146331857761b76de2bc80aad08)

Author SHA1 Message Date
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 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 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 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 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 fc241bc91d devices: Move interfaces and structs into physic
This made otherwise a weird import DAG.

Fixes #137
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 53e3ff1b30 lepton: Add String() in preparation to conn changes
Soon most objects will have to implement String.
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
M-A b46e37feba Remove all time.Sleep calls during tests (#204)
It slows down tests, nobody wants that.
9 years ago
Marc-Antoine Ruel f015c64bb3 lepton: fix go test on go1.10beta1 9 years ago
M-A 7dc1026c65 conn: Add Resource, superseds devices.Device (#162)
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.
9 years ago
Marc-Antoine Ruel 128c086c75 Fix various golint errors.
Trim "\n" from errors.
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
M-A f33f0732fb spi: Refactor Conn and ConnCloser into Conn, Port and PortCloser (#131)
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.
9 years ago
Matias Insaurralde 2d01ba7dbe Simplifying code (#129)
* host: follow gosimple suggestions

* conn: follow gosimple suggestions

* devices: follow gosimple suggestions

* Update CONTRIBUTORS
9 years ago
Marc-Antoine Ruel 8c668af634 small typos 9 years ago
Marc-Antoine Ruel debd177aa5 lepton: device driver for the FLIR Lepton
Include CLI tool to query the camera, grab a single frame and trigger a
calibration.
9 years ago