/**
 * 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/LP_CC2652R7" --rtos "tirtos7" --product "simplelink_cc13xx_cc26xx_sdk@7.10.00.98"
 * @versions {"tool":"1.15.0+2826"}
 */

/**
 * 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 GPIO1        = GPIO.addInstance();
const GPIO2        = 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 LogModule    = scripting.addModule("/ti/log/LogModule");
const LogModule1   = LogModule.addInstance();
const LogModule2   = LogModule.addInstance();
const LogSinkBuf   = scripting.addModule("/ti/log/LogSinkBuf", {}, false);
const LogSinkBuf1  = LogSinkBuf.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.lockProject                                           = true;
ble.numOfAdvSets                                          = 3;
ble.periodicAdv                                           = true;
ble.addressMode                                           = "ADDRMODE_RANDOM";
ble.randomAddress                                         = "CA:00:00:00:00:CA";
ble.radioConfig.codeExportConfig.$name                    = "ti_devices_radioconfig_code_export_param0";
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.advSet2.$name                                         = "ti_ble5stack_broadcaster_advertisement_set1";
ble.advSet2.advParam2.$name                               = "ti_ble5stack_broadcaster_advertisement_params1";
ble.advSet2.advParam2.advType                             = "extended";
ble.advSet2.advData2.$name                                = "ti_ble5stack_broadcaster_advertisement_data2";
ble.advSet2.advData2.GAP_ADTYPE_FLAGS                     = true;
ble.advSet2.advData2.advertisingFlags                     = ["GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED","GAP_ADTYPE_FLAGS_GENERAL"];
ble.advSet2.advData2.GAP_ADTYPE_LOCAL_NAME_SHORT          = true;
ble.advSet2.advData2.shortenedLocalName                   = "SP";
ble.advSet2.advData2.GAP_ADTYPE_16BIT_MORE                = true;
ble.advSet2.advData2.numOfUUIDs16More                     = 1;
ble.advSet2.advData2.UUID016More                          = 0xFFF0;
ble.advSet2.scanRes2.$name                                = "ti_ble5stack_broadcaster_advertisement_data3";
ble.advSet3.$name                                         = "ti_ble5stack_broadcaster_advertisement_set2";
ble.advSet3.advParam3.$name                               = "ti_ble5stack_broadcaster_advertisement_params2";
ble.advSet3.advParam3.advType                             = "extended";
ble.advSet3.advParam3.eventProps                          = [];
ble.advSet3.advParam3.sid                                 = 1;
ble.advSet3.advParam3.primPhy                             = "GAP_ADV_PRIM_PHY_1_MBPS";
ble.advSet3.advParam3.secPhy                              = "GAP_ADV_SEC_PHY_1_MBPS";
ble.advSet3.advParam3.primIntMax                          = 10000;
ble.advSet3.advParam3.primIntMin                          = 10000;
ble.advSet3.advData3.$name                                = "ti_ble5stack_broadcaster_advertisement_data4";
ble.advSet3.advData3.GAP_ADTYPE_LOCAL_NAME_SHORT          = true;
ble.advSet3.advData3.shortenedLocalName                   = "AdvPer";
ble.advSet3.scanRes3.$name                                = "ti_ble5stack_broadcaster_advertisement_data5";
ble.advSet3.scanRes3.GAP_ADTYPE_LOCAL_NAME_COMPLETE       = true;

CCFG.enableBootloader         = true;
CCFG.enableBootloaderBackdoor = true;
CCFG.dioBootloaderBackdoor    = 13;
CCFG.levelBootloaderBackdoor  = "Active low";
CCFG.ccfgTemplate.$name       = "ti_devices_CCFG_CCFGCC26XXTemplate0";

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";

AESECB1.$name = "CONFIG_AESECB0";

ECDH1.$name = "CONFIG_ECDH0";

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

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

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

TRNG1.$name = "CONFIG_TRNG_0";

LogModule.enable_VERBOSE = true;
LogModule.enable_INFO    = true;
LogModule.enable_ERROR   = true;

LogModule1.enable_VERBOSE = true;
LogModule1.enable_INFO    = true;
LogModule1.$name          = "LogModule_App1";
LogModule1.enable_ERROR   = true;

LogModule2.enable_VERBOSE = true;
LogModule2.enable_INFO    = true;
LogModule2.$name          = "LogModule_App2";
LogModule2.enable_WARNING = true;

LogModule1.logger = LogSinkBuf1;
LogModule2.logger = LogSinkBuf1;
LogSinkBuf1.$name = "CONFIG_ti_log_LogSinkBuf_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";
GPIO1.gpioPin.$suggestSolution            = "boosterpack.13";
GPIO2.gpioPin.$suggestSolution            = "boosterpack.12";
Timer.rtc.$suggestSolution                = "RTC0";
