Skip to main content

spmi_read_contiguous

Macro spmi_read_contiguous 

Source
macro_rules! spmi_read_contiguous {
    (
        $regs:expr,
        $head:ident $(, $tail:ident )* $(,)?
    ) => { ... };
}
Expand description

Reads multiple contiguous registers in a single async call to the hardware.

This macro accepts an SPMI device proxy and a list of register modules, calculates the base address and combined size, and performs a single async contiguous read.

§Arguments

  1. $spmi:expr: The SPMI device proxy.
  2. $( $reg:ident ),*: A comma-separated list of already-declared register modules.

§Examples

// Read both 'general' and 'status' registers together, update,
// and write back:
// let regs = MySpmiRegisters::new(spmi_proxy);
let (mut general_val, status_val) = spmi_read_contiguous!(
    &regs,
    my_reg,
    status_be_reg
).await?;

general_val = general_val.set_field1(true);

spmi_write_contiguous!(
    &regs,
    my_reg => general_val,
    status_be_reg => status_val
).await?;