mirror of
https://github.com/kidoman/embd
synced 2025-07-04 04:17:41 +02:00
OneWire bus impl
This commit is contained in:
parent
bfcd1345fe
commit
82f119fadb
72 changed files with 568 additions and 174 deletions
|
@ -5,12 +5,14 @@
|
|||
GPIO (digital (rw))
|
||||
I²C
|
||||
LED
|
||||
W1 - make sure that w1-gpio kernel module is loaded. If you wish to use it with sensors directly (e.g. DS18B20 etc) make sure to disable respective kernel modules (e.g. w1-therm) in /etc/modprobe.d/blacklist.conf.
|
||||
*/
|
||||
package rpi
|
||||
|
||||
import (
|
||||
"github.com/kidoman/embd"
|
||||
"github.com/kidoman/embd/host/generic"
|
||||
"github.com/zlowred/embd"
|
||||
"github.com/zlowred/embd/host/generic"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
var spiDeviceMinor = byte(0)
|
||||
|
@ -73,6 +75,7 @@ var ledMap = embd.LEDMap{
|
|||
}
|
||||
|
||||
func init() {
|
||||
fmt.Println("registering RPI")
|
||||
embd.Register(embd.HostRPi, func(rev int) *embd.Descriptor {
|
||||
// Refer to http://elinux.org/RPi_HardwareHistory#Board_Revision_History
|
||||
// for details.
|
||||
|
@ -97,6 +100,10 @@ func init() {
|
|||
SPIDriver: func() embd.SPIDriver {
|
||||
return embd.NewSPIDriver(spiDeviceMinor, generic.NewSPIBus, nil)
|
||||
},
|
||||
W1Driver: func() embd.W1Driver {
|
||||
return embd.NewW1Driver(NewW1Bus)
|
||||
},
|
||||
}
|
||||
})
|
||||
fmt.Println("registered")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue