Add Driver channel for events

This commit is contained in:
Adrian Zankich 2013-10-28 20:26:05 -07:00
parent dbc602d5bd
commit d05268feb2
2 changed files with 9 additions and 1 deletions

View File

@ -7,6 +7,7 @@ type Driver struct {
Pin string
Name string
Params map[string]string
Events map[string]chan interface{}
}
func NewDriver(d Driver) Driver {

View File

@ -26,4 +26,11 @@ func After(t string, f func()) {
func Random(min int, max int) int {
rand.Seed(time.Now().UTC().UnixNano())
return rand.Intn(max - min) + min
}
}
func On(cs chan interface{}) interface{}{
for s := range cs {
return s
}
return nil
}