Skip to content

Software/Hardware Task interfaction with RTIC v2 #907

@robamu

Description

@robamu

Hello,

I am trying to migrate a project to RTIC v2.
I managed to make everything compile now, but I am looking for a way to replace a feature which is not there anymore.
I have a serial UART ISR handler function like this:

    #[task(binds = USART2_EXTI26, shared = [rx_transfer, tx_transfer])]
    fn serial_isr(mut cx: serial_isr::Context) {
        /* ... Some stuff ... */
        // serial_tx_handler::spawn_after(MsDuration::from_ticks(
        // MIN_DELAY_BETWEEN_TX_PACKETS_MS.into(),
        //))
        //.unwrap();
        // TODO: We actually need the delay here.. how do we do this?
        serial_tx_handler::spawn().ok();
    }

I want to spawn a regular software task from that ISR after a delay. My understanding is that I still need to keep the ISR as short as possible, so I do not want to delay there. What is the cleanest or intended way to do this with RTIC v2?

One option I considered was to simply put a delay as the first thing in my serial_tx_handler at the start. If that delay is to be optional, I could share something like a boolean inside the shared tx_transfer struct. Is this a viable way or are there better alternatives?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions