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

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

PropertyValue
Identifier namespaceOperation
Supports repeatno
Supports basetypeno
Supports conversion typeno
Supports short propertiesno
Supports propertiesyes, see below
Supports subnodesno

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