; RAK11310
; Pinout from https://github.com/beegee-tokyo/SX126x-Arduino/blob/6be1f87b84ad4d445a38ec53d65be4425f2383f3/src/boards/mcu/board.cpp#L259

[rak11310]
extends = rp2040_base
board = rakwireless_rak11300
board_build.filesystem_size = 0.5m
build_flags = ${rp2040_base.build_flags}
  -I variants/rak11310
  -D RAK_11310
  -D ARDUINO_RAKWIRELESS_RAK11300=1
  -D SX126X_CURRENT_LIMIT=140
  -D USE_SX1262
  -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D P_LORA_DIO_1=29
  -D P_LORA_NSS=13 ; CS
  -D P_LORA_RESET=14
  -D P_LORA_BUSY=15
  -D P_LORA_SCLK=10
  -D P_LORA_MISO=12
  -D P_LORA_MOSI=11
  -D P_LORA_TX_LED=24 ; green led = 23, blue led = 24
  -D SX126X_DIO2_AS_RF_SWITCH=true
  -D SX126X_DIO3_TCXO_VOLTAGE=1.8
  -D SX126X_RX_BOOSTED_GAIN=1
  -D LORA_TX_POWER=22
; Debug options
  ; -D DEBUG_RP2040_WIRE=1
  ; -D DEBUG_RP2040_SPI=1
  ; -D DEBUG_RP2040_CORE=1
  ; -D RADIOLIB_DEBUG_SPI=1
  ; -D DEBUG_RP2040_PORT=Serial
build_src_filter = ${rp2040_base.build_src_filter}
  +<RAK11310Board.cpp>
  +<../variants/rak11310>
lib_deps = ${rp2040_base.lib_deps}

[env:RAK_11310_repeater]
extends = rak11310
build_flags = ${rak11310.build_flags}
  -D ADVERT_NAME='"RAK11310 Repeater"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}
  +<../examples/simple_repeater>

[env:RAK_11310_repeater_bridge_rs232]
extends = rak11310
build_flags = ${rak11310.build_flags}
  -D ADVERT_NAME='"RS232 Bridge"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D MAX_NEIGHBOURS=50
  -D WITH_RS232_BRIDGE=Serial2
  -D WITH_RS232_BRIDGE_RX=9
  -D WITH_RS232_BRIDGE_TX=8
;  -D BRIDGE_DEBUG=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}
  +<helpers/bridges/RS232Bridge.cpp>
  +<../examples/simple_repeater>

[env:RAK_11310_room_server]
extends = rak11310
build_flags = ${rak11310.build_flags}
  -D ADVERT_NAME='"RAK11310 Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
  -D ROOM_PASSWORD='"hello"'
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}
  +<../examples/simple_room_server>

[env:RAK_11310_companion_radio_usb]
extends = rak11310
build_flags = ${rak11310.build_flags}
  -D MAX_CONTACTS=100
  -D MAX_GROUP_CHANNELS=8
; NOTE: DO NOT ENABLE -->  -D MESH_PACKET_LOGGING=1
; NOTE: DO NOT ENABLE -->  -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}
  +<../examples/companion_radio/*.cpp>
lib_deps = ${rak11310.lib_deps}
  densaugeo/base64 @ ~1.4.0

; [env:RAK_11310_companion_radio_ble]
; extends = rak11310
; build_flags = ${rak11310.build_flags}
;   -D MAX_CONTACTS=100
;   -D MAX_GROUP_CHANNELS=8
;   -D BLE_PIN_CODE=123456
;   -D BLE_DEBUG_LOGGING=1
; ;  -D MESH_PACKET_LOGGING=1
; ;  -D MESH_DEBUG=1
; build_src_filter = ${rak11310.build_src_filter}
;   +<../examples/companion_radio/*.cpp>
; lib_deps = ${rak11310.lib_deps}
;   densaugeo/base64 @ ~1.4.0

; [env:RAK_11310_companion_radio_wifi]
; extends = rak11310
; build_flags = ${rak11310.build_flags}
;   -D MAX_CONTACTS=100
;   -D MAX_GROUP_CHANNELS=8
;   -D WIFI_DEBUG_LOGGING=1
;   -D WIFI_SSID='"myssid"'
;   -D WIFI_PWD='"mypwd"'
; ;  -D MESH_PACKET_LOGGING=1
; ;  -D MESH_DEBUG=1
; build_src_filter = ${rak11310.build_src_filter}
;   +<../examples/companion_radio/*.cpp>
; lib_deps = ${rak11310.lib_deps}
;   densaugeo/base64 @ ~1.4.0

[env:RAK_11310_terminal_chat]
extends = rak11310
build_flags = ${rak11310.build_flags}
  -D MAX_CONTACTS=100
  -D MAX_GROUP_CHANNELS=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${rak11310.build_src_filter}
  +<../examples/simple_secure_chat/main.cpp>
lib_deps = ${rak11310.lib_deps}
  densaugeo/base64 @ ~1.4.0

[env:RAK_11310_kiss_modem]
extends = rak11310
build_src_filter = ${rak11310.build_src_filter}
  +<../examples/kiss_modem/>
