Documentation
¶
Overview ¶
Package uapi provides the Linux GPIO UAPI definitions for gpiod.
Package uapi provides the Linux GPIO UAPI definitions for gpiod.
Index ¶
- Constants
- func BytesToString(a []byte) string
- func GetLine(fd uintptr, request *LineRequest) error
- func GetLineEvent(fd uintptr, request *EventRequest) error
- func GetLineHandle(fd uintptr, request *HandleRequest) error
- func GetLineValues(fd uintptr, values *HandleData) error
- func GetLineValuesV2(fd uintptr, values *LineValues) error
- func SetLineConfig(fd uintptr, config *HandleConfig) error
- func SetLineConfigV2(fd uintptr, config *LineConfig) error
- func SetLineValues(fd uintptr, values HandleData) error
- func SetLineValuesV2(fd uintptr, values LineValues) error
- func UnwatchLineInfo(fd uintptr, offset uint32) error
- func WatchLineInfo(fd uintptr, info *LineInfo) error
- func WatchLineInfoV2(fd uintptr, info *LineInfoV2) error
- type ChangeType
- type ChipInfo
- type DebouncePeriod
- type EventData
- type EventFlag
- type EventRequest
- type HandleConfig
- type HandleData
- type HandleFlag
- func (f HandleFlag) HasBiasFlag() bool
- func (f HandleFlag) IsActiveLow() bool
- func (f HandleFlag) IsBiasDisable() bool
- func (f HandleFlag) IsInput() bool
- func (f HandleFlag) IsOpenDrain() bool
- func (f HandleFlag) IsOpenSource() bool
- func (f HandleFlag) IsOutput() bool
- func (f HandleFlag) IsPullDown() bool
- func (f HandleFlag) IsPullUp() bool
- type HandleRequest
- type LineAttribute
- type LineAttributeID
- type LineBitmap
- type LineConfig
- type LineConfigAttribute
- type LineEvent
- type LineEventID
- type LineFlag
- type LineFlagV2
- func (f *LineFlagV2) Decode(la LineAttribute)
- func (f LineFlagV2) Encode() (la LineAttribute)
- func (f LineFlagV2) HasRealtimeEventClock() bool
- func (f LineFlagV2) IsActiveLow() bool
- func (f LineFlagV2) IsAvailable() bool
- func (f LineFlagV2) IsBiasDisabled() bool
- func (f LineFlagV2) IsBiasPullDown() bool
- func (f LineFlagV2) IsBiasPullUp() bool
- func (f LineFlagV2) IsBothEdges() bool
- func (f LineFlagV2) IsFallingEdge() bool
- func (f LineFlagV2) IsInput() bool
- func (f LineFlagV2) IsOpenDrain() bool
- func (f LineFlagV2) IsOpenSource() bool
- func (f LineFlagV2) IsOutput() bool
- func (f LineFlagV2) IsRisingEdge() bool
- func (f LineFlagV2) IsUsed() bool
- type LineInfo
- type LineInfoChanged
- type LineInfoChangedV2
- type LineInfoV2
- type LineRequest
- type LineValues
- type OutputValues
Constants ¶
const ( // LinesMax is the maximum number of lines that can be requested in a single // request. LinesMax int = 64 )
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString is a helper function that converts strings stored in byte arrays, as returned by GetChipInfo and GetLineInfo, into strings.
func GetLine ¶
func GetLine(fd uintptr, request *LineRequest) error
GetLine requests a line from the GPIO character device.
The fd is an open GPIO character device. The lines must not already be requested. The flags in the request will be applied to all lines in the request. If successful, the fd for the line is returned in the request.fd.
func GetLineEvent ¶
func GetLineEvent(fd uintptr, request *EventRequest) error
GetLineEvent requests a line from the GPIO character device with event reporting enabled.
The fd is an open GPIO character device. The line must be an input and must not already be requested. If successful, the fd for the line is returned in the request.fd.
func GetLineHandle ¶
func GetLineHandle(fd uintptr, request *HandleRequest) error
GetLineHandle requests a line from the GPIO character device.
This request is without event reporting. The fd is an open GPIO character device. The lines must not already be requested. The flags in the request will be applied to all lines in the request. If successful, the fd for the line is returned in the request.fd.
func GetLineValues ¶
func GetLineValues(fd uintptr, values *HandleData) error
GetLineValues returns the values of a set of requested lines.
The fd is a requested line, as returned by GetLineHandle or GetLineEvent.
func GetLineValuesV2 ¶
func GetLineValuesV2(fd uintptr, values *LineValues) error
GetLineValuesV2 returns the values of a set of requested lines.
The fd is a requested line, as returned by GetLine.
The values returned are the logical values, with inactive being 0.
func SetLineConfig ¶
func SetLineConfig(fd uintptr, config *HandleConfig) error
SetLineConfig sets the config of an existing handle request.
The config flags in the request will be applied to all lines in the handle request.
func SetLineConfigV2 ¶
func SetLineConfigV2(fd uintptr, config *LineConfig) error
SetLineConfigV2 sets the config of an existing handle request.
The config flags in the request will be applied to all lines in the request.
func SetLineValues ¶
func SetLineValues(fd uintptr, values HandleData) error
SetLineValues sets the values of a set of requested lines.
The fd is a requested line, as returned by GetLineHandle or GetLineEvent.
func SetLineValuesV2 ¶
func SetLineValuesV2(fd uintptr, values LineValues) error
SetLineValuesV2 sets the values of a set of requested lines.
The fd is a requested line, as returned by GetLine.
func UnwatchLineInfo ¶
UnwatchLineInfo clears a watch on info of a line.
Disables the watch on info for the line.
func WatchLineInfo ¶
WatchLineInfo sets a watch on info of a line.
A watch is set on the line indicated by info.Offset. If successful the current line info is returned, else an error is returned.
func WatchLineInfoV2 ¶
func WatchLineInfoV2(fd uintptr, info *LineInfoV2) error
WatchLineInfoV2 sets a watch on info of a line.
A watch is set on the line indicated by info.Offset. If successful the current line info is returned, else an error is returned.
Types ¶
type ChangeType ¶
type ChangeType uint32
ChangeType indicates the type of change that has occurred to a line.
const ( // LineChangedRequested indicates the line has been requested. LineChangedRequested ChangeType // LineChangedReleased indicates the line has been released. LineChangedReleased // LineChangedConfig indicates the line configuration has changed. LineChangedConfig )
type ChipInfo ¶
type ChipInfo struct { // The system name of the device. Name [nameSize]byte // An identifying label added by the device driver. Label [nameSize]byte // The number of lines supported by this chip. Lines uint32 }
ChipInfo contains the details of a GPIO chip.
func GetChipInfo ¶
GetChipInfo returns the ChipInfo for the GPIO character device.
The fd is an open GPIO character device.
type DebouncePeriod ¶
DebouncePeriod specifies the time the line must be stable before a level transition is recognized.
func (*DebouncePeriod) Decode ¶
func (d *DebouncePeriod) Decode(la LineAttribute)
Decode populates the DebouncePeriod with value from the LineAttribute.
func (DebouncePeriod) Encode ¶
func (d DebouncePeriod) Encode() (la LineAttribute)
Encode creates a LineAttribute with the value from the DebouncePeriod.
type EventData ¶
type EventData struct { // The time the event was detected. Timestamp uint64 // The type of event detected. ID EventFlag // contains filtered or unexported fields }
EventData contains the details of a particular line event.
This is returned via the event request fd in response to events.
type EventFlag ¶
type EventFlag uint32
EventFlag indicates the types of events that will be reported.
const ( // EventRequestRisingEdge requests rising edge events. // This means a transition from a low logical state to a high logical state. // For active high lines (the default) this means a transition from a // physical low to a physical high. // Note that for active low lines this means a transition from a physical // high to a physical low. EventRequestRisingEdge EventFlag = 1 << iota // EventRequestFallingEdge requests falling edge events. // This means a transition from a high logical state to a low logical state. // For active high lines (the default) this means a transition from a // physical high to a physical low. // Note that for active low lines this means a transition from a physical // low to a physical high. EventRequestFallingEdge // EventRequestBothEdges requests both rising and falling edge events. // This is equivalent to requesting both EventRequestRisingEdge and // EventRequestRisingEdge. EventRequestBothEdges = EventRequestRisingEdge | EventRequestFallingEdge )
func (EventFlag) IsBothEdges ¶
IsBothEdges returns true if both rising and falling edge events have been requested.
func (EventFlag) IsFallingEdge ¶
IsFallingEdge returns true if falling edge events have been requested.
func (EventFlag) IsRisingEdge ¶
IsRisingEdge returns true if rising edge events have been requested.
type EventRequest ¶
type EventRequest struct { // The line to be requested. Offset uint32 // The line flags applied to this line. HandleFlags HandleFlag // The type of events to report. EventFlags EventFlag // The string identifying the requester to be applied to the line. Consumer [nameSize]byte // The file handle for the requested line. // Set if the request is successful. Fd int32 }
EventRequest is a request for control of a line with event reporting enabled.
type HandleConfig ¶
type HandleConfig struct { // The flags to be applied to the lines. Flags HandleFlag // The default values to be applied to output lines (when // HandleRequestOutput is set in the Flags). DefaultValues [HandlesMax]uint8 // contains filtered or unexported fields }
HandleConfig is a request to change the config of an existing request.
Can be applied to both handle and event requests. Event requests cannot be reconfigured to outputs.
type HandleData ¶
type HandleData [HandlesMax]uint8
HandleData contains the logical value for each line. Zero is a logical low and any other value is a logical high.
type HandleFlag ¶
type HandleFlag uint32
HandleFlag contains the
const ( // HandleRequestInput requests the line as an input. // // This is ignored if Output is also set. HandleRequestInput HandleFlag = 1 << iota // HandleRequestOutput requests the line as an output. // // This takes precedence over Input, if both are set. HandleRequestOutput // HandleRequestActiveLow requests the line be made active low. HandleRequestActiveLow // HandleRequestOpenDrain requests the line be made open drain. // // This option requires the line to be requested as an Output. // This cannot be set at the same time as OpenSource. HandleRequestOpenDrain // HandleRequestOpenSource requests the line be made open source. // // This option requires the line to be requested as an Output. // This cannot be set at the same time as OpenDrain. HandleRequestOpenSource // HandleRequestPullUp requests the line have pull-up enabled. HandleRequestPullUp // HandleRequestPullDown requests the line have pull-down enabled. HandleRequestPullDown // HandleRequestBiasDisable requests the line have bias disabled. HandleRequestBiasDisable // HandlesMax is the maximum number of lines that can be requested in a // single request. HandlesMax = 64 )
func (HandleFlag) HasBiasFlag ¶
func (f HandleFlag) HasBiasFlag() bool
HasBiasFlag returns true if any bias flags are set.
func (HandleFlag) IsActiveLow ¶
func (f HandleFlag) IsActiveLow() bool
IsActiveLow returns true if the line is requested as a active low.
func (HandleFlag) IsBiasDisable ¶
func (f HandleFlag) IsBiasDisable() bool
IsBiasDisable returns true if the line is requested with bias disabled.
func (HandleFlag) IsInput ¶
func (f HandleFlag) IsInput() bool
IsInput returns true if the line is requested as an input.
func (HandleFlag) IsOpenDrain ¶
func (f HandleFlag) IsOpenDrain() bool
IsOpenDrain returns true if the line is requested as an open drain.
func (HandleFlag) IsOpenSource ¶
func (f HandleFlag) IsOpenSource() bool
IsOpenSource returns true if the line is requested as an open source.
func (HandleFlag) IsOutput ¶
func (f HandleFlag) IsOutput() bool
IsOutput returns true if the line is requested as an output.
func (HandleFlag) IsPullDown ¶
func (f HandleFlag) IsPullDown() bool
IsPullDown returns true if the line is requested with pull-down enabled.
func (HandleFlag) IsPullUp ¶
func (f HandleFlag) IsPullUp() bool
IsPullUp returns true if the line is requested with pull-up enabled.
type HandleRequest ¶
type HandleRequest struct { // The lines to be requested. Offsets [HandlesMax]uint32 // The flags to be applied to the lines. Flags HandleFlag // The default values to be applied to output lines. DefaultValues [HandlesMax]uint8 // The string identifying the requester to be applied to the lines. Consumer [nameSize]byte // The number of lines being requested. Lines uint32 // The file handle for the requested lines. // Set if the request is successful. Fd int32 }
HandleRequest is a request for control of a set of lines. The lines must all be on the same GPIO chip.
type LineAttribute ¶
type LineAttribute struct { ID LineAttributeID Padding [1]uint32 Value [8]byte }
LineAttribute defines a configuration attribute for a line.
func (*LineAttribute) Encode32 ¶
func (la *LineAttribute) Encode32(id LineAttributeID, value uint32)
Encode32 populates the LineAttribute using the id and 32-bit value.
func (*LineAttribute) Encode64 ¶
func (la *LineAttribute) Encode64(id LineAttributeID, value uint64)
Encode64 populates the LineAttribute using the id and 64-bit value.
func (LineAttribute) Value32 ¶
func (la LineAttribute) Value32() uint32
Value32 returns the 32-bit value from the LineAttribute.
func (LineAttribute) Value64 ¶
func (la LineAttribute) Value64() uint64
Value64 returns the 64-bit value from the LineAttribute.
type LineAttributeID ¶
type LineAttributeID uint32
LineAttributeID identfies the type of a configuration attribute.
const ( // LineAttributeIDFlags indicates the attribute contains LineFlagV2 flags. LineAttributeIDFlags LineAttributeID = iota + 1 // LineAttributeIDOutputValues indicates the attribute contains line output values. LineAttributeIDOutputValues // LineAttributeIDDebounce indicates the attribute contains a debounce period. LineAttributeIDDebounce )
type LineBitmap ¶
type LineBitmap uint64
LineBitmap is a bitmap containing a bit for each line.
func NewLineBitMask ¶
func NewLineBitMask(n int) LineBitmap
NewLineBitMask returns a mask of n bits.
func NewLineBitmap ¶
func NewLineBitmap(vv ...int) LineBitmap
NewLineBitmap creates a bitmap from an array of bit values.
func NewLineBits ¶
func NewLineBits(vv ...int) LineBitmap
NewLineBits creates a new LineBitmap from an array of bit numbers.
func (LineBitmap) Set ¶
func (lb LineBitmap) Set(n, v int) LineBitmap
Set sets the value of the nth bit.
type LineConfig ¶
type LineConfig struct { // The flags to be applied to the lines. Flags LineFlagV2 NumAttrs uint32 // reserved for future use. Padding [lineConfigPadSize]uint32 Attrs [10]LineConfigAttribute }
LineConfig contains the configuration of a line.
func (*LineConfig) AddAttribute ¶
func (lc *LineConfig) AddAttribute(lca LineConfigAttribute)
AddAttribute adds an attribute to the configuration.
This is an unconditional add - it performs no filtering or consistency checking other than limiting the number of attributes.
func (*LineConfig) RemoveAttribute ¶
func (lc *LineConfig) RemoveAttribute(lca LineConfigAttribute)
RemoveAttribute removes an attribute from the configuration.
func (*LineConfig) RemoveAttributeID ¶
func (lc *LineConfig) RemoveAttributeID(id LineAttributeID)
RemoveAttributeID removes all attributes with a given ID from the configuration.
type LineConfigAttribute ¶
type LineConfigAttribute struct { // Attr contains the configuration attribute. Attr LineAttribute // Mask identifies the lines to which this attribute applies. // // This is a bitmap of lines in LineRequest.Offsets. Mask LineBitmap }
LineConfigAttribute associates a configuration attribute with one or more requested lines.
type LineEvent ¶
type LineEvent struct { // The time the event was detected. Timestamp uint64 // The type of event detected. ID LineEventID // The line that triggered the event. Offset uint32 // The seqno for this event in all events on all lines in this line request. Seqno uint32 // The seqno for this event in all events in this line. LineSeqno uint32 // reserved for future use Padding [lineEventPadSize]uint32 }
LineEvent contains the details of a particular line event.
This is returned via the event request fd in response to events.
func ReadLineEvent ¶
ReadLineEvent reads a single event from a requested line.
The fd is a requested line, as returned by GetLine.
This function is blocking and should only be called when the fd is known to be ready to read.
type LineEventID ¶
type LineEventID uint32
LineEventID indicates the type of event detected.
const ( // LineEventRisingEdge indicates the event is a rising edge. LineEventRisingEdge LineEventID = iota + 1 // LineEventFallingEdge indicates the event is a falling edge. LineEventFallingEdge )
type LineFlag ¶
type LineFlag uint32
LineFlag are the flags for a line.
const ( // LineFlagUsed indicates that the line has been requested. // It may have been requested by this process or another process. // The line cannot be requested again until this flag is clear. LineFlagUsed LineFlag = 1 << iota // LineFlagIsOut indicates that the line is an output. LineFlagIsOut // LineFlagActiveLow indicates that the line is active low. LineFlagActiveLow // LineFlagOpenDrain indicates that the line will pull low when set low but // float when set high. This flag only applies to output lines. // An output cannot be both open drain and open source. LineFlagOpenDrain // LineFlagOpenSource indicates that the line will pull high when set high // but float when set low. This flag only applies to output lines. // An output cannot be both open drain and open source. LineFlagOpenSource // LineFlagPullUp indicates that the internal line pull up is enabled. LineFlagPullUp // LineFlagPullDown indicates that the internal line pull down is enabled. LineFlagPullDown // LineFlagBiasDisabled indicates that the internal line bias is disabled. LineFlagBiasDisabled )
func (LineFlag) IsActiveLow ¶
IsActiveLow returns true if the line is active low.
func (LineFlag) IsBiasDisable ¶
IsBiasDisable returns true if the line has bias disabled.
func (LineFlag) IsOpenDrain ¶
IsOpenDrain returns true if the line is open-drain.
func (LineFlag) IsOpenSource ¶
IsOpenSource returns true if the line is open-source.
func (LineFlag) IsPullDown ¶
IsPullDown returns true if the line has pull-down enabled.
type LineFlagV2 ¶
type LineFlagV2 uint64
LineFlagV2 are the flags for a line.
const ( // LineFlagV2Used indicates that the line is already in use. // It may have been requested by this process or another process, // or may be reserved by the kernel. // // The line cannot be requested until this flag is clear. LineFlagV2Used LineFlagV2 = 1 << iota // LineFlagV2ActiveLow indicates that the line is active low. LineFlagV2ActiveLow // LineFlagV2Input indicates that the line direction is an input. LineFlagV2Input // LineFlagV2Output indicates that the line direction is an output. LineFlagV2Output // LineFlagV2EdgeRising indicates that edge detection is enabled for rising // edges. LineFlagV2EdgeRising // LineFlagV2EdgeFalling indicates that edge detection is enabled for // falling edges. LineFlagV2EdgeFalling // LineFlagV2OpenDrain indicates that the line drive is open drain. LineFlagV2OpenDrain // LineFlagV2OpenSource indicates that the line drive is open source. LineFlagV2OpenSource // LineFlagV2BiasPullUp indicates that the line bias is pull-up. LineFlagV2BiasPullUp // LineFlagV2BiasPullDown indicates that the line bias is set pull-down. LineFlagV2BiasPullDown // LineFlagV2BiasDisabled indicates that the line bias is disabled. LineFlagV2BiasDisabled // LineFlagV2EventClockRealtime indicates that the CLOCK_REALTIME will be // the source for event timestamps. LineFlagV2EventClockRealtime // LineFlagV2DirectionMask is a mask for all direction flags. LineFlagV2DirectionMask = LineFlagV2Input | LineFlagV2Output // LineFlagV2EdgeMask is a mask for all edge flags. LineFlagV2EdgeMask = LineFlagV2EdgeRising | LineFlagV2EdgeFalling // LineFlagV2EdgeBoth is a helper value for selecting edge detection on // both edges. LineFlagV2EdgeBoth = LineFlagV2EdgeMask // LineFlagV2DriveMask is a mask for all drive flags. LineFlagV2DriveMask = LineFlagV2OpenDrain | LineFlagV2OpenSource // LineFlagV2BiasMask is a mask for all bias flags. LineFlagV2BiasMask = LineFlagV2BiasDisabled | LineFlagV2BiasPullUp | LineFlagV2BiasPullDown )
func (*LineFlagV2) Decode ¶
func (f *LineFlagV2) Decode(la LineAttribute)
Decode populates the LineFlagV2 with value from the LineAttribute.
func (LineFlagV2) Encode ¶
func (f LineFlagV2) Encode() (la LineAttribute)
Encode creates a LineAttribute with the value from the LineFlagV2.
func (LineFlagV2) HasRealtimeEventClock ¶
func (f LineFlagV2) HasRealtimeEventClock() bool
HasRealtimeEventClock returns true if the line events will contain real-time timestamps.
func (LineFlagV2) IsActiveLow ¶
func (f LineFlagV2) IsActiveLow() bool
IsActiveLow returns true if the line is active low.
func (LineFlagV2) IsAvailable ¶
func (f LineFlagV2) IsAvailable() bool
IsAvailable returns true if the line is available to be requested.
func (LineFlagV2) IsBiasDisabled ¶
func (f LineFlagV2) IsBiasDisabled() bool
IsBiasDisabled returns true if the line has bias disabled.
func (LineFlagV2) IsBiasPullDown ¶
func (f LineFlagV2) IsBiasPullDown() bool
IsBiasPullDown returns true if the line has pull-down bias enabled.
func (LineFlagV2) IsBiasPullUp ¶
func (f LineFlagV2) IsBiasPullUp() bool
IsBiasPullUp returns true if the line has pull-up bias enabled.
func (LineFlagV2) IsBothEdges ¶
func (f LineFlagV2) IsBothEdges() bool
IsBothEdges returns true if the line has edge detection on both edges.
func (LineFlagV2) IsFallingEdge ¶
func (f LineFlagV2) IsFallingEdge() bool
IsFallingEdge returns true if the line has edge detection on the falling edge.
func (LineFlagV2) IsInput ¶
func (f LineFlagV2) IsInput() bool
IsInput returns true if the line is an input.
func (LineFlagV2) IsOpenDrain ¶
func (f LineFlagV2) IsOpenDrain() bool
IsOpenDrain returns true if the line is an open drain.
func (LineFlagV2) IsOpenSource ¶
func (f LineFlagV2) IsOpenSource() bool
IsOpenSource returns true if the line is an open source.
func (LineFlagV2) IsOutput ¶
func (f LineFlagV2) IsOutput() bool
IsOutput returns true if the line is an output.
func (LineFlagV2) IsRisingEdge ¶
func (f LineFlagV2) IsRisingEdge() bool
IsRisingEdge returns true if the line has edge detection on the rising edge.
func (LineFlagV2) IsUsed ¶
func (f LineFlagV2) IsUsed() bool
IsUsed returns true if the line is not available to be requested.
type LineInfo ¶
type LineInfo struct { // The offset of the line within the chip. Offset uint32 // The line flags applied to this line. Flags LineFlag // The system name for this line. Name [nameSize]byte // If requested, a string added by the requester to identify the // owner of the request. Consumer [nameSize]byte }
LineInfo contains the details of a single line of a GPIO chip.
type LineInfoChanged ¶
type LineInfoChanged struct { // The updated info. Info LineInfo // The time the change occurred. Timestamp uint64 // The type of change. Type ChangeType // contains filtered or unexported fields }
LineInfoChanged contains the details of a change to line info.
This is returned via the chip fd in response to changes to watched lines.
func ReadLineInfoChanged ¶
func ReadLineInfoChanged(fd uintptr) (LineInfoChanged, error)
ReadLineInfoChanged reads a line info changed event from a chip.
The fd is an open GPIO character device.
This function is blocking and should only be called when the fd is known to be ready to read.
type LineInfoChangedV2 ¶
type LineInfoChangedV2 struct { // The updated info. Info LineInfoV2 // The time the change occurred. Timestamp uint64 // The type of change. Type ChangeType // reserved for future use. Padding [lineInfoChangedV2PadSize]uint32 }
LineInfoChangedV2 contains the details of a change to line info.
This is returned via the chip fd in response to changes to watched lines.
func ReadLineInfoChangedV2 ¶
func ReadLineInfoChangedV2(fd uintptr) (LineInfoChangedV2, error)
ReadLineInfoChangedV2 reads a line info changed event from a chip.
The fd is an open GPIO character device.
This function is blocking and should only be called when the fd is known to be ready to read.
type LineInfoV2 ¶
type LineInfoV2 struct { // The system name for this line. Name [nameSize]byte // If requested, a string added by the requester to identify the // owner of the request. Consumer [nameSize]byte // The offset of the line within the chip. Offset uint32 NumAttrs uint32 Flags LineFlagV2 Attrs [10]LineAttribute // reserved for future use. Padding [lineInfoV2PadSize]uint32 }
LineInfoV2 contains the details of a single line of a GPIO chip.
func GetLineInfoV2 ¶
func GetLineInfoV2(fd uintptr, offset int) (LineInfoV2, error)
GetLineInfoV2 returns the LineInfoV2 for one line from the GPIO character device.
The fd is an open GPIO character device. The offset is zero based.
type LineRequest ¶
type LineRequest struct { // The lines to be requested. Offsets [LinesMax]uint32 // The string identifying the requester to be applied to the lines. Consumer [nameSize]byte // The configuration for the requested lines Config LineConfig // The number of lines being requested. Lines uint32 // Minimum size of the event buffer. EventBufferSize uint32 // reserved for future use. Padding [lineRequestPadSize]uint32 // The file handle for the requested lines. // Set if the request is successful. Fd int32 }
LineRequest is a request for control of a set of lines. The lines must all be on the same GPIO chip.
type LineValues ¶
type LineValues struct { // Bits contains the logical value of the the lines. // // Zero is a logical low (inactive) and 1 is a logical high (active). // // This is a bitmap of lines in LineRequest.Offsets. Bits LineBitmap // Mask identifies the lines to which this attribute applies. // // This is a bitmap of lines in LineRequest.Offsets. Mask LineBitmap }
LineValues contains the output values for a set of lines.
type OutputValues ¶
type OutputValues LineBitmap
OutputValues specify the active level of output lines.
func (*OutputValues) Decode ¶
func (ov *OutputValues) Decode(la LineAttribute)
Decode populates the OutputValues with values from the LineAttribute.
func (OutputValues) Encode ¶
func (ov OutputValues) Encode() (la LineAttribute)
Encode creates a LineAttribute with the values from the OutputValues.