RMT Periperhal rmt translator set context?

Xylopyrographer
Posts: 14
Joined: Sat Mar 06, 2021 12:39 am

RMT Periperhal rmt translator set context?

Postby Xylopyrographer » Fri May 26, 2023 10:52 pm

Can anyone explain, for the RMT peripheral, what the function:

rmt_translator_set_context()

does?
  1. It is needed to transmit data using the RMT controller?
  2. How does it interact with the other RMT functions and structures?
Many thanks.

MicroController
Posts: 1136
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: RMT Periperhal rmt translator set context?

Postby MicroController » Sat May 27, 2023 11:48 am

rmt_translator_set_context can be used to set a "user context" for a specific RMT channel. This means that the void* you pass as the user context can be used for anything your custom translator callback may need as "contextual" information to perform its job. In the callback, you'd then use rmt_translator_get_context to retrieve the pointer/value you previously set for the channel that is currently calling your translator.

So,
It is needed to transmit data using the RMT controller?
No.
How does it interact with the other RMT functions and structures?
It doesn't.
It just allows you to use the same translator function for different channels at the same time and perform the translation according to different contexts you set for different channels, i.e. it allows the translator to be stateful w.r.t. each channel. If your translator callback doesn't need this kind of context information you can just ignore the set_context and get_context functions.

Xylopyrographer
Posts: 14
Joined: Sat Mar 06, 2021 12:39 am

Re: RMT Periperhal rmt translator set context?

Postby Xylopyrographer » Sat May 27, 2023 3:00 pm

Thank-you for the awesome answer. Very much appreciated. Have a great one :) .

Who is online

Users browsing this forum: Bing [Bot] and 123 guests