gobot.io/x/gobot/v2@v2.1.0/drivers/gpio/gpio.go (about)

     1  package gpio
     2  
     3  import (
     4  	"errors"
     5  )
     6  
     7  var (
     8  	// ErrServoWriteUnsupported is the error resulting when a driver attempts to use
     9  	// hardware capabilities which a connection does not support
    10  	ErrServoWriteUnsupported = errors.New("ServoWrite is not supported by this platform")
    11  	// ErrPwmWriteUnsupported is the error resulting when a driver attempts to use
    12  	// hardware capabilities which a connection does not support
    13  	ErrPwmWriteUnsupported = errors.New("PwmWrite is not supported by this platform")
    14  	// ErrAnalogReadUnsupported is error resulting when a driver attempts to use
    15  	// hardware capabilities which a connection does not support
    16  	ErrAnalogReadUnsupported = errors.New("AnalogRead is not supported by this platform")
    17  	// ErrDigitalWriteUnsupported is the error resulting when a driver attempts to use
    18  	// hardware capabilities which a connection does not support
    19  	ErrDigitalWriteUnsupported = errors.New("DigitalWrite is not supported by this platform")
    20  	// ErrDigitalReadUnsupported is the error resulting when a driver attempts to use
    21  	// hardware capabilities which a connection does not support
    22  	ErrDigitalReadUnsupported = errors.New("DigitalRead is not supported by this platform")
    23  	// ErrServoOutOfRange is the error resulting when a driver attempts to use
    24  	// hardware capabilities which a connection does not support
    25  	ErrServoOutOfRange = errors.New("servo angle must be between 0-180")
    26  )
    27  
    28  const (
    29  	// Error event
    30  	Error = "error"
    31  	// ButtonRelease event
    32  	ButtonRelease = "release"
    33  	// ButtonPush event
    34  	ButtonPush = "push"
    35  	// Data event
    36  	Data = "data"
    37  	// Vibration event
    38  	Vibration = "vibration"
    39  	// MotionDetected event
    40  	MotionDetected = "motion-detected"
    41  	// MotionStopped event
    42  	MotionStopped = "motion-stopped"
    43  )
    44  
    45  // PwmWriter interface represents an Adaptor which has Pwm capabilities
    46  type PwmWriter interface {
    47  	PwmWrite(string, byte) (err error)
    48  }
    49  
    50  // ServoWriter interface represents an Adaptor which has Servo capabilities
    51  type ServoWriter interface {
    52  	ServoWrite(string, byte) (err error)
    53  }
    54  
    55  // DigitalWriter interface represents an Adaptor which has DigitalWrite capabilities
    56  type DigitalWriter interface {
    57  	DigitalWrite(string, byte) (err error)
    58  }
    59  
    60  // DigitalReader interface represents an Adaptor which has DigitalRead capabilities
    61  type DigitalReader interface {
    62  	DigitalRead(string) (val int, err error)
    63  }