/**
 * 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_EM_CC2340R5" --rtos "freertos" --product "simplelink_lowpower_f3_sdk@8.10.01.02"
 * @versions {"tool":"1.20.0+3520"}
 */

/**
 * Import the modules used in this configuration.
 */
const FreeRTOS    = scripting.addModule("/freertos/FreeRTOS");
const ble         = scripting.addModule("/ti/ble5stack/ble");
const CCFG        = scripting.addModule("/ti/devices/CCFG");
const rfdesign    = scripting.addModule("/ti/devices/radioconfig/rfdesign");
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 RCL         = scripting.addModule("/ti/drivers/RCL");
const RNG         = scripting.addModule("/ti/drivers/RNG");
const RNG1        = RNG.addInstance();
const UART2       = scripting.addModule("/ti/drivers/UART2", {}, false);
const UART21      = UART2.addInstance();
const Button      = scripting.addModule("/ti/drivers/apps/Button", {}, false);
const Button1     = Button.addInstance();
const Button2     = Button.addInstance();
const Settings    = scripting.addModule("/ti/posix/freertos/Settings");

/**
 * Write custom configuration values to the imported modules.
 */
FreeRTOS.heapSize       = 0x00004D50;
FreeRTOS.timerStackSize = 0x00000190;
FreeRTOS.idleStackSize  = 0x00000130;

ble.basicBLE                           = true;
ble.disDevBySerUuid                    = true;
ble.deviceName                         = "Basic BLE project";
ble.numOfAdvSets                       = 1;
ble.numOfDefAdvSets                    = 1;
ble.deviceRole                         = "PERIPHERAL_CFG+CENTRAL_CFG";
ble.addressMode                        = "ADDRMODE_PUBLIC";
ble.maxPDUSize                         = 255;
ble.maxConnNum                         = 2;
ble.advRptFields                       = ["SCAN_ADVRPT_FLD_ADDRESS","SCAN_ADVRPT_FLD_ADDRTYPE","SCAN_ADVRPT_FLD_DATALEN","SCAN_ADVRPT_FLD_EVENTTYPE","SCAN_ADVRPT_FLD_PRIMPHY","SCAN_ADVRPT_FLD_RSSI","SCAN_ADVRPT_FLD_TXPOWER"];
ble.dupFilter                          = "SCAN_FLT_DUP_DISABLE";
ble.disableDisplayModule               = true;
ble.radioConfig.codeExportConfig.$name = "ti_devices_radioconfig_code_export_param0";
ble.connUpdateParamsCentral.$name      = "ti_ble5stack_general_ble_conn_update_params0";
ble.connUpdateParamsPeripheral.$name   = "ti_ble5stack_general_ble_conn_update_params1";
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.scanRes1.$name             = "ti_ble5stack_broadcaster_advertisement_data1";

CCFG.ccfgTemplate.$name = "ti_devices_CCFG_CCFGCC23X0Template0";

AESCCM1.$name = "CONFIG_AESCCM0";

AESCTRDRBG1.$name = "CONFIG_AESCTRDRBG_0";

AESECB1.$name = "CONFIG_AESECB0";

ECDH1.$name = "CONFIG_ECDH0";

GPIO3.$hardware = system.deviceData.board.components.LED_GREEN;
GPIO3.$name     = "CONFIG_GPIO_LED_GREEN";

GPIO4.$hardware = system.deviceData.board.components.LED_RED;
GPIO4.$name     = "CONFIG_GPIO_LED_RED";

NVS1.$name                    = "CONFIG_NVSINTERNAL";
NVS1.internalFlash.$name      = "ti_drivers_nvs_NVSLPF30";
NVS1.internalFlash.regionBase = 0x7C000;
NVS1.internalFlash.regionSize = 0x4000;

RNG1.$name = "CONFIG_RNG_0";

UART21.$name              = "CONFIG_UART2_0";
UART21.uart.txPin.$assign = "boosterpack.4";
UART21.uart.rxPin.$assign = "boosterpack.3";
scripting.suppress("Connected to hardware,@@@.+?@@@ is connected to XDS110 UART on the CC2340R5 Development Platform\\. Consider selecting it in \'use hardware\' above\\. @@@.+?@@@", UART21.uart, "txPin");
scripting.suppress("Connected to hardware,@@@.+?@@@ is connected to XDS110 UART on the CC2340R5 Development Platform\\. Consider selecting it in \'use hardware\' above\\. @@@.+?@@@", UART21.uart, "rxPin");

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

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

/**
 * 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.
 */
GPIO3.gpioPin.$suggestSolution            = "boosterpack.40";
GPIO4.gpioPin.$suggestSolution            = "boosterpack.39";
UART21.uart.$suggestSolution              = "UART0";
UART21.uart.dmaTxChannel.$suggestSolution = "DMA_CH1";
UART21.uart.dmaRxChannel.$suggestSolution = "DMA_CH0";
Button1.button.$suggestSolution           = "boosterpack.13";
Button2.button.$suggestSolution           = "boosterpack.12";
