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
| Property | Value |
|---|---|
| Identifier namespace | All |
| Supports repeat | yes |
| Supports basetype | yes |
| Supports conversion type | yes |
| Supports short properties | yes, see below |
| Supports properties | no |
| Supports subnodes | no |
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