kidoman / embd

Embedded Programming Framework in Go
http://embd.kidoman.io
MIT License
1.28k stars 156 forks source link

proposal for a better i2c interface / sensors #45

Open quinte17 opened 8 years ago

quinte17 commented 8 years ago

hey guys.

i like the idea of embd beeing a plattform for hardware guys ;) but as much as i like the idea, when it comes to i2c i somehow dislike the interface used. in my opinion https://github.com/davecheney/i2c has a much cleaner interface. if you look at the example i implemented: https://github.com/quinte17/bme280/blob/master/bme280.go you might see what i mean.

plz dont missunderstand this proposal. i just searched for an interface i could implement, so the sensor could be used in other places too. atm i only found embd as the only project. i believe my implementation doesnt fit well for embd. just want to start some discussion...

yours

tve commented 8 years ago

I don't understand "many sensor registers are lined up. so you could read them all in one go." in that you can read multiple sensor registers using:

// ReadFromReg reads n (len(value)) bytes from the given address and register.
func ReadFromReg(addr, reg byte, value []byte) error
quinte17 commented 8 years ago

sry, my fault, I missed that one. havn't looked at all functions.

another question i have: are there any plans to migrate to https://github.com/golang/exp/tree/master/io/ ?

tve commented 8 years ago

I didn't know about that. What would the benefit be? It's not really clear to me who maintains that and what the plans are...

quinte17 commented 8 years ago

Here is the thread which initially started this project. https://groups.google.com/d/msg/golang-dev/ofaaIJPWRKg/5QuiOPlZBgAJ