devicetree

package
v0.0.0-...-eba9e3c Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

This package provides reasonable functionality to define overlay files for the boards.

Primary purpose of this package is not to provide complete implementation of [Devicetree](https://www.devicetree.org/), but to allow features required by this project to be defined in code and then generated to an overlay file.

It is highly possible that this will remain as low-level implementation of devicetree generator, while high-level package/type with required node definitions will be added later.

See also: https://docs.zephyrproject.org/3.4.0/build/dts/index.html

Index

Constants

View Source
const NodeLabelPinctrl = "pinctrl"
View Source
const NodeNameAliases = "aliases"
View Source
const NodeNameChosen = "chosen"
View Source
const NodeNameRoot = "/"
View Source
const PropertyNameCompatible = "compatible"
View Source
const PropertyNameStatus = "status"
View Source
const StatusDisabled = rawValue(`"disabled"`)
View Source
const StatusOkay = rawValue(`"okay"`)

Variables

View Source
var PropertyStatusEnable = NewProperty(PropertyNameStatus, StatusOkay)

Functions

This section is empty.

Types

type ADCPin

type ADCPin struct {
	// Define configurations,
	// as not all usages will be equal
	Gain            string
	Reference       string
	Resolution      uint8
	Oversampling    uint8
	AcquisitionTime aquisitionTime `yaml:"acquisition_time"`

	Pin types.Pin
}

func (ADCPin) AttachSelf

func (p ADCPin) AttachSelf(dt *DeviceTree) error

func (ADCPin) Name

func (p ADCPin) Name() string

func (*ADCPin) UnmarshalYAML

func (p *ADCPin) UnmarshalYAML(node *yaml.Node) error

type Applier

type Applier interface {
	ApplyOverlay(dt *DeviceTree) error
}

type Button

type Button interface {
	KnownNode
	// contains filtered or unexported methods
}

func NewButton

func NewButton(btnPin types.Pin) Button

type DeviceTree

type DeviceTree struct {
	Nodes []*Node
}

func NewDeviceTree

func NewDeviceTree() *DeviceTree

func (*DeviceTree) AddNodes

func (t *DeviceTree) AddNodes(nodes ...*Node) *DeviceTree

func (*DeviceTree) FindSpecificNode

func (t *DeviceTree) FindSpecificNode(searchFns ...NodeSearchFn) *Node

func (*DeviceTree) WriteTo

func (t *DeviceTree) WriteTo(w io.StringWriter) error

type ErrNodeNotFound

type ErrNodeNotFound string

func (ErrNodeNotFound) Error

func (f ErrNodeNotFound) Error() string

type KnownNode

type KnownNode interface {
	AttachSelf(dt *DeviceTree) error
}

type LED

type LED interface {
	KnownNode
	// contains filtered or unexported methods
}

func NewLED

func NewLED(ledPin types.Pin) LED

type Node

type Node struct {
	Name, Label string
	UnitAddress string
	Upsert      bool

	Properties []Property

	SubNodes []*Node
}

func (*Node) AddNodes

func (n *Node) AddNodes(nodes ...*Node) *Node

func (*Node) AddProperties

func (n *Node) AddProperties(props ...Property) *Node

func (*Node) FindSpecificNode

func (n *Node) FindSpecificNode(searchFns ...NodeSearchFn) *Node

func (*Node) Ref

func (n *Node) Ref() string

func (*Node) WriteTo

func (n *Node) WriteTo(w io.StringWriter) error

type NodeSearchFn

type NodeSearchFn func(n *Node) bool

func SearchByLabel

func SearchByLabel(label string) NodeSearchFn

func SearchByName

func SearchByName(name string) NodeSearchFn

type Property

type Property struct {
	Name  string
	Value PropertyValue
}

func NewProperty

func NewProperty(name string, value PropertyValue) Property

type PropertyValue

type PropertyValue interface {
	Value() string
}

func Angled

func Angled(value PropertyValue) PropertyValue

func Array

func Array(values ...PropertyValue) PropertyValue

func FromValue

func FromValue(val any) PropertyValue

func Label

func Label(label string) PropertyValue

func PropertyValueFn

func PropertyValueFn(fn func() string) PropertyValue

func Quoted

func Quoted(value string) PropertyValue

func String

func String(value string) PropertyValue

type UART

type UART struct {
	Tx, Rx types.Pin
}

func (UART) AttachSelf

func (u UART) AttachSelf(dt *DeviceTree) error

Jump to

Keyboard shortcuts

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