Commit Graph

108 Commits (ff89f66af273677c9fb3a13ae20e47a193aa74d6)

Author SHA1 Message Date
Michael Traver ff89f66af2 mcp9808: Simplify bits to temperature conversions (#404)
- Converting the alert registers and the ambient temp register to a
  physic.Temperature can use the same procedure. Unify them and document
  why this is possible.
- Use != instead of > for bit checks
- Inline bitsToTemperature calls in SenseWithAlerts
7 years ago
Michael Traver e27c424b7b mcp9808: Fix conversions between temperature and bits (#403)
The datasheet (http://ww1.microchip.com/downloads/en/DeviceDoc/25095A.pdf)
says that negative temperatures are stored in two's complement. See
page 22 for alert registers and pages 24-25 for the ambient temperature
register.

However, the code currently assumes negative values are stored in a
sign-and-magnitude representation. Fix this to handle two's complement
values correctly.

For register bits to temperature conversion this implementation follows
the datasheet, but the code in the datasheet isn't quite right -- it
should be `temp - 256` instead of `256 - temp` -- but the fact that the
256 figure is in Microchip's code backs up the idea stated in the text
that negative values are in two's complement. Others seem to agree that
this is correct: https://electronics.stackexchange.com/a/244826

For temperature to bits conversion this implementation relies on the
fact that Go also uses two's complement. I've added a long comment in
the code about this.
7 years ago
Marc-Antoine Ruel cb7e526cec ccs811: update datasheet url
Add a product page, in case they break the PDF URL again.
7 years ago
NeuralSpaz b82bbe0a1c as7262: add internal context.context (#399)
Add internal context.context
Fixes some fragile time based tests.
Halt() is now synchronous, will only return if the context has been cancelled.
Remove go routine leak in New().
Fix spelling.
7 years ago
John Maguire 53592c599b inky: Add more error checking (#394) 7 years ago
John Maguire e82464a0d0 inky: Adds device driver for Inky pHAT e-ink screens (#390)
Only support pHAT for now, but supporting wHAT won't be too hard.

Supports all of the Red, Yellow and White-only devices.
7 years ago
M-A 441dfbc2a4 physic: Improve Frequency rounding, add Period() (#386)
- Improve rounding and add unit tests to confirm.
- Period() is the same function than Duration() but better describes what
  is returned.
- Fix support for negative value.
- Upgrade all call sites inside periph.
- Fix Frequency documentation that incorrectly stated it's an int32,
  it's in fact an int64.
- Duration() will be removed in v4.0.0 as part of issue #379.
7 years ago
DeziderMesko c52d26920b ccs811: new device driver (#385)
The ccs811 is a volatile Organic Compounds sensor.
7 years ago
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
NeuralSpaz d1d3b72147 mcp9808: add experimental support for digital temperature sensor (#356)
* mcp9808: add support for digital temperature sensor

Add support for microchip i2c MCP9808 temperature sensor.
8 years ago
Eugene a8429b61f9 mfrc522: reworked public/private API. (#349)
Fixed the wait for edge block, removed synchronization code.
Added concurrent execution protection via config.
Updated API docs.
8 years ago
Marc-Antoine Ruel 71c7a218dd Reduce the number of golint reports
This causes a few breaking changes in experimental code:

- hx711.TimeoutError was renamed to ErrTimeout
- unicornhd.NewUnicornhd() was stuttering and was renamed to New()
8 years ago
lnitram e17c8b885b sn3218 - add experimental support for sn3218 LED driver (#348) 8 years ago
Marc-Antoine Ruel 34b5f2bfcb nrzled: merge SPIDev into Dev
- Remove Strip, now unnecessary.
- Rename New() to NewStream().
- Merge SPIDev into Dev.
- Rename all unit tests.
- Unexport ToRGB(), this was in a unit test.
- Increase test coverage to 93.8%.
8 years ago
Marc-Antoine Ruel b930b20a2d nrzled: clean up NRZ encoded as 3 or 4 bits
- Fix package documentation.
- Switch the main code to use a lookup array (and not slices!).
- Add unit test to test the lookup table against the algorithm.
8 years ago
NeuralSpaz ab13b61dd6 pca9548: i2c multiplexer (#320) 8 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
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
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