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
- Variables
- type ADCPin
- type Applier
- type Button
- type DeviceTree
- type ErrNodeNotFound
- type KnownNode
- type LED
- type Node
- type NodeSearchFn
- type Property
- type PropertyValue
- func Angled(value PropertyValue) PropertyValue
- func Array(values ...PropertyValue) PropertyValue
- func FromValue(val any) PropertyValue
- func Label(label string) PropertyValue
- func NrfPSel(fun string, port, pin uint8) PropertyValue
- func PropertyValueFn(fn func() string) PropertyValue
- func Quoted(value string) PropertyValue
- func String(value string) PropertyValue
- type UART
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 PropertyStatusDisable = NewProperty(PropertyNameStatus, StatusDisabled)
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) UnmarshalYAML ¶
type Applier ¶
type Applier interface {
ApplyOverlay(dt *DeviceTree) error
}
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 Node ¶
type Node struct {
Name, Label string
UnitAddress string
Upsert bool
Properties []Property
SubNodes []*Node
}
func (*Node) AddProperties ¶
func (*Node) FindSpecificNode ¶
func (n *Node) FindSpecificNode(searchFns ...NodeSearchFn) *Node
type NodeSearchFn ¶
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 NrfPSel ¶
func NrfPSel(fun string, port, pin uint8) PropertyValue
NrfPSel Reference: https://docs.zephyrproject.org/apidoc/latest/nrf-pinctrl_8h.html
func PropertyValueFn ¶
func PropertyValueFn(fn func() string) PropertyValue
func Quoted ¶
func Quoted(value string) PropertyValue
func String ¶
func String(value string) PropertyValue
type UART ¶
func (UART) AttachSelf ¶
func (u UART) AttachSelf(dt *DeviceTree) error
Click to show internal directories.
Click to hide internal directories.