Просмотр исходного кода

xiao-nrf : move pindef in pio.ini

Florent 1 год назад
Родитель
Сommit
e1c3dfca92

+ 4 - 12
src/helpers/nrf52/XiaoNrf52Board.h

@@ -7,25 +7,17 @@
 
 // LoRa radio module pins for Seeed Xiao-nrf52
 #ifdef SX1262_XIAO_S3_VARIANT
+  #undef P_LORA_DIO_1
+  #undef P_LORA_BUSY
+  #undef P_LORA_RESET
+  #undef P_LORA_NSS
   #define  P_LORA_DIO_1       D0
   #define  P_LORA_BUSY        D1
   #define  P_LORA_RESET       D2
   #define  P_LORA_NSS         D3
-  #define  LORA_TX_BOOST_PIN  D4
-#else
-  #define  P_LORA_DIO_1       D1
-  #define  P_LORA_BUSY        D3
-  #define  P_LORA_RESET       D2
-  #define  P_LORA_NSS         D4
-  #define  LORA_TX_BOOST_PIN  D5
 #endif
-#define  P_LORA_SCLK        PIN_SPI_SCK
-#define  P_LORA_MISO        PIN_SPI_MISO
-#define  P_LORA_MOSI        PIN_SPI_MOSI
 //#define  SX126X_POWER_EN  37
 
-#define SX126X_DIO2_AS_RF_SWITCH  true
-#define SX126X_DIO3_TCXO_VOLTAGE   1.8
 
 
 class XiaoNrf52Board : public mesh::MainBoard {

+ 8 - 6
variants/xiao_nrf52/platformio.ini

@@ -27,6 +27,12 @@ build_flags = ${nrf52840_xiao.build_flags}
   -D RADIO_CLASS=CustomSX1262
   -D WRAPPER_CLASS=CustomSX1262Wrapper
   -D LORA_TX_POWER=22
+  -D P_LORA_DIO_1=D1
+  -D P_LORA_RESET=D2
+  -D P_LORA_BUSY=D3
+  -D P_LORA_NSS=D4
+  -D SX126X_DIO2_AS_RF_SWITCH=1
+  -D SX126X_DIO3_TCXO_VOLTAGE=1.8
   -D SX126X_CURRENT_LIMIT=130
   -D SX126X_RX_BOOSTED_GAIN=1
 build_src_filter = ${nrf52840_xiao.build_src_filter}
@@ -45,7 +51,6 @@ build_flags =
   -D BLE_PIN_CODE=123456
 ;  -D BLE_DEBUG_LOGGING=1
 ;  -D ENABLE_PRIVATE_KEY_IMPORT=1
-;  -D ENABLE_PRIVATE_KEY_EXPORT=1
   -D MESH_PACKET_LOGGING=1
   -D MESH_DEBUG=1
 build_src_filter = ${Xiao_nrf52.build_src_filter}
@@ -61,12 +66,9 @@ build_flags =
   ${Xiao_nrf52.build_flags}
   -D MAX_CONTACTS=100
   -D MAX_GROUP_CHANNELS=8
-;  -D BLE_PIN_CODE=123456
-;  -D BLE_DEBUG_LOGGING=1
 ;  -D ENABLE_PRIVATE_KEY_IMPORT=1
-;  -D ENABLE_PRIVATE_KEY_EXPORT=1
-  -D MESH_PACKET_LOGGING=1
-  -D MESH_DEBUG=1
+;  -D MESH_PACKET_LOGGING=1
+;  -D MESH_DEBUG=1
 build_src_filter = ${Xiao_nrf52.build_src_filter}
   +<helpers/nrf52/SerialBLEInterface.cpp>
   +<../examples/companion_radio/main.cpp>

+ 5 - 5
variants/xiao_nrf52/variant.h

@@ -98,15 +98,15 @@ static const uint8_t A5  = PIN_A5;
 #define PIN_SPI_MOSI            (10)
 #define PIN_SPI_SCK             (8)
 
-static const uint8_t SS   = D3; // NSS for sx ?
-static const uint8_t MOSI = PIN_SPI_MOSI;
-static const uint8_t MISO = PIN_SPI_MISO;
-static const uint8_t SCK  = PIN_SPI_SCK ;
-
 #define PIN_SPI1_MISO           (25)
 #define PIN_SPI1_MOSI           (26)
 #define PIN_SPI1_SCK            (29)
 
+// Lora SPI is on SPI0
+#define  P_LORA_SCLK            PIN_SPI_SCK
+#define  P_LORA_MISO            PIN_SPI_MISO
+#define  P_LORA_MOSI            PIN_SPI_MOSI
+
 // Wire Interfaces
 #define WIRE_INTERFACES_COUNT   (1)