Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Field

A field is a slice of bits within a fieldset.

Each field must specify their bit address and can be limited in access (RW, RO or WO). All fields must also specify a base type, which is a type that can be converted to and from a bit slice.

This raw type is not always desired, and so those types can be converted to enums and externs. The try keyword here will mark the conversion as ‘fallible’ and is often required when the conversion can fail.

Interaction with the fields from code is done through setters and getters.

Example usage:

let mut reg = MyFieldSet::ZERO;

reg.set_foo(1234);
let foo = reg.foo();

reg.set_bar(MyEnum::A);
let bar = reg.bar()?;

Example

/// doc comment line
field Example[8 stride 4] 8:0 RW -> uint as try Foo

Table

PropertyValue
Identifier namespaceAll
Supports repeatyes
Supports basetypeyes
Supports conversion typeyes
Supports short propertiesyes, see below
Supports propertiesno
Supports subnodesno

Short properties

These properties are specified inline in the node definition and are used without name.

address

The bit address of the field within the fieldset

// range
address: 8:0,
// number
address: 0

Info

  • required: yes
  • multiple allowed: no
  • supports doc comments: no

access

Limits how the field can be accessed. Must be specified unless a default-access is set by a parent object.

// access specifier
access: RW

Info

  • required: no
  • multiple allowed: no
  • supports doc comments: no