RMT: Discussion on "item_number" with rmt_write_items()
Posted: Tue Jan 10, 2017 4:02 am
I'm studying the RMT peripheral and so far enjoying it. While reading the docs on the driver function called "rmt_write_items()" I find myself confused on the parameter called "item_number". See here:
http://esp-idf.readthedocs.io/en/latest ... item32_tib
Let me try and explain ...
The RMT works with items. An item is a 16 bit value where 1 bit indicates high vs low and the remaining 15 bits describe a duration in clock ticks where that signal level will be generated.
The driver however works in data structures called "rmt_item32_t" which are TWO instances of an RMT item contained in 32 bits (2 x 16 bits).
The RMT peripheral consumes RMT items one at a time until it finds an end marker indicated by an item having a duration of length 0.
Hopefully ... all of this so far is simply statement of fact.
Now let us look at the rmt_write_items() API. Among other things it takes a pointer to an array of rmt_item32_t and ... the "item_num". The docs on the "item_num" literally say "RMT data item number". And that's it.
And here's where the confusion comes in. Is this:
a) The number of RMT items being supplied?
b) The number of rmt_item32_t records being supplied?
c) Something else
And ... finally ... given what I said (and believe to be the case) earlier ... why do we need a length when the data has to be self terminated?
http://esp-idf.readthedocs.io/en/latest ... item32_tib
Let me try and explain ...
The RMT works with items. An item is a 16 bit value where 1 bit indicates high vs low and the remaining 15 bits describe a duration in clock ticks where that signal level will be generated.
The driver however works in data structures called "rmt_item32_t" which are TWO instances of an RMT item contained in 32 bits (2 x 16 bits).
The RMT peripheral consumes RMT items one at a time until it finds an end marker indicated by an item having a duration of length 0.
Hopefully ... all of this so far is simply statement of fact.
Now let us look at the rmt_write_items() API. Among other things it takes a pointer to an array of rmt_item32_t and ... the "item_num". The docs on the "item_num" literally say "RMT data item number". And that's it.
And here's where the confusion comes in. Is this:
a) The number of RMT items being supplied?
b) The number of rmt_item32_t records being supplied?
c) Something else
And ... finally ... given what I said (and believe to be the case) earlier ... why do we need a length when the data has to be self terminated?