mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
rmt: update ir example to work with esp32s3 out of box
This commit is contained in:
parent
815203f401
commit
ed1fe1d5ba
@ -1,3 +1,5 @@
|
|||||||
|
| Supported Targets | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 |
|
||||||
|
| ----------------- | ----- | -------- | -------- | -------- |
|
||||||
# IR Protocol Example
|
# IR Protocol Example
|
||||||
|
|
||||||
(See the README.md file in the upper level 'examples' directory for more information about examples.)
|
(See the README.md file in the upper level 'examples' directory for more information about examples.)
|
||||||
@ -12,31 +14,33 @@ The example supports building and parsing both normal and extended NEC/RC5 proto
|
|||||||
|
|
||||||
### Hardware Required
|
### Hardware Required
|
||||||
|
|
||||||
* A development board with ESP32 SoC (e.g. ESP32-DevKitC or ESP-WROVER-KIT)
|
* A development board with supported SoC mentioned in the above `Supported Targets` table
|
||||||
* An USB cable for power supply and programming
|
* An USB cable for power supply and programming
|
||||||
* A 5mm infrared LED (e.g. IR333C) used to transmit encoded IR signals
|
* A 5mm infrared LED (e.g. IR333C) used to transmit encoded IR signals
|
||||||
* An infrared receiver module (e.g. IRM-3638T), which integrates a demodulator and AGC circuit.
|
* An infrared receiver module (e.g. IRM-3638T), which integrates a demodulator and AGC circuit.
|
||||||
|
|
||||||
Example connection :
|
Example connection :
|
||||||
|
|
||||||
| ESP32 | IR333C | IRM-3638T |
|
| ESP chip | IR333C | IRM-3638T |
|
||||||
| -------- | ------ | --------- |
|
| --------------------------- | ------ | --------- |
|
||||||
| GPIO18 | Tx | × |
|
| CONFIG_EXAMPLE_RMT_TX_GPIO | Tx | × |
|
||||||
| GPIO19 | × | Rx |
|
| CONFIG_EXAMPLE_RMT_RX_GPIO | × | Rx |
|
||||||
| VCC 5V | √ | × |
|
| VCC 5V | √ | × |
|
||||||
| VCC 3.3V | × | √ |
|
| VCC 3.3V | × | √ |
|
||||||
| GND | GND | GND |
|
| GND | GND | GND |
|
||||||
|
|
||||||
|
|
||||||
### Configure the Project
|
### Configure the Project
|
||||||
|
|
||||||
Open the project configuration menu (`idf.py menuconfig`).
|
Open the project configuration menu (`idf.py menuconfig`).
|
||||||
|
|
||||||
In the `Example Configuration` menu:
|
In the `Example Configuration` menu:
|
||||||
|
|
||||||
* Select the infrared protocol used in the example under `Infrared Protocol` option.
|
* Select the infrared protocol used in the example under `Infrared Protocol` option.
|
||||||
* Set the GPIO number used for transmitting the IR signal under `RMT TX GPIO` option.
|
* Set the GPIO number used for transmitting the IR signal under `RMT TX GPIO` option.
|
||||||
* Set the GPIO number used for receiving the demodulated IR signal under `RMT RX GPIO` option.
|
* Set the GPIO number used for receiving the demodulated IR signal under `RMT RX GPIO` option.
|
||||||
|
* Set the RMT TX channel number under `RMT TX Channel Number` option.
|
||||||
|
* Set the RMT RX channel number under `RMT RX Channel Number` option.
|
||||||
|
|
||||||
### Build and Flash
|
### Build and Flash
|
||||||
|
|
||||||
@ -44,11 +48,7 @@ Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
|
|||||||
|
|
||||||
(To exit the serial monitor, type ``Ctrl-]``.)
|
(To exit the serial monitor, type ``Ctrl-]``.)
|
||||||
|
|
||||||
See the Getting Started Guide for all the steps to configure and use the ESP-IDF to build projects.
|
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
|
||||||
|
|
||||||
* [ESP-IDF Getting Started Guide on ESP32](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html)
|
|
||||||
* [ESP-IDF Getting Started Guide on ESP32-S2](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/index.html)
|
|
||||||
* [ESP-IDF Getting Started Guide on ESP32-C3](https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/get-started/index.html)
|
|
||||||
|
|
||||||
## Example Output
|
## Example Output
|
||||||
|
|
||||||
|
@ -30,4 +30,17 @@ menu "Example Configuration"
|
|||||||
default 19
|
default 19
|
||||||
help
|
help
|
||||||
Set the GPIO number used for receiving the RMT signal.
|
Set the GPIO number used for receiving the RMT signal.
|
||||||
|
|
||||||
|
config EXAMPLE_RMT_TX_CHANNEL
|
||||||
|
int "RMT TX Channel Number"
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
Set the RMT TX channel number.
|
||||||
|
|
||||||
|
config EXAMPLE_RMT_RX_CHANNEL
|
||||||
|
int "RMT RX Channel Number"
|
||||||
|
default 4 if IDF_TARGET_ESP32S3
|
||||||
|
default 2
|
||||||
|
help
|
||||||
|
Set the RMT RX channel number.
|
||||||
endmenu
|
endmenu
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
static const char *TAG = "example";
|
static const char *TAG = "example";
|
||||||
|
|
||||||
static rmt_channel_t example_tx_channel = RMT_CHANNEL_0;
|
static rmt_channel_t example_tx_channel = CONFIG_EXAMPLE_RMT_TX_CHANNEL;
|
||||||
static rmt_channel_t example_rx_channel = RMT_CHANNEL_2;
|
static rmt_channel_t example_rx_channel = CONFIG_EXAMPLE_RMT_RX_CHANNEL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief RMT Receive Task
|
* @brief RMT Receive Task
|
||||||
|
Loading…
Reference in New Issue
Block a user