genericlinux

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: AGPL-3.0 Imports: 30 Imported by: 2

Documentation

Overview

Package genericlinux implements a Linux-based board making heavy use of sysfs (https://en.wikipedia.org/wiki/Sysfs). This does not provide a board model itself but provides the underlying logic for any Linux/sysfs based board.

Package genericlinux is for Linux boards, and this particular file is for GPIO pins using the ioctl interface, indirectly by way of mkch's gpio package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGPIOBoardMappings

func GetGPIOBoardMappings(modelName string, boardInfoMappings map[string]BoardInformation) (map[int]GPIOBoardMapping, error)

GetGPIOBoardMappings attempts to find a compatible board-pin mapping for the given mappings.

func RegisterBoard

func RegisterBoard(modelName string, gpioMappings map[int]GPIOBoardMapping, usePeriphGpio bool)

RegisterBoard registers a sysfs based board of the given model.

Types

type BoardInformation

type BoardInformation struct {
	PinDefinitions []PinDefinition
	Compats        []string
}

BoardInformation details pin definitions and device compatibility for a particular board.

type Config

type Config struct {
	I2Cs              []board.I2CConfig              `json:"i2cs,omitempty"`
	SPIs              []board.SPIConfig              `json:"spis,omitempty"`
	Analogs           []board.AnalogConfig           `json:"analogs,omitempty"`
	DigitalInterrupts []board.DigitalInterruptConfig `json:"digital_interrupts,omitempty"`
	Attributes        config.AttributeMap            `json:"attributes,omitempty"`
}

A Config describes the configuration of a board and all of its connected parts.

func (*Config) Validate

func (config *Config) Validate(path string) error

Validate ensures all parts of the config are valid.

type GPIOBoardMapping

type GPIOBoardMapping struct {
	GPIOChipDev    string
	GPIO           int
	GPIOGlobal     int
	GPIOName       string
	PWMSysFsDir    string
	HWPWMSupported bool
}

GPIOBoardMapping represents a GPIO pin's location locally within a GPIO chip and globally within sysfs.

type NoBoardFoundError

type NoBoardFoundError struct {
	// contains filtered or unexported fields
}

A NoBoardFoundError is returned when no compatible mapping is found for a board during GPIO board mapping.

func (NoBoardFoundError) Error

func (err NoBoardFoundError) Error() string

type PinDefinition

type PinDefinition struct {
	GPIOChipRelativeIDs map[int]int    // ngpio -> relative id
	GPIONames           map[int]string // e.g. ngpio=169=PQ.06 for claraAGXXavier
	GPIOChipSysFSDir    string
	PinNumberBoard      int
	PinNumberBCM        int
	PinNameCVM          string
	PinNameTegraSOC     string
	PWMChipSysFSDir     string // empty for none
	PWMID               int    // -1 for none
}

PinDefinition describes board specific information on how a particular pin can be accessed via sysfs along with information about its PWM capabilities.

Jump to

Keyboard shortcuts

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