Requested writes, in any order.
Device limits and the FC06/FC16 preference.
Transactions to issue, in ascending address order.
// 2000..2003 contiguous, 2010 alone
planWrites([
{ address: 2003, value: 40 },
{ address: 2000, value: 10 },
{ address: 2010, value: 99 },
{ address: 2001, value: 20 },
{ address: 2002, value: 30 },
]);
// [
// { kind: 'multiple', address: 2000, values: Uint16Array [10, 20, 30, 40] },
// { kind: 'single', address: 2010, value: 99 },
// ]
Packs register writes into the fewest transactions that cover them.
The planner sorts by address, groups contiguous addresses into runs, splits each run at
maxRegistersPerWrite, and emits FC16 for a run of at leastminRunLengthregisters or FC06 for anything shorter.When the same address appears more than once, the last write wins. This matches a caller that supersedes a pending value rather than queueing behind it, and it is the only rule under which the plan is order-independent for distinct addresses.