[ikoka_stick_nrf]
extends = nrf52_base
board = seeed-xiao-afruitnrf52-nrf52840
board_build.ldscript = boards/nrf52840_s140_v7.ld
build_flags = ${nrf52_base.build_flags}
  ${sensor_base.build_flags}
  -D NRF52_PLATFORM -D XIAO_NRF52
  -I lib/nrf52/s140_nrf52_7.3.0_API/include
  -I lib/nrf52/s140_nrf52_7.3.0_API/include/nrf52
  -I variants/ikoka_stick_nrf
  -I src/helpers/nrf52
  -D P_LORA_TX_LED=11
  -D DISPLAY_CLASS=SSD1306Display
  -D DISPLAY_ROTATION=2
   -D USE_SX1262
   -D RADIO_CLASS=CustomSX1262
  -D WRAPPER_CLASS=CustomSX1262Wrapper
  -D P_LORA_DIO_1=D1
  -D P_LORA_RESET=D2
  -D P_LORA_BUSY=D3
  -D P_LORA_NSS=D4
  -D SX126X_RXEN=D5
  -D SX126X_TXEN=RADIOLIB_NC
  -D SX126X_DIO2_AS_RF_SWITCH=1
  -D SX126X_DIO3_TCXO_VOLTAGE=1.8
  -D SX126X_CURRENT_LIMIT=140
  -D SX126X_RX_BOOSTED_GAIN=1
  -D PIN_USER_BTN=0
  -D PIN_WIRE_SCL=7
  -D PIN_WIRE_SDA=6
  -UENV_INCLUDE_GPS
lib_deps = ${nrf52_base.lib_deps}
  ${sensor_base.lib_deps}

[ikoka_stick_nrf_e22_22dbm]
extends = ikoka_stick_nrf
; No PA in this model, full 22dBm
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D MANUFACTURER_STRING='"Ikoka Stick-E22-22dBm (Xiao_nrf52)"'
  -D LORA_TX_POWER=22
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/*.cpp>
  +<helpers/sensors>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/SSD1306Display.cpp>
  +<../variants/ikoka_stick_nrf>

[ikoka_stick_nrf_e22_30dbm]
extends = ikoka_stick_nrf
; limit txpower to 20dBm on E22-900M30S. Anything higher will
; cause distortion in the PA output. 20dBm in -> 30dBm out
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D MANUFACTURER_STRING='"Ikoka Stick-E22-30dBm (Xiao_nrf52)"'
  -D LORA_TX_POWER=20
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/*.cpp>
  +<helpers/sensors>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/SSD1306Display.cpp>
  +<../variants/ikoka_stick_nrf>

[ikoka_stick_nrf_e22_33dbm]
extends = ikoka_stick_nrf
; limit txpower to 9dBm on E22-900M33S to avoid hardware damage
; to the rf amplifier frontend. 9dBm in -> 33dBm out
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D MANUFACTURER_STRING='"Ikoka Stick-E22-33dBm (Xiao_nrf52)"'
  -D LORA_TX_POWER=9
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/*.cpp>
  +<helpers/sensors>
  +<helpers/ui/MomentaryButton.cpp>
  +<helpers/ui/SSD1306Display.cpp>
  +<../variants/ikoka_stick_nrf>

;;; abstracted firmware roles

[ikoka_stick_nrf_companion_radio_ble]
extends = ikoka_stick_nrf
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
board_upload.maximum_size = 708608
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -D BLE_PIN_CODE=123456
  -D OFFLINE_QUEUE_SIZE=256
  -I examples/companion_radio/ui-new
  -D QSPIFLASH=1
;  -D BLE_DEBUG_LOGGING=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/nrf52/SerialBLEInterface.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${ikoka_stick_nrf.lib_deps}
  densaugeo/base64 @ ~1.4.0

[ikoka_stick_nrf_companion_radio_usb]
extends = ikoka_stick_nrf
board_build.ldscript = boards/nrf52840_s140_v7_extrafs.ld
board_upload.maximum_size = 708608
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D MAX_CONTACTS=350
  -D MAX_GROUP_CHANNELS=40
  -I examples/companion_radio/ui-new
  -D QSPIFLASH=1
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/nrf52/SerialBLEInterface.cpp>
  +<../examples/companion_radio/*.cpp>
  +<../examples/companion_radio/ui-new/*.cpp>
lib_deps =
  ${ikoka_stick_nrf.lib_deps}
  densaugeo/base64 @ ~1.4.0

[ikoka_stick_nrf_repeater]
extends = ikoka_stick_nrf
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D ADVERT_NAME='"Ikoka Stick 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 = ${ikoka_stick_nrf.build_src_filter}
  +<helpers/ui/SSD1306Display.cpp>
  +<../examples/simple_repeater/*.cpp>

[ikoka_stick_nrf_room_server]
extends = ikoka_stick_nrf
build_flags =
  ${ikoka_stick_nrf.build_flags}
  -D ADVERT_NAME='"Ikoka Stick Room"'
  -D ADVERT_LAT=0.0
  -D ADVERT_LON=0.0
  -D ADMIN_PASSWORD='"password"'
;  -D MESH_PACKET_LOGGING=1
;  -D MESH_DEBUG=1
build_src_filter = ${ikoka_stick_nrf.build_src_filter}
  +<../examples/simple_room_server/*.cpp>

;;; hardware + firmware variants

;;;    22dBm EBYTE E22-900M22 variants

[env:ikoka_stick_nrf_22dbm_companion_radio_usb]
extends =
   ikoka_stick_nrf_e22_22dbm
   ikoka_stick_nrf_companion_radio_usb
build_flags =
   ${ikoka_stick_nrf_companion_radio_usb.build_flags}
   ${ikoka_stick_nrf_e22_22dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_usb.build_src_filter}
   ${ikoka_stick_nrf_e22_22dbm.build_src_filter}

[env:ikoka_stick_nrf_22dbm_companion_radio_ble]
extends =
   ikoka_stick_nrf_e22_22dbm
   ikoka_stick_nrf_companion_radio_ble
build_flags =
   ${ikoka_stick_nrf_companion_radio_ble.build_flags}
   ${ikoka_stick_nrf_e22_22dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_ble.build_src_filter}
   ${ikoka_stick_nrf_e22_22dbm.build_src_filter}

[env:ikoka_stick_nrf_22dbm_repeater]
extends =
   ikoka_stick_nrf_e22_22dbm
   ikoka_stick_nrf_repeater
build_flags =
   ${ikoka_stick_nrf_repeater.build_flags}
   ${ikoka_stick_nrf_e22_22dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_repeater.build_src_filter}
   ${ikoka_stick_nrf_e22_22dbm.build_src_filter}

[env:ikoka_stick_nrf_22dbm_room_server]
extends =
   ikoka_stick_nrf_e22_22dbm
   ikoka_stick_nrf_room_server
build_flags =
   ${ikoka_stick_nrf_room_server.build_flags}
   ${ikoka_stick_nrf_e22_22dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_room_server.build_src_filter}
   ${ikoka_stick_nrf_e22_22dbm.build_src_filter}


;;;    30dBm EBYTE E22-900M30 variants

[env:ikoka_stick_nrf_30dbm_companion_radio_usb]
extends =
   ikoka_stick_nrf_e22_30dbm
   ikoka_stick_nrf_companion_radio_usb
build_flags =
   ${ikoka_stick_nrf_companion_radio_usb.build_flags}
   ${ikoka_stick_nrf_e22_30dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_usb.build_src_filter}
   ${ikoka_stick_nrf_e22_30dbm.build_src_filter}

[env:ikoka_stick_nrf_30dbm_companion_radio_ble]
extends =
   ikoka_stick_nrf_e22_30dbm
   ikoka_stick_nrf_companion_radio_ble
build_flags =
   ${ikoka_stick_nrf_companion_radio_ble.build_flags}
   ${ikoka_stick_nrf_e22_30dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_ble.build_src_filter}
   ${ikoka_stick_nrf_e22_30dbm.build_src_filter}

[env:ikoka_stick_nrf_30dbm_repeater]
extends =
   ikoka_stick_nrf_e22_30dbm
   ikoka_stick_nrf_repeater
build_flags =
   ${ikoka_stick_nrf_repeater.build_flags}
   ${ikoka_stick_nrf_e22_30dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_repeater.build_src_filter}
   ${ikoka_stick_nrf_e22_30dbm.build_src_filter}

[env:ikoka_stick_nrf_30dbm_room_server]
extends =
   ikoka_stick_nrf_e22_30dbm
   ikoka_stick_nrf_room_server
build_flags =
   ${ikoka_stick_nrf_room_server.build_flags}
   ${ikoka_stick_nrf_e22_30dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_room_server.build_src_filter}
   ${ikoka_stick_nrf_e22_30dbm.build_src_filter}


;;;    33dBm EBYTE E22-900M33 variants

[env:ikoka_stick_nrf_33dbm_companion_radio_usb]
extends =
   ikoka_stick_nrf_e22_33dbm
   ikoka_stick_nrf_companion_radio_usb
build_flags =
   ${ikoka_stick_nrf_companion_radio_usb.build_flags}
   ${ikoka_stick_nrf_e22_33dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_usb.build_src_filter}
   ${ikoka_stick_nrf_e22_33dbm.build_src_filter}

[env:ikoka_stick_nrf_33dbm_companion_radio_ble]
extends =
   ikoka_stick_nrf_e22_33dbm
   ikoka_stick_nrf_companion_radio_ble
build_flags =
   ${ikoka_stick_nrf_companion_radio_ble.build_flags}
   ${ikoka_stick_nrf_e22_33dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_companion_radio_ble.build_src_filter}
   ${ikoka_stick_nrf_e22_33dbm.build_src_filter}

[env:ikoka_stick_nrf_33dbm_repeater]
extends =
   ikoka_stick_nrf_e22_33dbm
   ikoka_stick_nrf_repeater
build_flags =
   ${ikoka_stick_nrf_repeater.build_flags}
   ${ikoka_stick_nrf_e22_33dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_repeater.build_src_filter}
   ${ikoka_stick_nrf_e22_33dbm.build_src_filter}

[env:ikoka_stick_nrf_33dbm_room_server]
extends =
   ikoka_stick_nrf_e22_33dbm
   ikoka_stick_nrf_room_server
build_flags =
   ${ikoka_stick_nrf_room_server.build_flags}
   ${ikoka_stick_nrf_e22_33dbm.build_flags}
build_src_filter =
   ${ikoka_stick_nrf_room_server.build_src_filter}
   ${ikoka_stick_nrf_e22_33dbm.build_src_filter}

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

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

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