Buffer
Buffers are used to represent a stream of bytes on a device. This could for example be a fifo on a radio. It’s quite a simple construct and thus is limited in configuration options.
It defines an operation on the block it’s part of. Buffer functionality is implemented in the runtime through the BufferOperation which can be used to read and write from/to the buffer. This operation type also implements the embedded-io traits when the cargo feature is activated on the runtime.
Example usage:
let mut device = MyDevice::new(DeviceInterface::new());
device.foo().write_all(&[0, 1, 2, 3]).unwrap();
let mut buffer = [0; 8];
let len = device.bar().read(&mut buffer).unwrap();
Example
/// doc comment line
buffer Example {
access: RW,
address: 0,
}
Table
| Property | Value |
|---|---|
| Identifier namespace | Operation |
| Supports repeat | no |
| Supports basetype | no |
| Supports conversion type | no |
| Supports short properties | no |
| Supports properties | yes, see below |
| Supports subnodes | no |
Long properties
These properties are specified in the node body.
access
Limits how the buffer 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
address
The address of the buffer
// number
address: 0
Info
- required:
yes - multiple allowed:
no - supports doc comments:
no