File tree Expand file tree Collapse file tree 6 files changed +79
-0
lines changed
boards/seeed/xiao_esp32c6 Expand file tree Collapse file tree 6 files changed +79
-0
lines changed Original file line number Diff line number Diff line change
1
+ #
2
+ # Copyright (c) 2025 Mario Paja
3
+ #
4
+ # SPDX-License-Identifier: Apache-2.0
5
+ #
6
+
7
+ if (CONFIG_ESP32_EXT_ANTENNA )
8
+ zephyr_library ()
9
+ zephyr_library_sources (board.c )
10
+ endif ()
Original file line number Diff line number Diff line change @@ -5,3 +5,8 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD
5
5
int
6
6
default 4096 if BOARD_XIAO_ESP32C6_ESP32C6_HPCORE
7
7
default 256 if BOARD_XIAO_ESP32C6_ESP32C6_LPCORE
8
+
9
+ config XIAO_ESP32C6_EXT_ANTENNA
10
+ bool "XIAO ESP32C6 external antenna configuration"
11
+ default y if BOARD_XIAO_ESP32C6_ESP32C6_HPCORE && ESP32_EXT_ANTENNA
12
+ select BOARD_LATE_INIT_HOOK
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2025 Mario Paja
3
+ *
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ #include <zephyr/kernel.h>
8
+ #include <zephyr/drivers/gpio.h>
9
+ #include <zephyr/init.h>
10
+
11
+ void board_late_init_hook (void )
12
+ {
13
+ #if DT_NODE_HAS_STATUS_OKAY (DT_NODELABEL (rf_switch ))
14
+ const struct gpio_dt_spec rf_switch_en =
15
+ GPIO_DT_SPEC_GET (DT_NODELABEL (rf_switch ), enable_gpios );
16
+
17
+ if (gpio_is_ready_dt (& rf_switch_en )) {
18
+ gpio_pin_configure_dt (& rf_switch_en , GPIO_OUTPUT_ACTIVE );
19
+ }
20
+
21
+ const struct gpio_dt_spec ant_sel = GPIO_DT_SPEC_GET (DT_NODELABEL (rf_switch ), select_gpios );
22
+
23
+ if (gpio_is_ready_dt (& ant_sel )) {
24
+ #ifdef CONFIG_XIAO_ESP32C6_EXT_ANTENNA
25
+ gpio_pin_configure_dt (& ant_sel , GPIO_OUTPUT_ACTIVE );
26
+ #else
27
+ gpio_pin_configure_dt (& ant_sel , GPIO_OUTPUT_INACTIVE );
28
+ #endif /* XIAO_ESP32C6_EXT_ANTENNA */
29
+ }
30
+
31
+ #endif /* DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(rf_switch)) */
32
+ }
Original file line number Diff line number Diff line change
1
+ # Copyright (c) 2025 Mario Paja
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
4
+ description : |
5
+ Group of GPIO-controlled relays used to enable an RF switch and select the active antenna.
6
+
7
+ compatible : " seeed,xiao-gpio-rf-switch"
8
+
9
+ properties :
10
+ enable-gpios :
11
+ type : phandle-array
12
+ required : true
13
+ description : |
14
+ GPIOs to enable the RF switch module.
15
+
16
+ select-gpios :
17
+ type : phandle-array
18
+ required : true
19
+ description : |
20
+ GPIOs to select the active antenna
Original file line number Diff line number Diff line change 38
38
watchdog0 = &wdt0;
39
39
};
40
40
41
+ rf_switch: rf_switch {
42
+ compatible = "seeed,xiao-gpio-rf-switch";
43
+ enable-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
44
+ select-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
45
+ };
41
46
};
42
47
43
48
&trng0 {
Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ config ESP32_SW_COEXIST_ENABLE
58
58
If only Bluetooth is used, it is recommended to disable this option to reduce binary file
59
59
size.
60
60
61
+ config ESP32_EXT_ANTENNA
62
+ bool "ESP32 External Antenna Selector"
63
+ help
64
+ Select the external antenna of custom ESP32 boards.
65
+ By default, the onboard antenna is used.
66
+ A board late init hook is required to enable and select the external antenna.
67
+
61
68
endif
62
69
63
70
rsource "Kconfig.amp"
You can’t perform that action at this time.
0 commit comments