sys

package
v0.0.0-...-8327cd9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package sys wraps necessary linux syscalls to implement GPIO interface.

Index

Constants

View Source
const (
	GPIO_GET_CHIPINFO_IOCTL          = 0x8044b401
	GPIO_GET_LINEINFO_IOCTL          = 0xc048b402
	GPIO_GET_LINEHANDLE_IOCTL        = 0xc16cb403
	GPIOHANDLE_SET_LINE_VALUES_IOCTL = 0xc040b409
	GPIOHANDLE_GET_LINE_VALUES_IOCTL = 0xc040b408
	GPIO_GET_LINEEVENT_IOCTL         = 0xc030b404
)
View Source
const (
	GPIOLINE_FLAG_KERNEL      = 1 << 0
	GPIOLINE_FLAG_IS_OUT      = 1 << 1
	GPIOLINE_FLAG_ACTIVE_LOW  = 1 << 2
	GPIOLINE_FLAG_OPEN_DRAIN  = 1 << 3
	GPIOLINE_FLAG_OPEN_SOURCE = 1 << 4
)
View Source
const (
	GPIOHANDLE_REQUEST_INPUT       = 1 << 0
	GPIOHANDLE_REQUEST_OUTPUT      = 1 << 1
	GPIOHANDLE_REQUEST_ACTIVE_LOW  = 1 << 2
	GPIOHANDLE_REQUEST_OPEN_DRAIN  = 1 << 3
	GPIOHANDLE_REQUEST_OPEN_SOURCE = 1 << 4
)

https://www.kernel.org/doc/Documentation/gpio/gpio.txt https://embeddedartistry.com/blog/2018/6/4/demystifying-microcontroller-gpio-settings#open-drain-output

View Source
const (
	GPIOEVENT_REQUEST_RISING_EDGE  = 1 << 0
	GPIOEVENT_REQUEST_FALLING_EDGE = 1 << 1
	GPIOEVENT_REQUEST_BOTH_EDGES   = GPIOEVENT_REQUEST_RISING_EDGE | GPIOEVENT_REQUEST_FALLING_EDGE
)
View Source
const (
	GPIOEVENT_EVENT_RISING_EDGE  = 0x01
	GPIOEVENT_EVENT_FALLING_EDGE = 0x02
)

Variables

This section is empty.

Functions

func Char32

func Char32(str string) (chars [32]byte)

func Ioctl

func Ioctl(fd int, request uintptr, a uintptr) error

Ioctl call ioctl with one argument and no return value.

func Str32

func Str32(chars [32]byte) string

Types

type FdReader

type FdReader int

FdReader is a unix file descriptor as io.Reader.

func (FdReader) Read

func (fd FdReader) Read(p []byte) (n int, err error)

type GPIOChipInfo

type GPIOChipInfo struct {
	Name  [32]byte
	Label [32]byte
	Lines uint32
}

gpiochip_info

type GPIOEventData

type GPIOEventData struct {
	Timestamp uint64
	ID        uint32
	// contains filtered or unexported fields
}

gpioevent_data

type GPIOEventRequest

type GPIOEventRequest struct {
	LineOffset    uint32
	HandleFlags   uint32
	EventFlags    uint32
	ConsumerLabel [32]byte
	Fd            int32
}

gpioevent_request

type GPIOHandleRequest

type GPIOHandleRequest struct {
	LineOffsets   [64]uint32
	Flags         uint32
	DefaultValues [64]byte
	ConsumerLabel [32]byte
	Lines         uint32
	Fd            int32
}

gpiohandle_request

type GPIOLineInfo

type GPIOLineInfo struct {
	LineOffset uint32
	Flags      uint32
	Name       [32]byte
	Consumer   [32]byte
}

gpioline_info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL