Commit Graph

36 Commits (2f70f83e86619700b661bcdeb796531e2946881f)

Author SHA1 Message Date
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 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
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
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
M-A 56aad834ae Promote onewire, ds18b20 and ds248x to stable. (#117)
It works and it is tested.
9 years ago
Marc-Antoine Ruel c9298db3b0 Fix issues found by misspell, gofmt -s -w, golint and go vet; add badges
- There were several typos
- Simplified a few simplified statements
- Added doc for a few exported symbols
- Fix incorrect printf usage
9 years ago
M-A bbcd750d5b Replace github.com/google with periph.io/x (#110)
This makes periph.io/x/periph as the repository root so it is not tied to the
Google organisation anymore.
9 years ago
Thorsten von Eicken adc0251b5a fix ssd1306 i2c commands (#107)
* fix ssd1306 i2c commands
* verified that scrolling works
* added comment that ssd1306 doesn't support SPI yet
9 years ago
M-A 2d5524c4cb gpio: Rename Edge constants. (#103)
This is to make the value more readable at the call site.
10 years ago
M-A 3368c35ef7 gpio: Rename Up and Down to PullUp and PullDown. (#93)
This should make it more approachable for first time users.
10 years ago
M-A 0075d9e849 Increase polish. (#75)
- Make error more consistent and more helpful. Not all errors are wrapped yet
  but a fair part is now.
- Remove the 'first' pattern in i2c, spi, uart and make it work.
- Add allwinner.Pin.wrap() for coherence with PinPL and bcm283x.Pin.
- headers.All() return a copy.
10 years ago
M-A 5cddc1641d host: migrate functions to subpackage cpu. (#63)
Otherwise this would cause some drivers to import host, which would import
drivers that the user may not desire.

This commit fixes this import loop.
10 years ago
Marc-Antoine Ruel 8a8a4edc01 apa102: fix unit tests.
Changing the temperature calculation from float64 to lookup tables causes small
(<3 in value) changes in the recorded data.
10 years ago
M-A 8925bb0af7 apa102: remove remaining float64 use and dependency on maruel/temperature. (#67)
temperature.ToRGB() was implemented in floating point. OMG.

Fixes #22
10 years ago
M-A 495d261bae periph: Remove Type; gpio: improve pin registering (#48)
periph:
- Type was an approximation to enforce priority ordering. Remove the need for
  approximate ordering by improving gpio instead to support out-of-order pin
  registration. This has the side effect of increasing parallelism. This saved
  ~5ms on "gpio-list" runtime (out of 30ms) when run on a Raspberry Pi 3.

gpio:
- Redo RegisterAlias() to support out of order registration.
- Replace Functional() with Aliases(), which is much more generic.
- Unexport PinAlias, it is not necessary anymore.
- Improve error messages by wrapping the error, it helps legibility in case of
  errors.
- Remove Unregister(), it will be added back when there's an actual call site.
- Remove the (%d) number on sysfs-gpio and bcm283x since it wasn't useful.
- sysfs-gpio: Fix edge when switching output.
- consistently fix accumulated edged when calling sysfs.Pin.In().

lirc:
- Stop mapping IR_IN and IR_OUT when the pin is not mapped.

periph-smoketest:
- Fix to use host.Init(), otherwise drivers weren't correctly loaded.

Fixes #45
(I think)
10 years ago
M-A 01b45ab697 Add more examples, trim documentation. (#44) 10 years ago
M-A 8bca85318d conn: Simplify Conn, rename i2c.Conn to i2c.Bus. (#40)
- Remove fmt.Stringer and io.Writer from conn.Conn. This makes it compatible
  with exp/io.
- Rename i2c.Conn to i2c.Bus since this was confusion. This clarifies the
  distinction between a point-to-point connection and a bus.
- Add these to bus specific interfaces, i2c.Bus, spi.Conn, uart.Conn.

Fixes #15.
10 years ago
Thorsten von Eicken b939aeacd3 fix Celcius, fixes #34 (#35)
* fix Celcius, fixes #34

* remove stale Celsius todo
10 years ago
M-A ae8f618573 Rename pio to periph. (#27)
Ran:
    git sed 's/pio/periph/g
    git sed 's/gperiph/gpio/g'
    git sed 's/Gperiph/Gpio/g'
    git sed 's/PIO/Periph/g'
    git sed 's/GPeriph/GPIO/g'
    git mv pio.go periph.go
    git mv pio_test.go periph_test.go
    cd cmd
    git mv pio-info periph-info
    git mv pio-setup periph-setup

where 'git sed' is an alias to run sed over all files in git ls-files.

Fixes #11.
10 years ago
M-A 5fce5c83f9 Rename lock to mu. (#16)
Rename lock to mu everywhere.
10 years ago
quinte17 42624e257c make the i2c address of bme280 configurable (#5)
make the i2c address of bme280 configurable

The address can either be 0x76 or 0x77. It depends on hardware configuration.
If you connect SDO to GND its 0x76
If you connect SDO to V(DDIO) its 0x77.

* Add me to the authors.
* the bme280 cmd uses the new address option
* initialize default addr on definition
10 years ago
M-A 6c4287b4da Change copyright from Google Inc to The PIO Authors. (#3)
The PIO Authors is a superset of Google Inc. It includes Google and any
additional contributors that are listed in AUTHORS.
10 years ago
Marc-Antoine Ruel eb384b9d0c Initial commit of pio.
This was extracted from github.com/maruel/dlibox/go/pio @ f51102b.
This code was written by Marc-Antoine Ruel.
10 years ago