Skip to content

Feature Request: iterator as input for RMT transmit #1768

@tschundler

Description

@tschundler

Right now, the smart_leds support is limited significantly, needing to pre-allocate a buffer for RMT symbols. I'd like to send to >1,000 LEDs, but now that needs a buffer of >100kB

Building the RMT symbols is already done internally as an iterator, and the buffer is read with an iterator. There is time for ~2k instructions per byte transmitted, which should be plenty for translating symbols and keeping the RMT's ring buffer full.

Does that seem like a reasonable feature? transmit_iter or IntoIterator for the data?

    fn transmit<'a, D, R, T: Into<u32> + Copy + 'a>(
        self,
        data: D,
    ) -> SingleShotTxTransaction<'a, Self, R, T>
    where
        Self: Sized,
        D: IntoIterator<Item = &'a T, IntoIter = R> + 'a,
        R: Iterator<Item = &'a T> + 'a,

I'll likely try it out myself in the next week if I have time. Also I'm curious to see if I can drive multiple strips at once that way with embassy.

Does anyone have opinions about when to refill the buffer? eg I wonder if I might get better results refilling in 16 byte chunks instead of once it is half depleted (24-32 bytes). That way in async or from the iterator if something eats a little extra time, there's more headroom. Does that seem reasonable? (Reading more into how RMT works, scratch the smaller threshold idea - it won't work, since there seems to be no way to know where the read head of the RMT device is. )

related: #1749 (RMT API changes), esp-rs/esp-hal-community#4 (async LEDs), #787 (original aync RMT pull), #1779 (async RMT only supports 64 pulse codes)
my last experimenting with older/ version of the RMT driver: #355

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions