/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --board "/ti/boards/CC1352P_2_LAUNCHXL" --rtos "tirtos7" --product "simplelink_cc13xx_cc26xx_sdk@6.20.00.29"
 * @versions {"tool":"1.13.0+2553"}
 */

/**
 * Import the modules used in this configuration.
 */
const ble          = scripting.addModule("/ti/ble5stack/ble");
const CCFG         = scripting.addModule("/ti/devices/CCFG");
const rfdesign     = scripting.addModule("/ti/devices/radioconfig/rfdesign");
const Display      = scripting.addModule("/ti/display/Display");
const Display1     = Display.addInstance();
const AESCCM       = scripting.addModule("/ti/drivers/AESCCM");
const AESCCM1      = AESCCM.addInstance();
const AESCTRDRBG   = scripting.addModule("/ti/drivers/AESCTRDRBG");
const AESCTRDRBG1  = AESCTRDRBG.addInstance();
const AESECB       = scripting.addModule("/ti/drivers/AESECB");
const AESECB1      = AESECB.addInstance();
const ECDH         = scripting.addModule("/ti/drivers/ECDH");
const ECDH1        = ECDH.addInstance();
const GPIO         = scripting.addModule("/ti/drivers/GPIO");
const GPIO3        = GPIO.addInstance();
const GPIO4        = GPIO.addInstance();
const NVS          = scripting.addModule("/ti/drivers/NVS");
const NVS1         = NVS.addInstance();
const Power        = scripting.addModule("/ti/drivers/Power");
const RF           = scripting.addModule("/ti/drivers/RF");
const TRNG         = scripting.addModule("/ti/drivers/TRNG");
const TRNG1        = TRNG.addInstance();
const Settings     = scripting.addModule("/ti/posix/tirtos/Settings");
const BIOS         = scripting.addModule("/ti/sysbios/BIOS");
const GateMutexPri = scripting.addModule("/ti/sysbios/gates/GateMutexPri");
const HeapCallback = scripting.addModule("/ti/sysbios/heaps/HeapCallback");
const Event        = scripting.addModule("/ti/sysbios/knl/Event");
const Idle         = scripting.addModule("/ti/sysbios/knl/Idle", {}, false);
const Idle2        = Idle.addInstance();
const Mailbox      = scripting.addModule("/ti/sysbios/knl/Mailbox");
const Error        = scripting.addModule("/ti/sysbios/runtime/Error");
const SysCallback  = scripting.addModule("/ti/sysbios/runtime/SysCallback");
const Timestamp    = scripting.addModule("/ti/sysbios/runtime/Timestamp");

/**
 * Write custom configuration values to the imported modules.
 */
ble.rfDesign                                              = "LAUNCHXL-CC1352P-2";
ble.lockProject                                           = true;
ble.defaultTxPower                                        = "HCI_EXT_TX_POWER_P2_20_DBM";
ble.numOfAdvSets                                          = 1;
ble.connUpdateParamsPeripheral.$name                      = "ti_ble5stack_general_ble_conn_update_params0";
ble.advSet1.$name                                         = "ti_ble5stack_broadcaster_advertisement_set0";
ble.advSet1.advParam1.$name                               = "ti_ble5stack_broadcaster_advertisement_params0";
ble.advSet1.advData1.$name                                = "ti_ble5stack_broadcaster_advertisement_data0";
ble.advSet1.advData1.GAP_ADTYPE_FLAGS                     = true;
ble.advSet1.advData1.advertisingFlags                     = ["GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED","GAP_ADTYPE_FLAGS_GENERAL"];
ble.advSet1.advData1.GAP_ADTYPE_LOCAL_NAME_SHORT          = true;
ble.advSet1.advData1.shortenedLocalName                   = "SP";
ble.advSet1.advData1.GAP_ADTYPE_16BIT_MORE                = true;
ble.advSet1.advData1.numOfUUIDs16More                     = 1;
ble.advSet1.advData1.UUID016More                          = 0xFFF0;
ble.advSet1.scanRes1.$name                                = "ti_ble5stack_broadcaster_advertisement_data1";
ble.advSet1.scanRes1.GAP_ADTYPE_LOCAL_NAME_COMPLETE       = true;
ble.advSet1.scanRes1.GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE = true;
ble.advSet1.scanRes1.maxConnInterval                      = 130;
ble.advSet1.scanRes1.GAP_ADTYPE_POWER_LEVEL               = true;
ble.radioConfig.codeExportConfig.$name                    = "ti_devices_radioconfig_code_export_param0";

CCFG.xoscCapArray             = true;
CCFG.xoscCapArrayDelta        = 0xC1;
CCFG.enableBootloader         = true;
CCFG.enableBootloaderBackdoor = true;
CCFG.dioBootloaderBackdoor    = 15;
CCFG.levelBootloaderBackdoor  = "Active low";
CCFG.ccfgTemplate.$name       = "ti_devices_CCFG_CCFGCC26XXTemplate0";

rfdesign.rfDesign = "LAUNCHXL-CC1352P-2";
rfdesign.fbSub1g  = "none";

Display1.$name                    = "CONFIG_Display_0";
Display1.$hardware                = system.deviceData.board.components.XDS110UART;
Display1.enableANSI               = true;
Display1.uartBufferSize           = 128;
Display1.uart.$name               = "CONFIG_DISPLAY_UART";
Display1.uart.txPinInstance.$name = "CONFIG_GPIO_UART_TX";
Display1.uart.rxPinInstance.$name = "CONFIG_GPIO_UART_RX";

AESCCM1.$name = "CONFIG_AESCCM0";

AESCTRDRBG1.$name              = "CONFIG_AESCTRDRBG_0";
AESCTRDRBG1.aesctrObject.$name = "CONFIG_AESCTR_0";

AESECB1.$name = "CONFIG_AESECB0";

ECDH1.$name = "CONFIG_ECDH0";

GPIO3.$hardware = system.deviceData.board.components["BTN-1"];
GPIO3.$name     = "CONFIG_GPIO_BTN1";

GPIO4.$hardware = system.deviceData.board.components["BTN-2"];
GPIO4.$name     = "CONFIG_GPIO_BTN2";

NVS1.$name                    = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.$name      = "ti_drivers_nvs_NVSCC26XX0";
NVS1.internalFlash.regionBase = 0x48000;
NVS1.internalFlash.regionSize = 0x4000;

RF.$hardware = system.deviceData.board.components["SKY13317-373LF"];

TRNG1.$name = "CONFIG_TRNG_0";

BIOS.assertsEnabled = false;
BIOS.rtsGateType    = "BIOS_GateMutexPri";
BIOS.heapSize       = 0x00000000;
BIOS.heapType       = "HeapCallback";

const Hwi           = scripting.addModule("/ti/sysbios/family/arm/m3/Hwi", {}, false);
Hwi.enableException = false;

HeapCallback.initFxn           = "osalHeapInitFxn";
HeapCallback.allocInstFxn      = "osalHeapAllocFxn";
HeapCallback.freeInstFxn       = "osalHeapFreeFxn";
HeapCallback.getStatsInstFxn   = "osalHeapGetStatsFxn";
HeapCallback.isBlockingInstFxn = "osalHeapIsBlockingFxn";

const Clock       = scripting.addModule("/ti/sysbios/knl/Clock", {}, false);
Clock.tickPeriod  = 10;
Clock.swiPriority = 5;

const Timer = scripting.addModule("/ti/sysbios/family/arm/cc26xx/Timer", {}, false);

Idle2.$name   = "powerIdle";
Idle2.idleFxn = "Power_idleFunc";

const Semaphore            = scripting.addModule("/ti/sysbios/knl/Semaphore", {}, false);
Semaphore.supportsPriority = false;

const Swi         = scripting.addModule("/ti/sysbios/knl/Swi", {}, false);
Swi.numPriorities = 6;

const Task             = scripting.addModule("/ti/sysbios/knl/Task", {}, false);
Task.defaultStackSize  = 512;
Task.idleTaskStackSize = 768;
Task.numPriorities     = 6;

Error.policy       = "Error_SPIN";
Error.printDetails = false;

const System           = scripting.addModule("/ti/sysbios/runtime/System", {}, false);
System.abortFxn        = "System_abortSpin";
System.exitFxn         = "System_exitSpin";
System.extendedFormats = "%f";
System.supportModule   = "SysCallback";

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
Display1.uart.uart.$suggestSolution       = "UART0";
Display1.uart.uart.txPin.$suggestSolution = "boosterpack.4";
Display1.uart.uart.rxPin.$suggestSolution = "boosterpack.3";
GPIO3.gpioPin.$suggestSolution            = "boosterpack.13";
GPIO4.gpioPin.$suggestSolution            = "boosterpack.8";
RF.rfAntennaPin0.$suggestSolution         = "ball.41";
RF.rfAntennaPin1.$suggestSolution         = "ball.42";
RF.rfAntennaPin2.$suggestSolution         = "ball.43";
Timer.rtc.$suggestSolution                = "RTC0";
