Comments (16)
Ok it seems quite straightforward. I've ordered two on aliexpress for now.
The main annoyance is the 2s/4s standby but since I've unexported Standby in af3fbce, this simplifies hiding this discrepancy.
I'm wondering what to do with the driver name though, as it's not really worth having a completely separate package, since the actual device can be easily detected. I guess bmx280
would be fine, albeit slightly confusing. :/
Another option is to create a directory bosch
, then put the devices in there as subdirectories so it's easier to share the code via an internal
package. Actually everything could be in the bosch
directory.
I'm open to other ideas too.
from periph.
I've made a commit showing how it could me done. I think it's feasible, the main annoyance is the user needs to know "more" about the right I²C address to use.
from periph.
maybe device-creation needs a bit of a rework?
what about something like
func NewBMP180() (clever_device_object)
the only problem i see here, is how to get the difference between spi and i2c.
NewBMP180I2C
NewBMP180SPI
seems a bit redundant?
from periph.
Thanks for the quick reply i really didn't wanted to fork the repo just for a single byte change.
Also i really like the idea of not duplicating the driver but naming it bmx280, great idea!
from periph.
@quinte17 the function NewI2C() handles all of bmp180/bme280/bmp280 seamlessly as per the WIP code I pushed. The only challenge is the address: I'm thinking it would be split off as a separate argument in NewI2C, so it couldn't awkwardly be passed to NewSPI due to its presence in Opts{}.
from periph.
FTR, I'm planning a v2 release really soon, so getting this in before the v2 would be a good idea since it's totally a breaking change.
from periph.
With the options...
the only thing I can imagine is to use different types or different interfaces.
or just live with it and just write it into the docs that address wont have any affects when using spi.
but that means you also dont error out if an address is given.
from periph.
I changed NewI2C() to have an additional argument. It's not that bad (3 args now) and makes the code simpler.
from periph.
@UnAfraid can test 2ba2860 locally? You can get with it:
git fetch && git checkout origin/bosch
Even better would be to connect one BMP280 device over I²C, one over SPI then run:
periph-smoketest bmx280
and confirm that both readings are close, which means both protocols work correctly. This would greatly increase the confidence level for the whole thing working.
Thanks
from periph.
Sure gonna try it.
from periph.
I couldn't get nor bme or bmp to work under SPI, on i2c it works fine tho.
It says
chip@chip4:~/go/src/periph.io/x/periph/cmd/bmxx80$ sudo ./bmxx80 -spi /dev/spidev32766.0 -v
19:34:12.601514 CLK : INVALID
19:34:12.602751 MOSI: INVALID
19:34:12.603339 MISO: INVALID
19:34:12.603854 CS : INVALID
Here's BME280 and BMP280 sensors attached at same i2c bus 2 on both available addresses 0x76 and 0x77
chip@chip4:~/go/src/periph.io/x/periph/cmd/bmxx80$ sudo i2cdetect -y 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- 76 77
chip@chip4:~/go/src/periph.io/x/periph/cmd/bmxx80$ sudo ./bmxx80 -i2c 2 -ia 0x76
27.800°C 100.453KPa
chip@chip4:~/go/src/periph.io/x/periph/cmd/bmxx80$ sudo ./bmxx80 -i2c 2 -ia 0x77
28.390°C 100.382KPa 40.20%rH
from periph.
The SPI driver on the CHIP is, I'd say, "subpar". I'm only testing SPI on a Raspberry Pi. But that's fine I'll confirm first I didn't break anything (likely tomorrow or the day after) with my 2 BME280 and that should be good enough.
from periph.
I have Rasberry PI Zero around, i can try with it.
from periph.
Here's smoketest output from 2 BMP280s and BME280s
pi@pi-zerow:~/go/src/periph.io/x/periph/cmd/periph-smoketest $ # BMP Test
pi@pi-zerow:~/go/src/periph.io/x/periph/cmd/periph-smoketest $ ./periph-smoketest bmx280 -i2c 1 -spi /dev/spidev0.0
BMP280{I2C1(118)} : 25.830°C 100.825KPa 0.00%rH
BMP280{SPI0.0} : 26.060°C 100.814KPa 0.00%rH
Delta : 0.230°C 0.011KPa 0.00%rH
pi@pi-zerow:~/go/src/periph.io/x/periph/cmd/periph-smoketest $ # BME Test
pi@pi-zerow:~/go/src/periph.io/x/periph/cmd/periph-smoketest $ ./periph-smoketest bmx280 -i2c 1 -spi /dev/spidev0.0
BME280{I2C1(118)} : 28.170°C 100.734KPa 33.37%rH
BME280{SPI0.0} : 28.760°C 100.814KPa 31.10%rH
Delta : 0.590°C 0.080KPa 2.27%rH
pi@pi-zerow:~/go/src/periph.io/x/periph/cmd/periph-smoketest $
Can you add support for -ia on the smoke test as well?
from periph.
Thanks a lot for the verification. I added the flag to the smoke test.
from periph.
Thanks!
from periph.
Related Issues (20)
- [Question] How do I set a pin to alt0? HOT 6
- All pins are exported during bcm283x Init HOT 3
- Support for firmata HOT 2
- gpio-read: bcm283x-gpio (GPIO7): pull cannot be used when subsystem gpiomem not initialized. HOT 21
- Go get fetches v3.4.0 if using go modules HOT 3
- Support for BME680 HOT 3
- Halt() does not unblock WaitForEdge() HOT 3
- Feature SSD1322 HOT 5
- mfrc522 constantly returns "IRQ error" after first read HOT 11
- spi to slow HOT 5
- onewire didnot work HOT 9
- Omega2: declare headers HOT 3
- Experimental serial package doesn't export essential func HOT 7
- Unable to set GPIO pin pull on Raspberry Pi 4 HOT 19
- MFRC522 hang on WaitForEdge HOT 2
- HX711: unstable readings and reading before data is ready HOT 2
- spi: rename MISO/MOSI to COPI/CIPO HOT 2
- I2C documentation not clear on read/write operation HOT 2
- MFRC522 - Problem reading Tag HOT 3
- pmem example code incorrect HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from periph.