|
|
| UnitIR () |
| | Constructor.
|
| |
| config_t | config () const |
| | Gets the config values.
|
| |
| void | config (const config_t &cfg) |
| | Set the config values.
|
| |
| bool | begin () override |
| | Initialize the RMT channels (TX and/or RX) based on the adapter pins.
|
| |
| void | update (const bool force=false) override |
| | Poll the RX ringbuffer and decode incoming frames.
|
| |
|
| ir::IRCodec & | codec () |
| | Get current codec.
|
| |
| void | setCodec (ir::IRCodec &codec) |
| | Set protocol codec.
|
| |
|
void | resetCodec () |
| | Reset to built-in AutoDetectCodec.
|
| |
| ir::AutoDetectCodec & | defaultCodec () |
| | Get built-in AutoDetectCodec (for accessing individual protocol codecs)
|
| |
|
| bool | send (uint16_t address, uint16_t command, uint8_t frames=0) |
| | Send IR command using current codec.
|
| |
| bool | sendRaw (const gpio::m5_rmt_item_t *items, uint32_t num) |
| | Send raw RMT items directly.
|
| |
|
| size_t | available () const |
| | Number of decoded messages available since last update.
|
| |
| bool | empty () const |
| | True if no decoded messages.
|
| |
| const ir::DecodeResult & | latest () const |
| | Get latest decoded result.
|
| |
|
void | flush () |
| | Clear received data (both DecodeResult and raw items)
|
| |
| const gpio::m5_rmt_item_t * | rawItems () const |
| | Get raw RMT items from last reception.
|
| |
| uint32_t | rawItemCount () const |
| | Number of raw RMT items from last reception.
|
| |
|
| bool | hasTX () const |
| | True if TX pin is configured and RMT TX channel initialized.
|
| |
| bool | hasRX () const |
| | True if RX pin is configured and RMT RX channel initialized.
|
| |
IR remote control transceiver unit.
Supports Unit IR (SKU: U002) via Grove and built-in IR transmitters (e.g., M5StickC Plus2 GPIO 9). Uses ESP32 RMT peripheral for precise carrier modulation (TX) and timing capture (RX).
- Usage (Unit IR U002 via Grove)
m5::unit::UnitUnified Units;
auto pin_rx = M5.getPin(m5::pin_name_t::port_b_in);
auto pin_tx = M5.getPin(m5::pin_name_t::port_b_out);
if (pin_rx < 0 || pin_tx < 0) {
pin_rx = M5.getPin(m5::pin_name_t::port_a_pin1);
pin_tx = M5.getPin(m5::pin_name_t::port_a_pin2);
}
Units.add(ir, pin_rx, pin_tx);
IR remote control transceiver unit.
bool begin() override
Initialize the RMT channels (TX and/or RX) based on the adapter pins.
Definition unit_IR.cpp:34
bool send(uint16_t address, uint16_t command, uint8_t frames=0)
Send IR command using current codec.
Definition unit_IR.cpp:151
- Usage (Built-in IR, TX only, e.g. M5StickC Plus2)
m5::unit::UnitUnified Units;
if (!Units.add(ir, -1, 19) || !Units.begin()) {
}
- Usage (Built-in IR, TX+RX, e.g. M5StickS3)
m5::unit::UnitUnified Units;
if (!Units.add(ir, 42, 46) || !Units.begin()) {
}
- Built-in IR pin assignments
| Device | TX GPIO | RX GPIO |
| M5StickC | 9 | - |
| M5StickC Plus | 9 | - |
| M5StickC Plus2 | 19 | - |
| M5StickS3 | 46 | 42 |
| Atom Lite | 12 | - |
| Atom Matrix | 12 | - |
| AtomU | 12 | - |
| AtomS3 | 4 | - |
| AtomS3 Lite | 4 | - |
| AtomS3U | 12 | - |
| AtomS3R | 47 | - |
| Atom VoiceS3R | 47 | - |
| M5Capsule | 4 | - |
| NanoC6 | 3 | - |
| NessoN1 | 9 | - |
| Cardputer | 44 | - |
| Cardputer ADV | 44 | - |