From f0eec50bf5f7a686e7794e3fc2cd91a0de61854a Mon Sep 17 00:00:00 2001
From: chen <15335560115@163.com>
Date: 星期五, 25 四月 2025 11:34:03 +0800
Subject: [PATCH] 加入PA操控代码

---
 boards/src/driver_examples/power_cycling/main.c |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/boards/src/driver_examples/power_cycling/main.c b/boards/src/driver_examples/power_cycling/main.c
index 2a248bb..56fcda6 100644
--- a/boards/src/driver_examples/power_cycling/main.c
+++ b/boards/src/driver_examples/power_cycling/main.c
@@ -57,7 +57,7 @@
 
 #define BUTTON_SWITCH_POWER_MODE_EN 1
 #define CH_NUM 5
-#define TX_POWER_LEVEL 60
+#define TX_POWER_LEVEL 55
 
 static struct UWB_CONFIG_T uwb_config;
 
@@ -282,6 +282,13 @@
 #endif
 
     gpio_open();
+		//PA引脚
+		io_pin_mux_set(IO_PIN_9, IO_FUNC0);
+		io_pin_mux_set(IO_PIN_10, IO_FUNC0);
+	 gpio_pin_set_dir(IO_PIN_9, GPIO_DIR_OUT, 0);
+	 io_pull_set(IO_PIN_9, IO_PULL_DOWN, IO_PULL_UP_LEVEL4);
+//	  gpio_pin_set_dir(IO_PIN_10, GPIO_DIR_OUT, 0);
+//	 io_pull_set(IO_PIN_10, IO_PULL_DOWN, IO_PULL_UP_LEVEL4);
     board_led_init();
     board_configure();
 
@@ -338,9 +345,12 @@
 
 //    test_mode=TEST_UWB_TX;
     power_init();
-    app_power_mode_set(test_mode);
+//    app_power_mode_set(test_mode);
+    uwb_open();
+    power_on_radio(1, 0);
+    uwb_tx_carrier_only(1, CH_NUM, TX_POWER_LEVEL);
             //            // start a 10ms timer
-    mac_timer_open(button_debounce_timeout_handler);
+//    mac_timer_open(button_debounce_timeout_handler);
     mac_timer_start(__MS_TO_TICKS(10));
     LOG_INFO(TRACE_MODULE_APP, "Debounce timer start\r\n");
     power_mode_request(POWER_UNIT_TIMER, POWER_MODE_SLEEP);
@@ -363,10 +373,20 @@
             case TEST_RF_CARRIER:
                 break;
             case TEST_UWB_TX:
+                delay_us(65535);
+            
+								gpio_pin_set(IO_PIN_9);//测试;
+								gpio_pin_clr(IO_PIN_10);//测试; 
                 uwb_blocking_tx_start(tx_payload, tx_len, 0);
+								gpio_pin_clr(IO_PIN_9);//测试;
+								gpio_pin_clr(IO_PIN_10);//测试;
                 break;
             case TEST_UWB_RX:
+//							gpio_pin_clr(IO_PIN_10);//测试;
+//								gpio_pin_clr(IO_PIN_9);//测试; 
                 uwb_blocking_rx_start(0, NULL);
+//								gpio_pin_clr(IO_PIN_9);//测试;
+//								gpio_pin_clr(IO_PIN_10);//测试;
                 uwb_close();
                 break;
             case TEST_MCU_SLEEP:

--
Gitblit v1.9.3