Commit Graph

383 Commits (49b2b5fb4c5eeb1475a8ba16e49d1b1ff4b92d10)
 

Author SHA1 Message Date
Marc-Antoine Ruel bbed3b44f7 Fix negative RelativeHumidity.String() 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 e235d09bc8 gpioreg: Remove ByNumber() (#153)
It is still possible to get a pin by its logical number using the string
representation, but the function is not exported anymore.

This simplifies the interface, one less way to do the same thing.
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
Marc-Antoine Ruel 1c4e51fe0c ssd1306: Remove dependency on golang.org/x/image/...
- Inline golang.org/x/image/font/basicfont in cmd/ssd1306.
- Inline a text rendering in ssd1306smoketest.
- Update ssd1306 example to be a comment, so golang.org/x/image is not imported
  even in the test.

Done as part of #146.
9 years ago
Marc-Antoine Ruel 502fbee137 Remove the warning in README.md about versioning.
Now that v1.0.0 is being released and will use a proper versioning mechanism,
there's no need for this warning.

Clients will be able to use http://github.com/golang/dep to version this
library.
9 years ago
Marc-Antoine Ruel 0947092379 bme280: Remove stale TODO for NewSPI
The code is functional and tested.
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
Max Ekman 77af758e41 Set version of RPi for all known revisions (#138)
Improve support for RPi 1, 2, 3, add support for Zero, Zero Wireless and the Compute Modules.

Removes rpi.Version since it doesn't make much sense anymore, as it more closely related to
the CPU than the actual board.

Fixes #139
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
Alexander Neumann 61c1b2c139 Add driver for Bosch BMP180 temp/pressure sensor (#132) 9 years ago
quinte17 b5aa4c03f3 use a newCalibration func like in bmp180 (#134) 9 years ago
Marc-Antoine Ruel 27f14e663b bme280: fix Halt references 9 years ago
Marc-Antoine Ruel 3af6409eeb README.md: add warning about breaking changes 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 9dfa0dc52f Update link 9 years ago
Marc-Antoine Ruel 8c668af634 small typos 9 years ago
Marc-Antoine Ruel e5127f7abf devices: despise Fahrenheit a bit more 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
Marc-Antoine Ruel 2853fb49f6 gpioreg: Switch aliases to be to names instead of numbers.
This makes it much more generic and extensible. This will enable addressing
issue #125.

Refuse registering an high and low priority pins with different numbers but same
name and reverse.
9 years ago
Marc-Antoine Ruel bdefda99fb Add gitter.im chat room badge 9 years ago
Marc-Antoine Ruel 2f70f83e86 Make conntest output copy-pastable; fix go vet issues 9 years ago
Marc-Antoine Ruel fbf842d637 devices: Add devices.Device and Halt() for all device drivers
This starts a semblance of coherence for drivers. In particular Halt() marks a
clear difference from Close (connection) and is the term used by gobot.
9 years ago
Marc-Antoine Ruel 860d4aa457 For all IO, rename Write to W and Read to R
Fix Tx() for the Record objects (conntest, i2ctest, onewiretest and spitest) to
guard against write buffer corruption.
9 years ago
Marc-Antoine Ruel b61c90429c spi: Add first version of TxPackets + NoCS, HalfDuplex, LSBFirst.
- 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.
9 years ago
Marc-Antoine Ruel aff3ae8a77 i2c and spi: clarify with SetSpeed vs LimitSpeed.
Otherwise when reading code is it very unclear if it may be slower or not.

Yet another breaking change.
9 years ago
Marc-Antoine Ruel 2dfb12af03 tm1637: increase coverage to 100%
It's kind of cheating because a gpiotest.Playback is needed but not yet written.
9 years ago
Marc-Antoine Ruel 2e0e8d4ee9 Minor cleanups in ds18b20 and ds248x.
Breaking change: removed ds248x.Dev.Close() as it doesn't 'own' anything.
Wrap comments at 80 cols.
Call Playback.Close(), removed extraneous Ops.
Slightly increased coverage.
9 years ago
Marc-Antoine Ruel daad425c63 ssd1306: implement SPI and transparent differential update.
- Increase test coverage to 100%.
- Add ssd1306smoketest.
- Complete SPI 4-wire implementation.

Differential update reduces the amount of data sent over the I²C/SPI bus at the
(small) cost of slightly more CPU usage. On many platform, I²C default transfert
speed is only 100KHz so when only a small section of the display is updated,
this can lead to significant performance improvement.

For now only page based differential update is used, as column based offset
corrupt the display. This still results in large savings.
9 years ago
Marc-Antoine Ruel 722b0f8824 conntest: Change Playback default to panic
Make this optional for all of conntest, i2ctest, onewiretest and spitest.
Update tests accordingly.
9 years ago
Marc-Antoine Ruel a0e9236c75 image1bit: make it more like stdlib
- Rename Image to VerticalLSB, so that the 3 other encodings (vertical MSB,
  horizontal LSB and MSB) can be added at a later point if ever needed without
  breaking the API.
- Use .Pix, .Stride and .Rect so it is more similar to how stdlib image package
  does it.
- Export the color model properly as BitModel.
- Remove frivolous methods.
9 years ago
Marc-Antoine Ruel 94686e7f5d bme280: Fix SPI, add smoke test.
Increase coverage; only one line would need some math to figure out values that
would allow exceeding the threshold.
9 years ago
M-A 7faec2c2d3 spi: Update spi.Conn to separate app and device configuration. (#123)
- 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.
9 years ago
Marc-Antoine Ruel fd7cbfd4bf devices: Fix negative Milli 9 years ago
Marc-Antoine Ruel edc050f0a7 Add mascot 9 years ago
M-A c8b66ce778 Split registries into their own packages. (#122)
conn/gpio -> conn/gpio/gpioreg
conn/i2c -> conn/i2c/i2creg
conn/spi -> conn/spi/spireg
conn/pins -> conn/pin
host/headers -> conn/pin/pinreg
conn/reg -> conn/mmr
9 years ago
Marc-Antoine Ruel cbac673bcf s/OpenByName/Open/g and d/OpenByNumber/
This shortens OpenByName() to Open() and removes OpenByNumber(). The concept of
number is not removed, it's still possible to open a bus by number, but a base10
string representation of the number is now needed. In practice, I haven't found
a real use for OpenByNumber().

This simplify the API surface, less functions leads to simpler to understand
API.

This is a breaking change.
9 years ago
Marc-Antoine Ruel 9fe596f933 apa102: increase coverage to 100%
Make Write() handle when buffer is too long.
9 years ago
Marc-Antoine Ruel ce258e061b conntest: Add 100% coverage
- conntest: Small coherency fixes along the way.
- conntest: Add Discard. Useful for zero filled tests.
- reg: Improve testing.
- CONTRIBUTING.md: fix a typo.
9 years ago
M-A 6620acdaca spi: Rewrite similar to how i2c was refactored (#120)
Because of the way the SPI bus is exposed via sysfs, do not use the same pattern
as i2c. This may change as more OSes are supported.

Increase test coverage for spi and spitest to 100%.
9 years ago
Marc-Antoine Ruel 7464232a5f Remove io.Writer from spi.Conn
This was interface creep
9 years ago
M-A f14be69810 i2c: convert from "number only" to named buses plus aliases (#119)
This is a breaking change.

This is closer to how gpio behaves yet different in practice because of the
different challenges.

spi will be updated later to behave the same. Add support for aliases, which is
very useful, and it permits the CLI tools to accept a free form string to
specify the bus name.

- Increase test coverage of i2c and i2ctest to 100%.
- Add i2c.Pins implementation to i2ctest.Playback.
9 years ago
Marc-Antoine Ruel d7c75db11b Add CONTRIBUTING.md so there's a banner on the PR.
It just points to https://periph.io/project/contributing/
9 years ago
M-A c15fd0bfa5 Add conn.Conn.Duplex() (#118)
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.
9 years ago
M-A 56aad834ae Promote onewire, ds18b20 and ds248x to stable. (#117)
It works and it is tested.
9 years ago
Marc-Antoine Ruel 0c585b510a travis: Expose test failure, install missing packages
Add badges.
9 years ago
Marc-Antoine Ruel f1d8127e0b Rename sample to example.
See 96b661173e
9 years ago
Marc-Antoine Ruel 39aa0b9373 Update links without /doc/
See cdf3755696
9 years ago