Skip to content

Enabled the onboard ceramic antenna by default when creating a new project with XIAO_ESP32C6 #10066

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 2, 2024
3 changes: 3 additions & 0 deletions variants/XIAO_ESP32C6/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,7 @@ static const uint8_t D8 = 19;
static const uint8_t D9 = 20;
static const uint8_t D10 = 18;

static const uint8_t WIFI_ENABLE = 3;
static const uint8_t WIFI_ANT_CONFIG = 14;

#endif /* Pins_Arduino_h */
21 changes: 21 additions & 0 deletions variants/XIAO_ESP32C6/variant.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
*By setting the WIFI_ENABLE and WIFI_ANT_CONFIG pins,
*
*the XIAO_ESP32C6 will turn on the on-board antenna by default after power-on
*
*https://wiki.seeedstudio.com/xiao_esp32c6_getting_started/
*/

#include "esp32-hal-gpio.h"
#include "pins_arduino.h"

extern "C" {

void initVariant(void) {
pinMode(WIFI_ENABLE, OUTPUT);
digitalWrite(WIFI_ENABLE, LOW);//turn on this function

pinMode(WIFI_ANT_CONFIG, OUTPUT);
digitalWrite(WIFI_ANT_CONFIG, LOW);//use built-in antenna, set HIGH to use external antenna
}
}
Loading