1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-03 03:47:33 +02:00

simplify package structure

This commit is contained in:
Karan Misra 2014-03-03 00:51:23 +05:30
parent 3cae4064dc
commit 36f2c0486d
41 changed files with 736 additions and 885 deletions

26
descriptor.go Normal file
View file

@ -0,0 +1,26 @@
package embd
import "fmt"
type Descriptor struct {
GPIO func() GPIO
I2C func() I2C
}
type Describer func(rev int) *Descriptor
var Describers = map[Host]Describer{}
func DescribeHost() (*Descriptor, error) {
host, rev, err := DetectHost()
if err != nil {
return nil, err
}
describer, ok := Describers[host]
if !ok {
return nil, fmt.Errorf("host: invalid host %q", host)
}
return describer(rev), nil
}