|
M5Unit-INFRARED 0.2.0 git rev:76ad9e1
|
RMT item helper functions for IR protocols. More...
#include "ir_codec.hpp"Go to the source code of this file.
Namespaces | |
| namespace | m5 |
| Top level namespace of M5Stack. | |
Functions | |
| gpio::m5_rmt_item_t | m5::unit::ir::makeItem (uint16_t mark_us, uint16_t space_us) |
| Create an RMT item representing a mark (carrier burst) followed by a space (silence) | |
| gpio::m5_rmt_item_t | m5::unit::ir::makeTerminator (uint16_t mark_us) |
| Create a terminator RMT item (mark only, no space) | |
| bool | m5::unit::ir::matchDuration (uint16_t actual, uint16_t expected, uint16_t tolerance) |
| Check if a duration matches an expected value within tolerance. | |
| void | m5::unit::ir::encodePulseDistance (item_container_type &items, uint32_t data, uint8_t bits, uint16_t bit_mark, uint16_t one_space, uint16_t zero_space, bool lsb_first=true) |
| Encode a sequence of bits as pulse-distance modulated RMT items (NEC-style) | |
| uint32_t | m5::unit::ir::decodePulseDistance (const gpio::m5_rmt_item_t *items, uint32_t num, uint32_t &data, uint8_t bits, uint16_t bit_mark, uint16_t one_space, uint16_t zero_space, uint16_t tolerance, bool lsb_first=true) |
| Decode pulse-distance modulated RMT items into a data value. | |
| void | m5::unit::ir::encodePulseWidth (item_container_type &items, uint32_t data, uint8_t bits, uint16_t one_mark, uint16_t zero_mark, uint16_t bit_space, bool lsb_first=true) |
| Encode a sequence of bits as pulse-width modulated RMT items (SIRC-style) | |
| uint32_t | m5::unit::ir::decodePulseWidth (const gpio::m5_rmt_item_t *items, uint32_t num, uint32_t &data, uint8_t bits, uint16_t one_mark, uint16_t zero_mark, uint16_t bit_space, uint16_t tolerance, bool lsb_first=true) |
| Decode pulse-width modulated RMT items into a data value. | |
| void | m5::unit::ir::encodeManchester (item_container_type &items, uint32_t data, uint8_t bits, uint16_t half_bit, bool rc5_polarity=true, bool msb_first=true) |
| Encode a sequence of bits as Manchester (bi-phase) modulated RMT items (RC5-style) | |
| uint32_t | m5::unit::ir::decodeManchester (const gpio::m5_rmt_item_t *items, uint32_t num, uint32_t &data, uint8_t bits, uint16_t half_bit, uint16_t tolerance, bool rc5_polarity=true, bool msb_first=true) |
| Decode Manchester (bi-phase) modulated RMT items. | |
RMT item helper functions for IR protocols.
| uint32_t m5::unit::ir::decodeManchester | ( | const gpio::m5_rmt_item_t * | items, |
| uint32_t | num, | ||
| uint32_t & | data, | ||
| uint8_t | bits, | ||
| uint16_t | half_bit, | ||
| uint16_t | tolerance, | ||
| bool | rc5_polarity = true, | ||
| bool | msb_first = true ) |
Decode Manchester (bi-phase) modulated RMT items.
Accepts both single-transition items (half+half in one item) and split items (consecutive half-bit items). Handles edge merging at bit boundaries.
| items | RMT items to decode | |
| num | Number of items | |
| [out] | data | Decoded data value |
| bits | Expected number of bits | |
| half_bit | Expected half-bit duration in microseconds | |
| tolerance | Acceptable timing deviation in microseconds | |
| rc5_polarity | If true, use RC5 polarity. If false, use RC6 polarity. | |
| msb_first | If true, decode MSB first |
| uint32_t m5::unit::ir::decodePulseDistance | ( | const gpio::m5_rmt_item_t * | items, |
| uint32_t | num, | ||
| uint32_t & | data, | ||
| uint8_t | bits, | ||
| uint16_t | bit_mark, | ||
| uint16_t | one_space, | ||
| uint16_t | zero_space, | ||
| uint16_t | tolerance, | ||
| bool | lsb_first = true ) |
Decode pulse-distance modulated RMT items into a data value.
| items | RMT items to decode | |
| num | Number of items | |
| [out] | data | Decoded data value |
| bits | Expected number of bits | |
| bit_mark | Expected mark duration in microseconds | |
| one_space | Expected space duration for logic "1" in microseconds | |
| zero_space | Expected space duration for logic "0" in microseconds | |
| tolerance | Acceptable timing deviation in microseconds | |
| lsb_first | If true, decode as LSB first; otherwise MSB first |
| uint32_t m5::unit::ir::decodePulseWidth | ( | const gpio::m5_rmt_item_t * | items, |
| uint32_t | num, | ||
| uint32_t & | data, | ||
| uint8_t | bits, | ||
| uint16_t | one_mark, | ||
| uint16_t | zero_mark, | ||
| uint16_t | bit_space, | ||
| uint16_t | tolerance, | ||
| bool | lsb_first = true ) |
Decode pulse-width modulated RMT items into a data value.
| items | RMT items to decode | |
| num | Number of items | |
| [out] | data | Decoded data value |
| bits | Expected number of bits | |
| one_mark | Expected mark duration for logic "1" in microseconds | |
| zero_mark | Expected mark duration for logic "0" in microseconds | |
| bit_space | Expected space duration in microseconds | |
| tolerance | Acceptable timing deviation in microseconds | |
| lsb_first | If true, decode as LSB first; otherwise MSB first |
| void m5::unit::ir::encodeManchester | ( | item_container_type & | items, |
| uint32_t | data, | ||
| uint8_t | bits, | ||
| uint16_t | half_bit, | ||
| bool | rc5_polarity = true, | ||
| bool | msb_first = true ) |
Encode a sequence of bits as Manchester (bi-phase) modulated RMT items (RC5-style)
Each bit period = 2 half-bits. RC5 convention:
| [out] | items | Output container (items are appended) |
| data | Raw data value | |
| bits | Number of bits to encode | |
| half_bit | Half-bit duration in microseconds (889us for RC5) | |
| rc5_polarity | If true, use RC5 polarity (0=mark-space, 1=space-mark). If false, use RC6 polarity (0=space-mark, 1=mark-space). | |
| msb_first | If true, encode MSB first (RC5/RC6 standard) |
| void m5::unit::ir::encodePulseDistance | ( | item_container_type & | items, |
| uint32_t | data, | ||
| uint8_t | bits, | ||
| uint16_t | bit_mark, | ||
| uint16_t | one_space, | ||
| uint16_t | zero_space, | ||
| bool | lsb_first = true ) |
Encode a sequence of bits as pulse-distance modulated RMT items (NEC-style)
Each bit is encoded as: mark(bit_mark) + space(one_space or zero_space)
| [out] | items | Output container (items are appended) |
| data | Raw data value | |
| bits | Number of bits to encode | |
| bit_mark | Mark duration for each bit in microseconds | |
| one_space | Space duration for logic "1" in microseconds | |
| zero_space | Space duration for logic "0" in microseconds | |
| lsb_first | If true, encode LSB first; otherwise MSB first |
| void m5::unit::ir::encodePulseWidth | ( | item_container_type & | items, |
| uint32_t | data, | ||
| uint8_t | bits, | ||
| uint16_t | one_mark, | ||
| uint16_t | zero_mark, | ||
| uint16_t | bit_space, | ||
| bool | lsb_first = true ) |
Encode a sequence of bits as pulse-width modulated RMT items (SIRC-style)
Each bit is encoded as: mark(one_mark or zero_mark) + space(bit_space)
| [out] | items | Output container (items are appended) |
| data | Raw data value | |
| bits | Number of bits to encode | |
| one_mark | Mark duration for logic "1" in microseconds | |
| zero_mark | Mark duration for logic "0" in microseconds | |
| bit_space | Space duration for each bit in microseconds | |
| lsb_first | If true, encode LSB first; otherwise MSB first |
|
inline |
Create an RMT item representing a mark (carrier burst) followed by a space (silence)
| mark_us | Mark duration in microseconds |
| space_us | Space duration in microseconds |
|
inline |
Create a terminator RMT item (mark only, no space)
| mark_us | Mark duration in microseconds |
|
inline |
Check if a duration matches an expected value within tolerance.
| actual | Measured duration in ticks (microseconds at 1MHz) |
| expected | Expected duration in microseconds |
| tolerance | Acceptable deviation in microseconds |