Procházet zdrojové kódy

example: support legacy PHY commands in cert_test

alanmaxwell před 2 roky
rodič
revize
2d072ab141

+ 1 - 0
.gitlab/CODEOWNERS

@@ -172,6 +172,7 @@
 /examples/openthread/         @esp-idf-codeowners/ieee802154
 /examples/peripherals/        @esp-idf-codeowners/peripherals
 /examples/peripherals/usb/    @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
+/examples/phy/                @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
 /examples/protocols/          @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
 /examples/provisioning/       @esp-idf-codeowners/app-utilities/provisioning
 /examples/security/           @esp-idf-codeowners/security

+ 5 - 2
examples/phy/cert_test/README.md

@@ -115,7 +115,10 @@ I (191970) phy: BT TX TONE STOP!
 phy>
 ```
 
-## Troubleshooting
+## PHY Commands Format
+
+For BLE test, if you want to use `fcc_le_tx` and `rw_le_rx_per` legacy commands for tx/rx test, you need to enable `ESP_PHY_LEGACY_COMMANDS` in menuconfig, otherwise, the new format commands `esp_ble_tx` and `esp_ble_rx` are supported.
 
-For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
+## Troubleshooting
 
+For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

+ 14 - 0
examples/phy/cert_test/main/Kconfig.projbuild

@@ -0,0 +1,14 @@
+menu "Example Configuration"
+
+    choice COMMANDS_FORMAT
+        prompt "PHY Commands Format"
+        default ESP_PHY_NEW_COMMANDS
+        config ESP_PHY_LEGACY_COMMANDS
+            bool "Legacy Commands Format"
+
+        config ESP_PHY_NEW_COMMANDS
+            bool "New Commands Format"
+
+    endchoice
+
+endmenu

+ 13 - 0
examples/phy/cert_test/main/cmd_phy.c

@@ -29,6 +29,11 @@ static phy_ble_rx_t     phy_ble_rx_args;
 static phy_bt_tx_tone_t phy_bt_tx_tone_args;
 #endif
 
+#if CONFIG_ESP_PHY_LEGACY_COMMANDS
+#define arg_int0(_a, _b, _c, _d) arg_int0(NULL, NULL, _c, _d)
+#define arg_int1(_a, _b, _c, _d) arg_int1(NULL, NULL, _c, _d)
+#endif
+
 static int esp_phy_tx_contin_en_func(int argc, char **argv)
 {
     int nerrors = arg_parse(argc, argv, (void **) &phy_args);
@@ -487,7 +492,11 @@ void register_phy_cmd(void)
     phy_ble_tx_args.end       = arg_end(1);
 
     const esp_console_cmd_t esp_ble_tx_cmd = {
+#if CONFIG_ESP_PHY_NEW_COMMANDS
         .command = "esp_ble_tx",
+#elif CONFIG_ESP_PHY_LEGACY_COMMANDS
+        .command = "fcc_le_tx",
+#endif
         .help = "BLE TX command",
         .hint = NULL,
         .func = &esp_phy_ble_tx_func,
@@ -501,7 +510,11 @@ void register_phy_cmd(void)
     phy_ble_rx_args.end     = arg_end(1);
 
     const esp_console_cmd_t esp_ble_rx_cmd = {
+#if CONFIG_ESP_PHY_NEW_COMMANDS
         .command = "esp_ble_rx",
+#elif CONFIG_ESP_PHY_LEGACY_COMMANDS
+        .command = "rw_le_rx_per",
+#endif
         .help = "BLE RX command",
         .hint = NULL,
         .func = &esp_phy_ble_rx_func,