Commit Graph

354 Commits (e9a2fa73f91bba75dbf36a295f4c5d0ecb60f6ea)
 

Author SHA1 Message Date
M-A 077c5a6558 hx711: implement analog.PinADC (#335)
Add locking.
Add minimal testing.
8 years ago
Marc-Antoine Ruel 9bd83d1b9b analog: rename Reading to Sample
This makes more sense.
8 years ago
bezineb5 058b4ac664 ads1x15: Fixes #334 - Removed extra delay (#336)
* [ADS1x15] Removed extra delay
* Update ads1x15_test.go
Do not panic in case of unread packet.
8 years ago
Marc-Antoine Ruel 7531d3f42a bitbang: make i2c use physic.Frequency
It's not working yet so it's not like it's super useful, doing this for consistency.
8 years ago
Marc-Antoine Ruel ab67f9ac3d ads1x15: comment out racy test
Keep it uncommented until issue #334 is fixed.
8 years ago
Marc-Antoine Ruel 641330bde8 ads1x15: fix a race condition 8 years ago
bezineb5 41baeb565b ads1x15: fix synchronization (#325)
* Fixed race condition
* Added unit tests
* Do not close "stop" channel
8 years ago
Nikola Kovacs 233d57b937 ina219: Fix currentLSB calculation (#319)
- currentLSB is supposed to be Maximum Expected Current / 2^15
  2 << 15 is 2^16, not 2^15.
- fix rounding error in powerLSB calculation
- check for overflow in calibration
- fix doc
8 years ago
M-A 15e8b246b2 analog: improve PinADC and PinDAC (#318)
Rename the interfaces to be clear about the fact that they represent a single
pin.

Add Reading.

Include 100% test coverage.
8 years ago
M-A 09831e4e00 ads1x15: refactor, simplify API (#317)
- Merge PinForDifferenceOfChannels into PinForChannel.
- Make Channel a type.
- Rename ads1x15AnalogPin to analogPin, it was stuttering.
- Shorten few argument names.
- Remove one memory allocation in analogPin.
- Add a minimalistic unit test.
- Reduce (but to not eliminate yet) usage of fmt.
- Tweak documentation to optimize godoc output.
8 years ago
M-A 039d8be022 ads1x15: style improvement (#315)
No functional change.

- Move private globals at the bottom of the file.
- Move ads1x15AnalogPin close to its methods.
- Stop using named return variable.
- Inline newADS1x15.
- Move gainConfig and gainVoltage as global variables.
- Wraps comments.
- Rename mutex to mu.
- Use -math.MaxInt16 instead of math.MinInt16 because of the voltage multiplier.
- Change error strings to start with a lower case.
8 years ago
bezineb5 a74c97c8cd ads1x15: Add continuous reading, quality bias. Fix min/max values. (#307) 8 years ago
David Sansome dcc7e03739 hx711: tidy up a few remaining PR comments: (#312)
- Remove ReadAveraged - it's not a good fit here.
- Use the proper datasheet URL.
- Remove some constants.
- Rename StopContinuousRead to Halt.
8 years ago
David Sansome efab755c33 hx711: add experimental driver. (#305)
HX711 is a 24-bit ADC commonly used for weigh scales.
8 years ago
Marc-Antoine Ruel 0f9300c793 gpioutil: move to experimental/conn/gpio/gpioutil
This mirrors the end location.
8 years ago
bezineb5 44ff30f2a3 ads1x15: add support for ADS1015 and ADS1115 (#304) 8 years ago
Vlad Korniev 540371861e mfrc522: make concurrent-safe (#299)
Moved low-level implementation to commands package.
Fixed example_test.
8 years ago
Alvaro Viebrantz 2a2fa553a3 epd: add ePaper display support (#295) 8 years ago
NeuralSpaz 2352b96bc1 as7262: Remove requirement for go1.7 (#301)
Refactor to remove context.Context
Remove usage of t.Run.
Adds test case for Sense for 100% coverage
Removed signal.Notify's as signals do not always get delivered.
Fix documentation copy paste error.
Add Band stringer test.
Add Spectrum stringer test
Add Gain stringer test.
Add Gain stringer.
Add Spectrum stringer.
Add Band stringer.
Add check for gain value.
Add more test for Halt() conditions.
Move done channel creation within cancel mutex.
8 years ago
Alvaro Viebrantz 80fb33f17d bh1750: Add support for ambient light sensor (#302) 8 years ago
Alvaro Viebrantz 28f7e8009b ht16k33: add support for LED alphanumeric display (#298)
Add support to rainbowhat which is a composite of multiple devices.
8 years ago
NeuralSpaz 38804e4864 as7262: initial experimental support for AMS AS7262 Spectral ID i2c sensor (#300)
Add initial support for AMS 6 visible colour spectral ID sensor.
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
Marc-Antoine Ruel 7bc669b0cf experimental: fix gofmt for two packages
Travis was broken so I hadn't caught these regressions.
8 years ago
Will Meitzler 7f2de9c07f nrzled: Add SPI driver for Neopixel LEDs (#291)
Add support and tests for WS2812B Neopixel LEDs.
This commit has been tested with a strip of 50 LEDs.
8 years ago
Alvaro Viebrantz b2ab8ea899 pca9685: Add support for pwm module (#296) 8 years ago
Vlad Korniev 93d2236e21 mfrc522: improvements to gain and wait (#297)
- Antenna Gain
- Terminating Wait if Halt received
- Renamed SetOperationtimeout to SetOperationTimeout
8 years ago
Marc-Antoine Ruel d3144fa1d2 gpioutil: fix a race condition in TestDebounce_WaitForEdge_Got 8 years ago
Marc-Antoine Ruel 717ef921fa gpioutil: add PollEdge for polling based edge detection.
This function returns a gpio.PinIO implementing edge detection via polling.
8 years ago
Marc-Antoine Ruel 6853591d2a gpioutil: add minimal Deboune implementation.
No algorithm yet.
8 years ago
NeuralSpaz f54b53f207 ina219: add i2c driver for high side current and voltage sensor (#292) 8 years ago
David Sansome 5d01024987 ssd1306: add options to customize the hardware pin layout (#282)
Fixes #166
8 years ago
Seán C. McCord 97f5f4fe5d bitbang/spi: move pin init to Connect() from NewSPI() (#278)
Move pin init to Connect() from NewSPI()

Fixes #277
8 years ago
Seán C. McCord cd27930fe4 bitbang/spi: disable CS before manipulating CLK (#276)
Fixed #275
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
Seán C. McCord 34b6d1d3d2 bitbang/spi cleanup (#268)
- precalculate clock idle polarity and remove clockOn()/clockOff()
 - check for higher (unknown) modes and reject them
 - move internal functions down, to be grouped together
- idle clock on Connect
8 years ago
Seán C. McCord d2f71ca23c bitbang/spi: improve mode handling (#267)
- Handles clock-related Mode options for bitbanging SPI.
- Adds error handling for each errorable operation in spiConn.Tx
- Adds support for NoCS mode option
- Re-adds early catch for unhandled modes, now just HalfDuplex and
  LSBFirst

Fixes #266
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
Eugene 206686751e MPU9250 experimental driver, largely inspired by https://github.com/kriswiner/MPU9250/ (#265)
Provides some basic functionality for initialization, self-test,
calibrarion and reading the gyroscope and accelerometer data.

Uses SPI interface, I2C is yet to be implemented via the separate
transport.

Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
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