Documentation ¶
Index ¶
- Constants
- Variables
- func GPIOExport(gpio int) error
- func GPIOUnExport(gpio int) error
- type GPIODevice
- func (device *GPIODevice) ChangeMode(mode GPIOMode) (err error)
- func (device *GPIODevice) ChangeValue(value GPIOValue) (err error)
- func (device *GPIODevice) Export() (bool, error)
- func (device *GPIODevice) GetDevicePath() string
- func (device *GPIODevice) GetDirectionPath() string
- func (device *GPIODevice) GetPath() string
- func (device *GPIODevice) GetValuePath() string
- func (device *GPIODevice) IsExported() bool
- func (device *GPIODevice) IsUnExported() bool
- func (device *GPIODevice) Mode() (mode GPIOMode, err error)
- func (device *GPIODevice) UnExport() (bool, error)
- func (device *GPIODevice) Value() (value GPIOValue, err error)
- type GPIOMode
- type GPIOValue
- type IGPIODevice
Constants ¶
View Source
const ( GPIO = "/sys/class/gpio" GPIO_EXPORT = GPIO + "/export" GPIO_UNEXPORT = GPIO + "/unexport" )
Variables ¶
Functions ¶
func GPIOExport ¶
func GPIOUnExport ¶
Types ¶
type GPIODevice ¶
GPIODevice 设备信息
func (*GPIODevice) ChangeMode ¶
func (device *GPIODevice) ChangeMode(mode GPIOMode) (err error)
ChangeMode 改变工作模式
func (*GPIODevice) ChangeValue ¶
func (device *GPIODevice) ChangeValue(value GPIOValue) (err error)
ChangeValue 改变value值
func (*GPIODevice) GetDevicePath ¶
func (device *GPIODevice) GetDevicePath() string
GetDevicePath 获取GPIO设备的 device 路径
func (*GPIODevice) GetDirectionPath ¶
func (device *GPIODevice) GetDirectionPath() string
GetDirectionPath 获取GPIO设备的 direction 路径
func (*GPIODevice) GetValuePath ¶
func (device *GPIODevice) GetValuePath() string
GetValuePath 获取GPIO设备的 value 路径
func (*GPIODevice) IsUnExported ¶
func (device *GPIODevice) IsUnExported() bool
IsUnExported 检查是否已经导出设备引脚
type IGPIODevice ¶
type IGPIODevice interface { GetPath() string GetValuePath() string GetDirectionPath() string GetDevicePath() string Export() (bool, error) UnExport() (bool, error) IsExported() bool IsUnExported() bool Value() (GPIOValue, error) ChangeValue(value GPIOValue) error Mode() (GPIOMode, error) ChangeMode(mode GPIOMode) error }
IGPIODevice GPIO 设备操作接口 /sys/class/gpio/gpio141 active_low device direction edge power subsystem uevent value
Click to show internal directories.
Click to hide internal directories.