1
0
Fork 0
mirror of https://github.com/kidoman/embd synced 2025-07-04 20:37:46 +02:00

fix a bunch of build errors

This commit is contained in:
Karan Misra 2014-03-02 12:09:57 +05:30
parent 026f5fe3f3
commit 4e67e7eb11
7 changed files with 105 additions and 67 deletions

View file

@ -1,6 +1,7 @@
package gpio
import (
"errors"
"fmt"
"os"
"path"
@ -18,7 +19,7 @@ type digitalPin struct {
}
func newDigitalPin(n int) (*digitalPin, error) {
p = &digitalPin{n: n}
p := &digitalPin{n: n}
if err := p.init(); err != nil {
return nil, err
}
@ -66,7 +67,7 @@ func (p *digitalPin) SetDirection(dir gpio.Direction) error {
str = "out"
}
_, err := p.dir.WriteString(str)
return
return err
}
func (p *digitalPin) Read() (int, error) {
@ -99,6 +100,14 @@ func (p *digitalPin) ActiveLow(b bool) error {
return err
}
func (p *digitalPin) PullUp() error {
return errors.New("not implemented")
}
func (p *digitalPin) PullDown() error {
return errors.New("not implemented")
}
func (p *digitalPin) Close() error {
if err := p.dir.Close(); err != nil {
return err

View file

@ -99,20 +99,20 @@ func (io *GPIO) unexport(n int) error {
func (io *GPIO) digitalPin(key interface{}) (*digitalPin, error) {
pd, found := io.lookupKey(key)
if !found {
err = fmt.Errorf("gpio: could not find pin matching %q", key)
return
err := fmt.Errorf("gpio: could not find pin matching %q", key)
return nil, err
}
n := pd.N
p, ok := io.initializedPins[n]
if ok {
return
return p, nil
}
if pd.Caps&Normal == 0 {
err = fmt.Errorf("gpio: sorry, pin %q cannot be used for GPIO", key)
return
err := fmt.Errorf("gpio: sorry, pin %q cannot be used for GPIO", key)
return nil, err
}
if pd.Caps != Normal {