You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
547 B
Go
34 lines
547 B
Go
3 years ago
|
package I2C
|
||
|
|
||
|
import (
|
||
|
_ "fmt"
|
||
|
_ "sync"
|
||
|
)
|
||
|
|
||
|
type I2CDevice struct {
|
||
|
*I2CBus // embeds bus
|
||
|
bool // stores whether dev is currently connected
|
||
|
int // addr
|
||
|
}
|
||
|
|
||
|
func NewDevice(addr int,bus *I2CBus) *I2CDevice {
|
||
|
d := &I2CDevice{}
|
||
|
d.I2CBus = bus
|
||
|
d.int = addr
|
||
|
return d
|
||
|
}
|
||
|
|
||
|
func (d *I2CDevice) GetAddr() int {
|
||
|
return d.int
|
||
|
}
|
||
|
|
||
|
func (d *I2CDevice) GetStatus() string {
|
||
|
// TODO
|
||
|
return "Unknown"
|
||
|
}
|
||
|
|
||
|
func (d *I2CDevice) GetType() string {
|
||
|
// TODO
|
||
|
return "Unknown"
|
||
|
}
|