This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC2640R2: Analog GPIOs crash as digital output

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: SYSBIOS

Hello everyone,

I have a LaunchXL-CC2640R2 here that I need to attach to an unknown 4-mux segmented display. To test that I'm going to control one segment at a time so I can make a list which segment belongs to which backplane and segment drive. However I have some problems configuring the output pins:

/*---PIN DEFINITIONS---*/
#define PIN_COM0 IOID_0
#define PIN_COM1 IOID_1
#define PIN_COM2 IOID_2
#define PIN_COM3 IOID_3

#define PIN_SEG0 IOID_4
#define PIN_SEG1 IOID_5
#define PIN_SEG2 IOID_6
#define PIN_SEG3 IOID_11
#define PIN_SEG4 IOID_12
#define PIN_SEG5 IOID_15
#define PIN_SEG6 IOID_18
#define PIN_SEG7 IOID_19
#define PIN_SEG8 IOID_20
#define PIN_SEG9 IOID_21
#define PIN_SEG10 IOID_22
#define PIN_SEG11 IOID_23
#define PIN_SEG12 IOID_24
#define PIN_SEG13 IOID_25
#define PIN_SEG14 IOID_26
#define PIN_SEG15 IOID_27
#define PIN_SEG16 IOID_28
#define PIN_SEG17 IOID_29
#define PIN_SEG18 IOID_30
#define PIN_SEG19 IOID_7



GPIO_setConfig(PIN_COM0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_COM1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_COM2, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_COM3, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG2, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG3, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG4, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG5, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG6, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG7, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG8, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG9, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG10, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG11, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG12, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG13, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG14, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG15, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG16, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG17, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG18, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(PIN_SEG19, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

This code runs fine and without problems, the interrupts registered to the BUTTON0 (IOID_13) and BUTTON1 (IOID_14) pins work well. The following code runs also, but only until PIN_SEG11 is written:


GPIO_write(PIN_COM0, true);
GPIO_write(PIN_COM1, true);
GPIO_write(PIN_COM2, true);
GPIO_write(PIN_COM3, true);
GPIO_write(PIN_SEG0, true);
GPIO_write(PIN_SEG1, true);
GPIO_write(PIN_SEG2, true);
GPIO_write(PIN_SEG3, true);
GPIO_write(PIN_SEG4, true);
GPIO_write(PIN_SEG5, true);
GPIO_write(PIN_SEG6, true);
GPIO_write(PIN_SEG7, true);
GPIO_write(PIN_SEG8, true);
GPIO_write(PIN_SEG9, true);
GPIO_write(PIN_SEG10, true);    //still running
GPIO_write(PIN_SEG11, true);    //here lies my problem
GPIO_write(PIN_SEG12, true);
GPIO_write(PIN_SEG13, true);
GPIO_write(PIN_SEG14, true);
GPIO_write(PIN_SEG15, true);
GPIO_write(PIN_SEG16, true);
GPIO_write(PIN_SEG17, true);
GPIO_write(PIN_SEG18, true);
GPIO_write(PIN_SEG19, true);*/

Afterwards my interrupts don't trigger anymore. As you can see, the problem occurs when PIN_SEG11 aka IOID_23 aka A0 pin is written. But as I saw in other codes, it is possible to use those analog pins as a digital output. Do I have to remove some code somewhere to disable the analog features first? My program is based on the "empty_CC2640R2_LAUNCHXL_tirtos_ccs" example. Below my empty.cfg-file to enable System_printf() output:

utils.importFile("C:/ti/simplelink_cc2640r2_sdk_5_10_00_02/source/ti/ble5stack/common/cc26xx/kernel/cc2640/config/cc2640_r2_csdk.cfg");

/*
* Extend the cc2640 configuration
*/
var SysStd = xdc.useModule("xdc.runtime.SysStd");
var System = xdc.useModule("xdc.runtime.System");
System.SupportProxy = SysStd;


System.extendedFormats = '%$L%$S%$F%f';


/* ================ POSIX configuration ================ */
var Settings = xdc.useModule('ti.sysbios.posix.Settings');

if (Program.build.target.$name.match(/iar/)) {
    var MultithreadSupport = xdc.useModule('ti.sysbios.rts.iar.MultithreadSupport');
    MultithreadSupport.enableMultithreadSupport = false;
}

Thanks a lot in advance for helping me out here! (:

best wishes from Germany,
Nico

  • PS: I also seem to be unable to really change pin states here. No matter if I write a "true" or "false", pin 4 for example always stays in its HIGH state.  GPIO_init() is called right before the pin configurations, so that shouldn't be the problem.

  • Hello Nico,

    What are the contents of CC2640R2_LAUNCHXL_GPIOName in CC2640R2_LAUNCHXL.h and does it align with gpioPinConfigs from CC2640R2_LAUNCHXL.c?  You will also need to make sure that the analog pins are removed from CC2640R2_LAUNCHXL_ADCBuf0ChannelName/CC2640R2_LAUNCHXL_ADCName & ADCBufCC26XX_adcChannelLut/adcCC26xxHWAttrs/ADC_config to avoid overlap.  You can review other E2E threads to further understand how to implement these changes.

    Regards,
    Ryan

  • Hello Ryan,

    thanks a lot for your answer! My CC2640R2_LAUNCHXL.c looks like this:

    /*
     * Copyright (c) 2016-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ====================== CC2640R2_LAUNCHXL.c ===================================
     *  This file is responsible for setting up the board specific items for the
     *  CC2640R2_LAUNCHXL board.
     */
    
    #include <stdbool.h>
    #include <stddef.h>
    #include <stdint.h>
    
    #include <ti/devices/cc26x0r2/driverlib/ioc.h>
    #include <ti/devices/cc26x0r2/driverlib/udma.h>
    #include <ti/devices/cc26x0r2/inc/hw_ints.h>
    #include <ti/devices/cc26x0r2/inc/hw_memmap.h>
    
    #include "CC2640R2_LAUNCHXL.h"
    
    /*
     *  =============================== ADCBuf ===============================
     */
    #include <ti/drivers/ADCBuf.h>
    #include <ti/drivers/adcbuf/ADCBufCC26XX.h>
    
    ADCBufCC26XX_Object adcBufCC26xxObjects[CC2640R2_LAUNCHXL_ADCBUFCOUNT];
    
    /*
     *  This table converts a virtual adc channel into a dio and internal analogue
     *  input signal. This table is necessary for the functioning of the adcBuf
     *  driver. Comment out unused entries to save flash. Dio and internal signal
     *  pairs are hardwired. Do not remap them in the table. You may reorder entire
     *  entries. The mapping of dio and internal signals is package dependent.
     */
    const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC2640R2_LAUNCHXL_ADCBUF0CHANNELCOUNT] = {
        /*{CC2640R2_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
        {CC2640R2_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6},
        {CC2640R2_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5},
        {CC2640R2_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4},
        {CC2640R2_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3},
        {CC2640R2_LAUNCHXL_DIO28_ANALOG, ADC_COMPB_IN_AUXIO2},
        {CC2640R2_LAUNCHXL_DIO29_ANALOG, ADC_COMPB_IN_AUXIO1},
        {CC2640R2_LAUNCHXL_DIO30_ANALOG, ADC_COMPB_IN_AUXIO0},*/
        {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
        {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
        {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
    };
    
    const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCBUFCOUNT] = {
        {
            .intPriority       = ~0,
            .swiPriority       = 0,
            .adcChannelLut     = ADCBufCC26XX_adcChannelLut,
        }
    };
    
    const ADCBuf_Config ADCBuf_config[CC2640R2_LAUNCHXL_ADCBUFCOUNT] = {
        {
            &ADCBufCC26XX_fxnTable,
            &adcBufCC26xxObjects[CC2640R2_LAUNCHXL_ADCBUF0],
            &adcBufCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCBUF0]
        },
    };
    
    const uint_least8_t ADCBuf_count = CC2640R2_LAUNCHXL_ADCBUFCOUNT;
    
    /*
     *  =============================== ADC ===============================
     */
    #include <ti/drivers/ADC.h>
    #include <ti/drivers/adc/ADCCC26XX.h>
    
    ADCCC26XX_Object adcCC26xxObjects[CC2640R2_LAUNCHXL_ADCCOUNT];
    
    const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCCOUNT] = {
        /*{
            .adcDIO              = CC2640R2_LAUNCHXL_DIO23_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO7,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO24_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO6,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO25_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO5,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO26_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO4,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO27_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO3,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO28_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO2,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO29_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO1,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = CC2640R2_LAUNCHXL_DIO30_ANALOG,
            .adcCompBInput       = ADC_COMPB_IN_AUXIO0,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_10P9_MS,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },*/
        {
            .adcDIO              = PIN_UNASSIGNED,
            .adcCompBInput       = ADC_COMPB_IN_DCOUPL,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = PIN_UNASSIGNED,
            .adcCompBInput       = ADC_COMPB_IN_VSS,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        },
        {
            .adcDIO              = PIN_UNASSIGNED,
            .adcCompBInput       = ADC_COMPB_IN_VDDS,
            .refSource           = ADCCC26XX_FIXED_REFERENCE,
            .samplingDuration    = ADCCC26XX_SAMPLING_DURATION_2P7_US,
            .inputScalingEnabled = true,
            .triggerSource       = ADCCC26XX_TRIGGER_MANUAL,
            .returnAdjustedVal   = false
        }
    };
    
    const ADC_Config ADC_config[CC2640R2_LAUNCHXL_ADCCOUNT] = {
        /*{&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC0]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC1]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC2]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC3]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC4]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC5], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC5]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC6], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC6]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADC7], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADC7]},*/
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCDCOUPL]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCVSS]},
        {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2640R2_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC2640R2_LAUNCHXL_ADCVDDS]},
    };
    
    const uint_least8_t ADC_count = CC2640R2_LAUNCHXL_ADCCOUNT;
    
    /*
     *  =============================== Crypto ===============================
     */
    #include <ti/drivers/crypto/CryptoCC26XX.h>
    
    CryptoCC26XX_Object cryptoCC26XXObjects[CC2640R2_LAUNCHXL_CRYPTOCOUNT];
    
    const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2640R2_LAUNCHXL_CRYPTOCOUNT] = {
        {
            .baseAddr       = CRYPTO_BASE,
            .powerMngrId    = PowerCC26XX_PERIPH_CRYPTO,
            .intNum         = INT_CRYPTO_RESULT_AVAIL_IRQ,
            .intPriority    = ~0,
        }
    };
    
    const CryptoCC26XX_Config CryptoCC26XX_config[CC2640R2_LAUNCHXL_CRYPTOCOUNT] = {
        {
             .object  = &cryptoCC26XXObjects[CC2640R2_LAUNCHXL_CRYPTO0],
             .hwAttrs = &cryptoCC26XXHWAttrs[CC2640R2_LAUNCHXL_CRYPTO0]
        },
    };
    
    /*
     *  =============================== AESCCM ===============================
     */
    #include <ti/drivers/AESCCM.h>
    #include <ti/drivers/aesccm/AESCCMCC26XX.h>
    
    AESCCMCC26XX_Object aesccmCC26XXObjects[CC2640R2_LAUNCHXL_AESCCMCOUNT];
    
    const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCCMCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCCM_Config AESCCM_config[CC2640R2_LAUNCHXL_AESCCMCOUNT] = {
        {
             .object  = &aesccmCC26XXObjects[CC2640R2_LAUNCHXL_AESCCM0],
             .hwAttrs = &aesccmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCCM0]
        },
    };
    
    const uint_least8_t AESCCM_count = CC2640R2_LAUNCHXL_AESCCMCOUNT;
    
    
    /*
     *  =============================== AESGCM ===============================
     */
    #include <ti/drivers/AESGCM.h>
    #include <ti/drivers/aesgcm/AESGCMCC26XX.h>
    
    AESGCMCC26XX_Object aesgcmCC26XXObjects[CC2640R2_LAUNCHXL_AESGCMCOUNT];
    
    const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESGCMCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESGCM_Config AESGCM_config[CC2640R2_LAUNCHXL_AESGCMCOUNT] = {
        {
             .object  = &aesgcmCC26XXObjects[CC2640R2_LAUNCHXL_AESGCM0],
             .hwAttrs = &aesgcmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESGCM0]
        },
    };
    
    const uint_least8_t AESGCM_count = CC2640R2_LAUNCHXL_AESGCMCOUNT;
    
    /*
     *  =============================== AESCBC ===============================
     */
    #include <ti/drivers/AESCBC.h>
    #include <ti/drivers/aescbc/AESCBCCC26XX.h>
    
    AESCBCCC26XX_Object aescbcCC26XXObjects[CC2640R2_LAUNCHXL_AESCBCCOUNT];
    
    const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCBCCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCBC_Config AESCBC_config[CC2640R2_LAUNCHXL_AESCBCCOUNT] = {
        {
             .object  = &aescbcCC26XXObjects[CC2640R2_LAUNCHXL_AESCBC0],
             .hwAttrs = &aescbcCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCBC0]
        },
    };
    
    const uint_least8_t AESCBC_count = CC2640R2_LAUNCHXL_AESCBCCOUNT;
    
    /*
     *  =============================== AESCTR ===============================
     */
    #include <ti/drivers/AESCTR.h>
    #include <ti/drivers/aesctr/AESCTRCC26XX.h>
    
    AESCTRCC26XX_Object aesctrCC26XXObjects[CC2640R2_LAUNCHXL_AESCTRCOUNT];
    
    const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCTRCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCTR_Config AESCTR_config[CC2640R2_LAUNCHXL_AESCTRCOUNT] = {
        {
             .object  = &aesctrCC26XXObjects[CC2640R2_LAUNCHXL_AESCTR0],
             .hwAttrs = &aesctrCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCTR0]
        },
    };
    
    const uint_least8_t AESCTR_count = CC2640R2_LAUNCHXL_AESCTRCOUNT;
    
    /*
     *  =============================== AESECB ===============================
     */
    #include <ti/drivers/AESECB.h>
    #include <ti/drivers/aesecb/AESECBCC26XX.h>
    
    AESECBCC26XX_Object aesecbCC26XXObjects[CC2640R2_LAUNCHXL_AESECBCOUNT];
    
    const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESECBCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESECB_Config AESECB_config[CC2640R2_LAUNCHXL_AESECBCOUNT] = {
        {
             .object  = &aesecbCC26XXObjects[CC2640R2_LAUNCHXL_AESECB0],
             .hwAttrs = &aesecbCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESECB0]
        },
    };
    
    const uint_least8_t AESECB_count = CC2640R2_LAUNCHXL_AESECBCOUNT;
    
    /*
     *  =============================== AESCTRDRBG ===============================
     */
    #include <ti/drivers/AESCTRDRBG.h>
    #include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
    
    AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT];
    
    const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT] = {
        {
            .aesctrIndex       = CC2640R2_LAUNCHXL_AESCTR0,
        }
    };
    
    const AESCTRDRBG_Config AESCTRDRBG_config[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT] = {
        {
             .object  = &aesctrdrbgXXObjects[CC2640R2_LAUNCHXL_AESCTRDRBG0],
             .hwAttrs = &aesctrdrbgXXHWAttrs[CC2640R2_LAUNCHXL_AESCTRDRBG0]
        },
    };
    
    const uint_least8_t AESCTRDRBG_count = CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT;
    
    /*
     *  =============================== TRNG ===============================
     */
    #include <ti/drivers/TRNG.h>
    #include <ti/drivers/trng/TRNGCC26XX.h>
    
    TRNGCC26XX_Object trngCC26XXObjects[CC2640R2_LAUNCHXL_TRNGCOUNT];
    
    const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC2640R2_LAUNCHXL_TRNGCOUNT] = {
        {
            .intPriority       = ~0,
            .swiPriority       = 0,
            .samplesPerCycle   = 240000,
        }
    };
    
    const TRNG_Config TRNG_config[CC2640R2_LAUNCHXL_TRNGCOUNT] = {
        {
             .object  = &trngCC26XXObjects[CC2640R2_LAUNCHXL_TRNG0],
             .hwAttrs = &trngCC26X2HWAttrs[CC2640R2_LAUNCHXL_TRNG0]
        },
    };
    
    const uint_least8_t TRNG_count = CC2640R2_LAUNCHXL_TRNGCOUNT;
    
    
    /*
     *  =============================== Display ===============================
     */
    #include <ti/display/Display.h>
    #include <ti/display/DisplayUart.h>
    #include <ti/display/DisplaySharp.h>
    
    #ifndef BOARD_DISPLAY_UART_STRBUF_SIZE
    #define BOARD_DISPLAY_UART_STRBUF_SIZE    128
    #endif
    
    /* This value can be changed to 96 for use with the 430BOOST-SHARP96 BoosterPack. */
    #define BOARD_DISPLAY_SHARP_SIZE    128
    
    DisplayUart_Object     displayUartObject;
    DisplaySharp_Object    displaySharpObject;
    
    static char uartStringBuf[BOARD_DISPLAY_UART_STRBUF_SIZE];
    static uint_least8_t sharpDisplayBuf[BOARD_DISPLAY_SHARP_SIZE * BOARD_DISPLAY_SHARP_SIZE / 8];
    
    const DisplayUart_HWAttrs displayUartHWAttrs = {
        .uartIdx      = CC2640R2_LAUNCHXL_UART0,
        .baudRate     = 115200,
        .mutexTimeout = (unsigned int)(-1),
        .strBuf       = uartStringBuf,
        .strBufLen    = BOARD_DISPLAY_UART_STRBUF_SIZE,
    };
    
    const DisplaySharp_HWAttrsV1 displaySharpHWattrs = {
        .spiIndex    = CC2640R2_LAUNCHXL_SPI0,
        .csPin       = CC2640R2_LAUNCHXL_GPIO_LCD_CS,
        .powerPin    = CC2640R2_LAUNCHXL_GPIO_LCD_POWER,
        .enablePin   = CC2640R2_LAUNCHXL_GPIO_LCD_ENABLE,
        .pixelWidth  = BOARD_DISPLAY_SHARP_SIZE,
        .pixelHeight = BOARD_DISPLAY_SHARP_SIZE,
        .displayBuf  = sharpDisplayBuf,
    };
    
    #ifndef BOARD_DISPLAY_USE_UART
    #define BOARD_DISPLAY_USE_UART 1
    #endif
    #ifndef BOARD_DISPLAY_USE_UART_ANSI
    #define BOARD_DISPLAY_USE_UART_ANSI 0
    #endif
    #ifndef BOARD_DISPLAY_USE_LCD
    #define BOARD_DISPLAY_USE_LCD 0
    #endif
    
    /*
     * This #if/#else is needed to workaround a problem with the
     * IAR compiler. The IAR compiler doesn't like the empty array
     * initialization. (IAR Error[Pe1345])
     */
    #if (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD)
    
    const Display_Config Display_config[] = {
    #if (BOARD_DISPLAY_USE_UART)
        {
    #  if (BOARD_DISPLAY_USE_UART_ANSI)
            .fxnTablePtr = &DisplayUartAnsi_fxnTable,
    #  else /* Default to minimal UART with no cursor placement */
            .fxnTablePtr = &DisplayUartMin_fxnTable,
    #  endif
            .object      = &displayUartObject,
            .hwAttrs     = &displayUartHWAttrs,
        },
    #endif
    #if (BOARD_DISPLAY_USE_LCD)
        {
            .fxnTablePtr = &DisplaySharp_fxnTable,
            .object      = &displaySharpObject,
            .hwAttrs     = &displaySharpHWattrs
        },
    #endif
    };
    
    const uint_least8_t Display_count = sizeof(Display_config) / sizeof(Display_Config);
    
    #else
    
    const Display_Config *Display_config = NULL;
    const uint_least8_t Display_count = 0;
    
    #endif /* (BOARD_DISPLAY_USE_UART || BOARD_DISPLAY_USE_LCD) */
    
    /*
     *  =============================== GPIO ===============================
     */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/gpio/GPIOCC26XX.h>
    
    /*
     * Array of Pin configurations
     * NOTE: The order of the pin configurations must coincide with what was
     *       defined in CC2640R2_LAUNCHXL.h
     * NOTE: Pins not used for interrupts should be placed at the end of the
     *       array. Callback entries can be omitted from callbacks array to
     *       reduce memory usage.
     */
    GPIO_PinConfig gpioPinConfigs[] = {
        /* Input pins */
        GPIOCC26XX_DIO_13 | GPIO_DO_NOT_CONFIG,  /* Button 0 */
        GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG,  /* Button 1 */
    
        GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG,  /* CC2640R2_LAUNCHXL_SPI_MASTER_READY */
        GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,  /* CC2640R2_LAUNCHXL_SPI_SLAVE_READY */
    
        /* Output pins */
        GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG,  /* Green LED */
        GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG,  /* Red LED */
        GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG,  /* TMP116_EN */
    
        /* SPI Flash CSN */
        GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG,
    
        /* SD CS */
        GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,
    
        /* Sharp Display - GPIO configurations will be done in the Display files */
        GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
        GPIOCC26XX_DIO_22 | GPIO_DO_NOT_CONFIG, /* LCD power control */
        GPIOCC26XX_DIO_23 | GPIO_DO_NOT_CONFIG, /*LCD enable */
    
    };
    
    /*
     * Array of callback function pointers
     * NOTE: The order of the pin configurations must coincide with what was
     *       defined in CC2640R2_LAUNCH.h
     * NOTE: Pins not used for interrupts can be omitted from callbacks array to
     *       reduce memory usage (if placed at end of gpioPinConfigs array).
     */
    GPIO_CallbackFxn gpioCallbackFunctions[] = {
        NULL,  /* Button 0 */
        NULL,  /* Button 1 */
        NULL,  /* CC2640R2_LAUNCHXL_SPI_MASTER_READY */
        NULL,  /* CC2640R2_LAUNCHXL_SPI_SLAVE_READY */
    };
    
    const GPIOCC26XX_Config GPIOCC26XX_config = {
        .pinConfigs         = (GPIO_PinConfig *)gpioPinConfigs,
        .callbacks          = (GPIO_CallbackFxn *)gpioCallbackFunctions,
        .numberOfPinConfigs = CC2640R2_LAUNCHXL_GPIOCOUNT,
        .numberOfCallbacks  = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
        .intPriority        = (~0)
    };
    
    /*
     *  =============================== GPTimer ===============================
     *  Remove unused entries to reduce flash usage both in Board.c and Board.h
     */
    #include <ti/drivers/timer/GPTimerCC26XX.h>
    
    GPTimerCC26XX_Object gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMERCOUNT];
    
    const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMERPARTSCOUNT] = {
        { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
        { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
        { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
        { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
        { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
        { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
        { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
        { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
    };
    
    const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2640R2_LAUNCHXL_GPTIMERPARTSCOUNT] = {
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER0A], GPT_A },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER0B], GPT_B },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER1A], GPT_A },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER1B], GPT_B },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER2A], GPT_A },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER2B], GPT_B },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER3A], GPT_A },
        { &gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_GPTIMER3B], GPT_B },
    };
    
    /*
     *  =============================== I2C ===============================
    */
    #include <ti/drivers/I2C.h>
    #include <ti/drivers/i2c/I2CCC26XX.h>
    
    I2CCC26XX_Object i2cCC26xxObjects[CC2640R2_LAUNCHXL_I2CCOUNT];
    
    const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2640R2_LAUNCHXL_I2CCOUNT] = {
        {
            .baseAddr    = I2C0_BASE,
            .powerMngrId = PowerCC26XX_PERIPH_I2C0,
            .intNum      = INT_I2C_IRQ,
            .intPriority = ~0,
            .swiPriority = 0,
            .sdaPin      = CC2640R2_LAUNCHXL_I2C0_SDA0,
            .sclPin      = CC2640R2_LAUNCHXL_I2C0_SCL0,
        }
    };
    
    const I2C_Config I2C_config[CC2640R2_LAUNCHXL_I2CCOUNT] = {
        {
            .fxnTablePtr = &I2CCC26XX_fxnTable,
            .object      = &i2cCC26xxObjects[CC2640R2_LAUNCHXL_I2C0],
            .hwAttrs     = &i2cCC26xxHWAttrs[CC2640R2_LAUNCHXL_I2C0]
        },
    };
    
    const uint_least8_t I2C_count = CC2640R2_LAUNCHXL_I2CCOUNT;
    
    /*
     *  =============================== I2S ===============================
    */
    #include <ti/drivers/I2S.h>
    #include <ti/drivers/i2s/I2SCC26XX.h>
    
    I2SCC26XX_Object i2sCC26XXObjects[CC2640R2_LAUNCHXL_I2SCOUNT];
    
    const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC2640R2_LAUNCHXL_I2SCOUNT] = {
        {
            .pinSD1      =  CC2640R2_LAUNCHXL_I2S_ADI,
            .pinSD0      =  CC2640R2_LAUNCHXL_I2S_ADO,
            .pinSCK      =  CC2640R2_LAUNCHXL_I2S_BCLK,
            .pinMCLK     =  CC2640R2_LAUNCHXL_I2S_MCLK,
            .pinWS       =  CC2640R2_LAUNCHXL_I2S_WCLK,
            .intPriority = ~0,
        }
    };
    
    const I2S_Config I2S_config[CC2640R2_LAUNCHXL_I2SCOUNT] = {
        {
            .object      = &i2sCC26XXObjects[CC2640R2_LAUNCHXL_I2S0],
            .hwAttrs     = &i2sCC26XXHWAttrs[CC2640R2_LAUNCHXL_I2S0]
        },
    };
    
    const uint_least8_t I2S_count = CC2640R2_LAUNCHXL_I2SCOUNT;
    
    /*
     *  =============================== NVS ===============================
     */
    #include <ti/drivers/NVS.h>
    #include <ti/drivers/nvs/NVSSPI25X.h>
    #include <ti/drivers/nvs/NVSCC26XX.h>
    
    #define NVS_REGIONS_BASE 0x1A000
    #define SECTORSIZE       0x1000
    #define REGIONSIZE       (SECTORSIZE * 4)
    
    #ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
    
    /*
     * Reserve flash sectors for NVS driver use by placing an uninitialized byte
     * array at the desired flash address.
     */
    #if defined(__TI_COMPILER_VERSION__)
    
    /*
     * Place uninitialized array at NVS_REGIONS_BASE
     */
    #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
    #pragma NOINIT(flashBuf);
    static char flashBuf[REGIONSIZE];
    
    #elif defined(__IAR_SYSTEMS_ICC__)
    
    /*
     * Place uninitialized array at NVS_REGIONS_BASE
     */
    static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
    
    #elif defined(__GNUC__)
    
    /*
     * Place the flash buffers in the .nvs section created in the gcc linker file.
     * The .nvs section enforces alignment on a sector boundary but may
     * be placed anywhere in flash memory.  If desired the .nvs section can be set
     * to a fixed address by changing the following in the gcc linker file:
     *
     * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
     *      *(.nvs)
     * } > REGION_TEXT
     */
    __attribute__ ((section (".nvs")))
    static char flashBuf[REGIONSIZE];
    
    #endif
    
    /* Allocate objects for NVS Internal Regions */
    NVSCC26XX_Object nvsCC26xxObjects[1];
    
    /* Hardware attributes for NVS Internal Regions */
    const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
        {
            .regionBase = (void *)flashBuf,
            .regionSize = REGIONSIZE,
        },
    };
    
    #endif /* Board_EXCLUDE_NVS_INTERNAL_FLASH */
    
    #ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
    
    #define SPISECTORSIZE    0x1000
    #define SPIREGIONSIZE    (SPISECTORSIZE * 32)
    #define VERIFYBUFSIZE    64
    
    static uint8_t verifyBuf[VERIFYBUFSIZE];
    
    /* Allocate objects for NVS External Regions */
    NVSSPI25X_Object nvsSPI25XObjects[1];
    
    /* Hardware attributes for NVS External Regions */
    const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
        {
            .regionBaseOffset = 0,
            .regionSize = SPIREGIONSIZE,
            .sectorSize = SPISECTORSIZE,
            .verifyBuf = verifyBuf,
            .verifyBufSize = VERIFYBUFSIZE,
            .spiHandle = NULL,
            .spiIndex = 0,
            .spiBitRate = 4000000,
            .spiCsnGpioIndex = CC2640R2_LAUNCHXL_GPIO_SPI_FLASH_CS,
            .statusPollDelayUs = 100,
        },
    };
    
    #endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
    
    /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
    const NVS_Config NVS_config[CC2640R2_LAUNCHXL_NVSCOUNT] = {
    #ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
        {
            .fxnTablePtr = &NVSCC26XX_fxnTable,
            .object = &nvsCC26xxObjects[0],
            .hwAttrs = &nvsCC26xxHWAttrs[0],
        },
    #endif
    #ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
        {
            .fxnTablePtr = &NVSSPI25X_fxnTable,
            .object = &nvsSPI25XObjects[0],
            .hwAttrs = &nvsSPI25XHWAttrs[0],
        },
    #endif
    };
    
    const uint_least8_t NVS_count = CC2640R2_LAUNCHXL_NVSCOUNT;
    
    /*
     *  =============================== PIN ===============================
     */
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    const PIN_Config BoardGpioInitTable[] = {
    
        CC2640R2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,       /* LED initially off */
        CC2640R2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,          /* Button is active low */
        CC2640R2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN,  /* External flash chip select */
        CC2640R2_LAUNCHXL_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN,                                              /* UART RX via debugger back channel */
        CC2640R2_LAUNCHXL_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL,                         /* UART TX via debugger back channel */
        CC2640R2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master out - slave in */
        CC2640R2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN,                                            /* SPI master in - slave out */
        CC2640R2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN,                                             /* SPI clock */
    
        PIN_TERMINATE
    };
    
    const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
        .intPriority = ~0,
        .swiPriority = 0
    };
    
    /*
     *  =============================== Power ===============================
     */
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    
    const PowerCC26XX_Config PowerCC26XX_config = {
        .policyInitFxn      = NULL,
        .policyFxn          = &PowerCC26XX_standbyPolicy,
        .calibrateFxn       = &PowerCC26XX_calibrate,
        .enablePolicy       = true,
        .calibrateRCOSC_LF  = true,
        .calibrateRCOSC_HF  = true,
    };
    
    /*
     *  =============================== PWM ===============================
     *  Remove unused entries to reduce flash usage both in Board.c and Board.h
     */
    #include <ti/drivers/PWM.h>
    #include <ti/drivers/pwm/PWMTimerCC26XX.h>
    
    PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWMCOUNT];
    
    const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWMCOUNT] = {
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER0A },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER0B },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER1A },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER1B },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER2A },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER2B },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER3A },
        { .pwmPin = CC2640R2_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC2640R2_LAUNCHXL_GPTIMER3B },
    };
    
    const PWM_Config PWM_config[CC2640R2_LAUNCHXL_PWMCOUNT] = {
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM0] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM1] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM2] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM3] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM4] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM5] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM6] },
        { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2640R2_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC2640R2_LAUNCHXL_PWM7] },
    };
    
    const uint_least8_t PWM_count = CC2640R2_LAUNCHXL_PWMCOUNT;
    
    /*
     *  =============================== RF Driver ===============================
     */
    #include <ti/drivers/rf/RF.h>
    
    const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
        .hwiPriority        = ~0,       /* Lowest HWI priority */
        .swiPriority        = 0,        /* Lowest SWI priority */
        .xoscHfAlwaysNeeded = true,     /* Keep XOSC dependency while in standby */
        .globalCallback     = NULL,     /* No board specific callback */
        .globalEventMask    = 0         /* No events subscribed to */
    };
    
    /*
     *  =============================== SD ===============================
     */
    #include <ti/drivers/SD.h>
    #include <ti/drivers/sd/SDSPI.h>
    
    SDSPI_Object sdspiObjects[CC2640R2_LAUNCHXL_SDCOUNT];
    
    const SDSPI_HWAttrs sdspiHWAttrs[CC2640R2_LAUNCHXL_SDCOUNT] = {
        {
            .spiIndex = CC2640R2_LAUNCHXL_SPI0,
            .spiCsGpioIndex = CC2640R2_LAUNCHXL_SDSPI_CS
        }
    };
    
    const SD_Config SD_config[CC2640R2_LAUNCHXL_SDCOUNT] = {
        {
            .fxnTablePtr = &SDSPI_fxnTable,
            .object = &sdspiObjects[CC2640R2_LAUNCHXL_SDSPI0],
            .hwAttrs = &sdspiHWAttrs[CC2640R2_LAUNCHXL_SDSPI0]
        },
    };
    
    const uint_least8_t SD_count = CC2640R2_LAUNCHXL_SDCOUNT;
    
    /*
     *  =============================== SPI DMA ===============================
     */
    #include <ti/drivers/SPI.h>
    #include <ti/drivers/spi/SPICC26XXDMA.h>
    
    SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2640R2_LAUNCHXL_SPICOUNT];
    
    /*
     * NOTE: The SPI instances below can be used by the SD driver to communicate
     * with a SD card via SPI.  The 'defaultTxBufValue' fields below are set to 0xFF
     * to satisfy the SDSPI driver requirement.
     */
    const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPICOUNT] = {
        {
            .baseAddr           = SSI0_BASE,
            .intNum             = INT_SSI0_COMB,
            .intPriority        = ~0,
            .swiPriority        = 0,
            .powerMngrId        = PowerCC26XX_PERIPH_SSI0,
            .defaultTxBufValue  = 0xFF,
            .rxChannelBitMask   = 1<<UDMA_CHAN_SSI0_RX,
            .txChannelBitMask   = 1<<UDMA_CHAN_SSI0_TX,
            .mosiPin            = CC2640R2_LAUNCHXL_SPI0_MOSI,
            .misoPin            = CC2640R2_LAUNCHXL_SPI0_MISO,
            .clkPin             = CC2640R2_LAUNCHXL_SPI0_CLK,
            .csnPin             = CC2640R2_LAUNCHXL_SPI0_CSN,
            .minDmaTransferSize = 10
        },
        {
            .baseAddr           = SSI1_BASE,
            .intNum             = INT_SSI1_COMB,
            .intPriority        = ~0,
            .swiPriority        = 0,
            .powerMngrId        = PowerCC26XX_PERIPH_SSI1,
            .defaultTxBufValue  = 0xFF,
            .rxChannelBitMask   = 1<<UDMA_CHAN_SSI1_RX,
            .txChannelBitMask   = 1<<UDMA_CHAN_SSI1_TX,
            .mosiPin            = CC2640R2_LAUNCHXL_SPI1_MOSI,
            .misoPin            = CC2640R2_LAUNCHXL_SPI1_MISO,
            .clkPin             = CC2640R2_LAUNCHXL_SPI1_CLK,
            .csnPin             = CC2640R2_LAUNCHXL_SPI1_CSN,
            .minDmaTransferSize = 10
        }
    };
    
    const SPI_Config SPI_config[CC2640R2_LAUNCHXL_SPICOUNT] = {
        {
             .fxnTablePtr = &SPICC26XXDMA_fxnTable,
             .object      = &spiCC26XXDMAObjects[CC2640R2_LAUNCHXL_SPI0],
             .hwAttrs     = &spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPI0]
        },
        {
             .fxnTablePtr = &SPICC26XXDMA_fxnTable,
             .object      = &spiCC26XXDMAObjects[CC2640R2_LAUNCHXL_SPI1],
             .hwAttrs     = &spiCC26XXDMAHWAttrs[CC2640R2_LAUNCHXL_SPI1]
        },
    };
    
    const uint_least8_t SPI_count = CC2640R2_LAUNCHXL_SPICOUNT;
    
    /*
     *  =============================== UART ===============================
     */
    #include <ti/drivers/UART.h>
    #include <ti/drivers/uart/UARTCC26XX.h>
    
    UARTCC26XX_Object uartCC26XXObjects[CC2640R2_LAUNCHXL_UARTCOUNT];
    
    uint8_t uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UARTCOUNT][32];
    
    const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UARTCOUNT] = {
        {
            .baseAddr       = UART0_BASE,
            .powerMngrId    = PowerCC26XX_PERIPH_UART0,
            .intNum         = INT_UART0_COMB,
            .intPriority    = ~0,
            .swiPriority    = 0,
            .txPin          = CC2640R2_LAUNCHXL_UART_TX,
            .rxPin          = CC2640R2_LAUNCHXL_UART_RX,
            .ctsPin         = PIN_UNASSIGNED,
            .rtsPin         = PIN_UNASSIGNED,
            .ringBufPtr     = uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0],
            .ringBufSize    = sizeof(uartCC26XXRingBuffer[CC2640R2_LAUNCHXL_UART0]),
            .txIntFifoThr   = UARTCC26XX_FIFO_THRESHOLD_1_8,
            .rxIntFifoThr   = UARTCC26XX_FIFO_THRESHOLD_4_8,
            .errorFxn       = NULL
        }
    };
    
    const UART_Config UART_config[CC2640R2_LAUNCHXL_UARTCOUNT] = {
        {
            .fxnTablePtr = &UARTCC26XX_fxnTable,
            .object      = &uartCC26XXObjects[CC2640R2_LAUNCHXL_UART0],
            .hwAttrs     = &uartCC26XXHWAttrs[CC2640R2_LAUNCHXL_UART0]
        },
    };
    
    const uint_least8_t UART_count = CC2640R2_LAUNCHXL_UARTCOUNT;
    
    /*
     *  =============================== UDMA ===============================
     */
    #include <ti/drivers/dma/UDMACC26XX.h>
    
    UDMACC26XX_Object udmaObjects[CC2640R2_LAUNCHXL_UDMACOUNT];
    
    const UDMACC26XX_HWAttrs udmaHWAttrs[CC2640R2_LAUNCHXL_UDMACOUNT] = {
        {
            .baseAddr    = UDMA0_BASE,
            .powerMngrId = PowerCC26XX_PERIPH_UDMA,
            .intNum      = INT_DMA_ERR,
            .intPriority = ~0
        }
    };
    
    const UDMACC26XX_Config UDMACC26XX_config[CC2640R2_LAUNCHXL_UDMACOUNT] = {
        {
             .object  = &udmaObjects[CC2640R2_LAUNCHXL_UDMA0],
             .hwAttrs = &udmaHWAttrs[CC2640R2_LAUNCHXL_UDMA0]
        },
    };
    
    
    
    /*
     *  =============================== Watchdog ===============================
     */
    #include <ti/drivers/Watchdog.h>
    #include <ti/drivers/watchdog/WatchdogCC26XX.h>
    
    WatchdogCC26XX_Object watchdogCC26XXObjects[CC2640R2_LAUNCHXL_WATCHDOGCOUNT];
    
    const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2640R2_LAUNCHXL_WATCHDOGCOUNT] = {
        {
            .baseAddr    = WDT_BASE,
            .reloadValue = 1000 /* Reload value in milliseconds */
        },
    };
    
    const Watchdog_Config Watchdog_config[CC2640R2_LAUNCHXL_WATCHDOGCOUNT] = {
        {
            .fxnTablePtr = &WatchdogCC26XX_fxnTable,
            .object      = &watchdogCC26XXObjects[CC2640R2_LAUNCHXL_WATCHDOG0],
            .hwAttrs     = &watchdogCC26XXHWAttrs[CC2640R2_LAUNCHXL_WATCHDOG0]
        },
    };
    
    const uint_least8_t Watchdog_count = CC2640R2_LAUNCHXL_WATCHDOGCOUNT;
    
    /*
     *  Board-specific initialization function to disable external flash.
     *  This function is defined in the file CC2640R2_LAUNCHXL_fxns.c
     */
    extern void Board_initHook(void);
    
    /*
     *  ======== CC2640R2_LAUNCHXL_initGeneral ========
     */
    void CC2640R2_LAUNCHXL_initGeneral(void)
    {
        Power_init();
    
        if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
            /* Error with PIN_init */
            while (1);
        }
    
        /* Perform board-specific initialization */
        Board_initHook();
    }
    
    /*
     *  ======== Board_init ========
     */
    void Board_init(void)
    {
        CC2640R2_LAUNCHXL_initGeneral();
    }
    

    CC2640R2_LAUNCHXL.h:

    /*
     * Copyright (c) 2016-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    /** ============================================================================
     *  @file       CC2640R2_LAUNCHXL.h
     *
     *  @brief      CC2640R2 LaunchPad Board Specific header file.
     *
     *  This file is responsible for setting up the board specific items for the
     *  CC2640R2_LAUNCHXL board.
     *
     *  This board file is made for the 7x7 mm QFN package, to convert this board
     *  file to use for other smaller device packages(5x5 mm and 4x4 mm QFN), the
     *  board will need to be modified since all the IO pins are not available for
     *  smaller packages. Note that the 2.7 x 2.7 mm WCSP package should use a
     *  separate board file also included within the SDK.
     *
     *  Refer to the datasheet for all the package options and IO descriptions:
     *  http://www.ti.com/lit/ds/symlink/cc2640r2f.pdf
     *
     *  For example, to change to the 4x4 package, remove all defines for all IOs
     *  not available (IOID_10 and higher) since the 4x4 package
     *  has only 10 DIO pins as listed in the datasheet. Remove the modules/pins
     *  not used including ADC, Display, SPI1, LED, and PIN due to limited pins.
     *  ============================================================================
     */
    #ifndef __CC2640R2_LAUNCHXL_BOARD_H__
    #define __CC2640R2_LAUNCHXL_BOARD_H__
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* Includes */
    #include <ti/drivers/PIN.h>
    #include <ti/devices/cc26x0r2/driverlib/ioc.h>
    
    /* Externs */
    extern const PIN_Config BoardGpioInitTable[];
    
    /* Defines */
    #define CC2640R2_LAUNCHXL
    
    /* Mapping of pins to board signals using general board aliases
     *      <board signal alias>                  <pin mapping>
     */
    
    /* Analog Capable DIOs */
    #define CC2640R2_LAUNCHXL_DIO23_ANALOG          IOID_23
    #define CC2640R2_LAUNCHXL_DIO24_ANALOG          IOID_24
    #define CC2640R2_LAUNCHXL_DIO25_ANALOG          IOID_25
    #define CC2640R2_LAUNCHXL_DIO26_ANALOG          IOID_26
    #define CC2640R2_LAUNCHXL_DIO27_ANALOG          IOID_27
    #define CC2640R2_LAUNCHXL_DIO28_ANALOG          IOID_28
    #define CC2640R2_LAUNCHXL_DIO29_ANALOG          IOID_29
    #define CC2640R2_LAUNCHXL_DIO30_ANALOG          IOID_30
    
    /* Digital IOs */
    #define CC2640R2_LAUNCHXL_DIO0                  IOID_0
    #define CC2640R2_LAUNCHXL_DIO1_RFSW             IOID_1
    #define CC2640R2_LAUNCHXL_DIO12                 IOID_12
    #define CC2640R2_LAUNCHXL_DIO15                 IOID_15
    #define CC2640R2_LAUNCHXL_DIO16_TDO             IOID_16
    #define CC2640R2_LAUNCHXL_DIO17_TDI             IOID_17
    #define CC2640R2_LAUNCHXL_DIO21                 IOID_21
    #define CC2640R2_LAUNCHXL_DIO22                 IOID_22
    
    /* Discrete Inputs */
    #define CC2640R2_LAUNCHXL_PIN_BTN1              IOID_13
    #define CC2640R2_LAUNCHXL_PIN_BTN2              IOID_14
    
    /* GPIO */
    #define CC2640R2_LAUNCHXL_GPIO_LED_ON           1
    #define CC2640R2_LAUNCHXL_GPIO_LED_OFF          0
    
    /* I2C */
    #define CC2640R2_LAUNCHXL_I2C0_SCL0             IOID_4
    #define CC2640R2_LAUNCHXL_I2C0_SDA0             IOID_5
    
    /* I2S */
    #define CC2640R2_LAUNCHXL_I2S_ADO               IOID_0
    #define CC2640R2_LAUNCHXL_I2S_ADI               IOID_1
    #define CC2640R2_LAUNCHXL_I2S_BCLK              IOID_30
    #define CC2640R2_LAUNCHXL_I2S_MCLK              PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_I2S_WCLK              IOID_29
    
    /* LEDs */
    #define CC2640R2_LAUNCHXL_PIN_LED_ON            1
    #define CC2640R2_LAUNCHXL_PIN_LED_OFF           0
    #define CC2640R2_LAUNCHXL_PIN_RLED              IOID_6
    #define CC2640R2_LAUNCHXL_PIN_GLED              IOID_7
    
    /* PWM Outputs */
    #define CC2640R2_LAUNCHXL_PWMPIN0               CC2640R2_LAUNCHXL_PIN_RLED
    #define CC2640R2_LAUNCHXL_PWMPIN1               CC2640R2_LAUNCHXL_PIN_GLED
    #define CC2640R2_LAUNCHXL_PWMPIN2               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN3               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN4               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN5               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN6               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN7               PIN_UNASSIGNED
    
    /* SPI */
    #define CC2640R2_LAUNCHXL_SPI_FLASH_CS          IOID_20
    #define CC2640R2_LAUNCHXL_FLASH_CS_ON           0
    #define CC2640R2_LAUNCHXL_FLASH_CS_OFF          1
    
    /* SPI Board */
    #define CC2640R2_LAUNCHXL_SPI0_MISO             IOID_8          /* RF1.20 */
    #define CC2640R2_LAUNCHXL_SPI0_MOSI             IOID_9          /* RF1.18 */
    #define CC2640R2_LAUNCHXL_SPI0_CLK              IOID_10         /* RF1.16 */
    #define CC2640R2_LAUNCHXL_SPI0_CSN              IOID_11
    #define CC2640R2_LAUNCHXL_SPI1_MISO             PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_SPI1_MOSI             PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_SPI1_CLK              PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_SPI1_CSN              PIN_UNASSIGNED
    
    /* UART Board */
    #define CC2640R2_LAUNCHXL_UART_RX               IOID_2          /* RXD */
    #define CC2640R2_LAUNCHXL_UART_TX               IOID_3          /* TXD */
    #define CC2640R2_LAUNCHXL_UART_CTS              IOID_19         /* CTS */
    #define CC2640R2_LAUNCHXL_UART_RTS              IOID_18         /* RTS */
    
    /*!
     *  @brief  Initialize the general board specific settings
     *
     *  This function initializes the general board specific settings.
     */
    void CC2640R2_LAUNCHXL_initGeneral(void);
    
    /*!
     *  @brief  Turn off the external flash on LaunchPads
     *
     */
    void CC2640R2_LAUNCHXL_shutDownExtFlash(void);
    
    /*!
     *  @brief  Wake up the external flash present on the board files
     *
     *  This function toggles the chip select for the amount of time needed
     *  to wake the chip up.
     */
    void CC2640R2_LAUNCHXL_wakeUpExtFlash(void);
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_ADCBufName
     *  @brief  Enum of ADCs
     */
    typedef enum CC2640R2_LAUNCHXL_ADCBufName {
        CC2640R2_LAUNCHXL_ADCBUF0 = 0,
    
        CC2640R2_LAUNCHXL_ADCBUFCOUNT
    } CC2640R2_LAUNCHXL_ADCBufName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_ADCBuf0SourceName
     *  @brief  Enum of ADCBuf channels
     */
    typedef enum CC2640R2_LAUNCHXL_ADCBuf0ChannelName {
        /*CC2640R2_LAUNCHXL_ADCBUF0CHANNEL0 = 0,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL1,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL2,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL3,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL4,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL5,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL6,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNEL7,*/
        CC2640R2_LAUNCHXL_ADCBUF0CHANNELVDDS=0,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNELDCOUPL,
        CC2640R2_LAUNCHXL_ADCBUF0CHANNELVSS,
    
        CC2640R2_LAUNCHXL_ADCBUF0CHANNELCOUNT
    } CC2640R2_LAUNCHXL_ADCBuf0ChannelName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_ADCName
     *  @brief  Enum of ADCs
     */
    typedef enum CC2640R2_LAUNCHXL_ADCName {
        /*CC2640R2_LAUNCHXL_ADC0 = 0,
        CC2640R2_LAUNCHXL_ADC1,
        CC2640R2_LAUNCHXL_ADC2,
        CC2640R2_LAUNCHXL_ADC3,
        CC2640R2_LAUNCHXL_ADC4,
        CC2640R2_LAUNCHXL_ADC5,
        CC2640R2_LAUNCHXL_ADC6,
        CC2640R2_LAUNCHXL_ADC7,*/
        CC2640R2_LAUNCHXL_ADCDCOUPL=0,
        CC2640R2_LAUNCHXL_ADCVSS,
        CC2640R2_LAUNCHXL_ADCVDDS,
    
        CC2640R2_LAUNCHXL_ADCCOUNT
    } CC2640R2_LAUNCHXL_ADCName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_CryptoName
     *  @brief  Enum of Crypto names
     */
    typedef enum CC2640R2_LAUNCHXL_CryptoName {
        CC2640R2_LAUNCHXL_CRYPTO0 = 0,
    
        CC2640R2_LAUNCHXL_CRYPTOCOUNT
    } CC2640R2_LAUNCHXL_CryptoName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCCMName
     *  @brief  Enum of AESCCM names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCCMName {
        CC2640R2_LAUNCHXL_AESCCM0 = 0,
    
        CC2640R2_LAUNCHXL_AESCCMCOUNT
    } CC2640R2_LAUNCHXL_AESCCMName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESGCMName
     *  @brief  Enum of AESGCM names
     */
    typedef enum CC2640R2_LAUNCHXL_AESGCMName {
        CC2640R2_LAUNCHXL_AESGCM0 = 0,
    
        CC2640R2_LAUNCHXL_AESGCMCOUNT
    } CC2640R2_LAUNCHXL_AESGCMName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCBCName
     *  @brief  Enum of AESCBC names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCBCName {
        CC2640R2_LAUNCHXL_AESCBC0 = 0,
    
        CC2640R2_LAUNCHXL_AESCBCCOUNT
    } CC2640R2_LAUNCHXL_AESCBCName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCTRName
     *  @brief  Enum of AESCTR names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCTRName {
        CC2640R2_LAUNCHXL_AESCTR0 = 0,
    
        CC2640R2_LAUNCHXL_AESCTRCOUNT
    } CC2640R2_LAUNCHXL_AESCTRName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESECBName
     *  @brief  Enum of AESECB names
     */
    typedef enum CC2640R2_LAUNCHXL_AESECBName {
        CC2640R2_LAUNCHXL_AESECB0 = 0,
    
        CC2640R2_LAUNCHXL_AESECBCOUNT
    } CC2640R2_LAUNCHXL_AESECBName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCTRDRBGName
     *  @brief  Enum of AESCTRDRBG names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCTRDRBGName {
        CC2640R2_LAUNCHXL_AESCTRDRBG0 = 0,
    
        CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT
    } CC2640R2_LAUNCHXL_AESCTRDRBGName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_TRNGName
     *  @brief  Enum of TRNG names
     */
    typedef enum CC2640R2_LAUNCHXL_TRNGName {
        CC2640R2_LAUNCHXL_TRNG0 = 0,
    
        CC2640R2_LAUNCHXL_TRNGCOUNT
    } CC2640R2_LAUNCHXL_TRNGName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPIOName
     *  @brief  Enum of GPIO names
     */
    typedef enum CC2640R2_LAUNCHXL_GPIOName {
        CC2640R2_LAUNCHXL_GPIO_S1 = 0,
        CC2640R2_LAUNCHXL_GPIO_S2,
        CC2640R2_LAUNCHXL_SPI_MASTER_READY,
        CC2640R2_LAUNCHXL_SPI_SLAVE_READY,
        CC2640R2_LAUNCHXL_GPIO_LED_GREEN,
        CC2640R2_LAUNCHXL_GPIO_LED_RED,
        CC2640R2_LAUNCHXL_GPIO_TMP116_EN,
        CC2640R2_LAUNCHXL_GPIO_SPI_FLASH_CS,
        CC2640R2_LAUNCHXL_SDSPI_CS,
        CC2640R2_LAUNCHXL_GPIO_LCD_CS,
        CC2640R2_LAUNCHXL_GPIO_LCD_POWER,
        CC2640R2_LAUNCHXL_GPIO_LCD_ENABLE,
        CC2640R2_LAUNCHXL_GPIOCOUNT
    } CC2640R2_LAUNCHXL_GPIOName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPTimerName
     *  @brief  Enum of GPTimer parts
     */
    typedef enum CC2640R2_LAUNCHXL_GPTimerName {
        CC2640R2_LAUNCHXL_GPTIMER0A = 0,
        CC2640R2_LAUNCHXL_GPTIMER0B,
        CC2640R2_LAUNCHXL_GPTIMER1A,
        CC2640R2_LAUNCHXL_GPTIMER1B,
        CC2640R2_LAUNCHXL_GPTIMER2A,
        CC2640R2_LAUNCHXL_GPTIMER2B,
        CC2640R2_LAUNCHXL_GPTIMER3A,
        CC2640R2_LAUNCHXL_GPTIMER3B,
    
        CC2640R2_LAUNCHXL_GPTIMERPARTSCOUNT
    } CC2640R2_LAUNCHXL_GPTimerName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPTimers
     *  @brief  Enum of GPTimers
     */
    typedef enum CC2640R2_LAUNCHXL_GPTimers {
        CC2640R2_LAUNCHXL_GPTIMER0 = 0,
        CC2640R2_LAUNCHXL_GPTIMER1,
        CC2640R2_LAUNCHXL_GPTIMER2,
        CC2640R2_LAUNCHXL_GPTIMER3,
    
        CC2640R2_LAUNCHXL_GPTIMERCOUNT
    } CC2640R2_LAUNCHXL_GPTimers;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_I2CName
     *  @brief  Enum of I2C names
     */
    typedef enum CC2640R2_LAUNCHXL_I2CName {
        CC2640R2_LAUNCHXL_I2C0 = 0,
    
        CC2640R2_LAUNCHXL_I2CCOUNT
    } CC2640R2_LAUNCHXL_I2CName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_I2SName
     *  @brief  Enum of I2S names
     */
    typedef enum CC2640R2_LAUNCHXL_I2SName {
        CC2640R2_LAUNCHXL_I2S0 = 0,
    
        CC2640R2_LAUNCHXL_I2SCOUNT
    } CC2640R2_LAUNCHXL_I2SName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_NVSName
     *  @brief  Enum of NVS names
     */
    typedef enum CC2640R2_LAUNCHXL_NVSName {
    #ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
        CC2640R2_LAUNCHXL_NVSCC26XX0 = 0,
    #endif
    #ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
        CC2640R2_LAUNCHXL_NVSSPI25X0,
    #endif
    
        CC2640R2_LAUNCHXL_NVSCOUNT
    } CC2640R2_LAUNCHXL_NVSName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_PWM
     *  @brief  Enum of PWM outputs
     */
    typedef enum CC2640R2_LAUNCHXL_PWMName {
        CC2640R2_LAUNCHXL_PWM0 = 0,
        CC2640R2_LAUNCHXL_PWM1,
        CC2640R2_LAUNCHXL_PWM2,
        CC2640R2_LAUNCHXL_PWM3,
        CC2640R2_LAUNCHXL_PWM4,
        CC2640R2_LAUNCHXL_PWM5,
        CC2640R2_LAUNCHXL_PWM6,
        CC2640R2_LAUNCHXL_PWM7,
    
        CC2640R2_LAUNCHXL_PWMCOUNT
    } CC2640R2_LAUNCHXL_PWMName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_SDName
     *  @brief  Enum of SD names
     */
    typedef enum CC2640R2_LAUNCHXL_SDName {
        CC2640R2_LAUNCHXL_SDSPI0 = 0,
    
        CC2640R2_LAUNCHXL_SDCOUNT
    } CC2640R2_LAUNCHXL_SDName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_SPIName
     *  @brief  Enum of SPI names
     */
    typedef enum CC2640R2_LAUNCHXL_SPIName {
        CC2640R2_LAUNCHXL_SPI0 = 0,
        CC2640R2_LAUNCHXL_SPI1,
    
        CC2640R2_LAUNCHXL_SPICOUNT
    } CC2640R2_LAUNCHXL_SPIName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_UARTName
     *  @brief  Enum of UARTs
     */
    typedef enum CC2640R2_LAUNCHXL_UARTName {
        CC2640R2_LAUNCHXL_UART0 = 0,
    
        CC2640R2_LAUNCHXL_UARTCOUNT
    } CC2640R2_LAUNCHXL_UARTName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_UDMAName
     *  @brief  Enum of DMA buffers
     */
    typedef enum CC2640R2_LAUNCHXL_UDMAName {
        CC2640R2_LAUNCHXL_UDMA0 = 0,
    
        CC2640R2_LAUNCHXL_UDMACOUNT
    } CC2640R2_LAUNCHXL_UDMAName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_WatchdogName
     *  @brief  Enum of Watchdogs
     */
    typedef enum CC2640R2_LAUNCHXL_WatchdogName {
        CC2640R2_LAUNCHXL_WATCHDOG0 = 0,
    
        CC2640R2_LAUNCHXL_WATCHDOGCOUNT
    } CC2640R2_LAUNCHXL_WatchdogName;
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __CC2640R2_LAUNCHXL_BOARD_H__ */
    


    I uncommented the general ADC pins. Still everything crashes when I enter the line " GPIO_write(PIN_SEG11, true);" - When I replace the "true" by "false" everything works fine though. Can you recommend me an article on the pin definitions maybe? Still got some problems with that as my prior experiences were only with Arduino.
    Also, is there a way of getting further information on what error occured right there?

    best wishes,
    Nico

  • I still recommend adding those digital pins to the GPIO tables.  Perhaps you could start with fewer pins or a default example and try to get it working from there to reduce the number of dependencies, or use the debugger to further determine register states and call stack during device failure.

    Regards,
    Ryan

  • Ok, thanks! I'll work through this article here later: http://software-dl.ti.com/lprf/simplelink_cc2640r2_sdk/1.00.00.22/exports/docs/tidrivers/doxygen/html/_g_p_i_o_8h.html
    and hope it will give me some insights. Thanks a lot for your help until here! I'll update this place as soon as something's happening (:

    best wishes,
    Nico

  • Hey Ryan! Thanks a lot for your tip, that was some very good help! After I also removed some bits from the configuration file controlling external flash, I2S, ADC and other periphery stuff I was able to get nearly all pins working. The only ones I'm missing now are IOID_1 (alias RFSW? What does that mean?), 6, 19, 20, 22 and 23. Pin 1 has a signal on it, and the other pins stay either HIGH or LOW.

    Below are some of my (configuration )files...

    Main file Pin initialization:

    #define PIN_COM0 IOID_0
    #define PIN_COM1 IOID_1
    #define PIN_COM2 IOID_2
    #define PIN_COM3 IOID_3
    
    #define PIN_SEG0 IOID_4
    #define PIN_SEG1 IOID_5
    #define PIN_SEG2 IOID_6
    #define PIN_SEG3 IOID_11
    #define PIN_SEG4 IOID_12
    #define PIN_SEG5 IOID_15
    #define PIN_SEG6 IOID_18
    #define PIN_SEG7 IOID_19
    #define PIN_SEG8 IOID_20
    #define PIN_SEG9 IOID_21
    #define PIN_SEG10 IOID_22
    #define PIN_SEG11 IOID_23
    #define PIN_SEG12 IOID_24
    #define PIN_SEG13 IOID_25
    #define PIN_SEG14 IOID_26
    #define PIN_SEG15 IOID_27
    #define PIN_SEG16 IOID_28
    #define PIN_SEG17 IOID_29
    #define PIN_SEG18 IOID_30
    #define PIN_SEG19 IOID_7
    
    #define PIN_PWM IOID_9
    #define PIN_PWM_N IOID_10
    
    //main Thread
    GPIO_init();
    
        GPIO_setConfig(PIN_PWM, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_PWM_N, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        GPIO_setConfig(PIN_COM0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_COM1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_COM2, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_COM3, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    
        GPIO_setConfig(PIN_SEG0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG2, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG3, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG4, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG5, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG6, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG7, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG8, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG9, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG10, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG11, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG12, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG13, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG14, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG15, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG16, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG17, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG18, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        GPIO_setConfig(PIN_SEG19, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
        
        GPIO_write(PIN_PWM, true);
        GPIO_write(PIN_PWM_N, true);
    
        GPIO_write(PIN_COM0, true);
        GPIO_write(PIN_COM1, true);
        GPIO_write(PIN_COM2, true);
        GPIO_write(PIN_COM3, true);
    
        GPIO_write(PIN_SEG0, true);
        GPIO_write(PIN_SEG1, true);
        GPIO_write(PIN_SEG2, true);
        GPIO_write(PIN_SEG3, true);
        GPIO_write(PIN_SEG4, true);
        GPIO_write(PIN_SEG5, true);
        GPIO_write(PIN_SEG6, true);
        GPIO_write(PIN_SEG7, true);
        GPIO_write(PIN_SEG8, true);
        GPIO_write(PIN_SEG9, true);
        GPIO_write(PIN_SEG10, true);
        GPIO_write(PIN_SEG11, true);
        GPIO_write(PIN_SEG12, true);
        GPIO_write(PIN_SEG13, true);
        GPIO_write(PIN_SEG14, true);
        GPIO_write(PIN_SEG15, true);
        GPIO_write(PIN_SEG16, true);
        GPIO_write(PIN_SEG17, true);
        GPIO_write(PIN_SEG18, true);
        GPIO_write(PIN_SEG19, true);
        
        
    //some other stuff afterwards, like initializing interrupts on 2 other pins not used in the above list
    
    while (1) {
            //sleep(time);
            //GPIO_toggle(Board_GPIO_LED0);
            //PWM_setDuty(pwm1, duty);
    
            //PWM_setDuty(pwm2, duty);
    
            GPIO_toggle(PIN_PWM);
            GPIO_toggle(PIN_PWM_N);
            GPIO_toggle(PIN_COM0);
            GPIO_toggle(PIN_COM1);
            GPIO_toggle(PIN_COM2);
            GPIO_toggle(PIN_COM3);
            GPIO_toggle(PIN_SEG0);
            GPIO_toggle(PIN_SEG1);
            GPIO_toggle(PIN_SEG2);
            GPIO_toggle(PIN_SEG3);
            GPIO_toggle(PIN_SEG4);
            GPIO_toggle(PIN_SEG5);
            GPIO_toggle(PIN_SEG6);
            GPIO_toggle(PIN_SEG7);
            GPIO_toggle(PIN_SEG8);
            GPIO_toggle(PIN_SEG9);
            GPIO_toggle(PIN_SEG10);
            GPIO_toggle(PIN_SEG11);
            GPIO_toggle(PIN_SEG12);
            GPIO_toggle(PIN_SEG13);
            GPIO_toggle(PIN_SEG14);
            GPIO_toggle(PIN_SEG15);
            GPIO_toggle(PIN_SEG16);
            GPIO_toggle(PIN_SEG17);
            GPIO_toggle(PIN_SEG18);
            GPIO_toggle(PIN_SEG19);
    
            usleep(300);
        }



    CC2640R2_LAUNCHXL.c 
    /*
     * Copyright (c) 2016-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     *  ====================== CC2640R2_LAUNCHXL.c ===================================
     *  This file is responsible for setting up the board specific items for the
     *  CC2640R2_LAUNCHXL board.
     */
    
    /*---PIN DEFINITIONS---*/
    #define PIN_COM0 IOID_0
    #define PIN_COM1 IOID_1
    #define PIN_COM2 IOID_2
    #define PIN_COM3 IOID_3
    
    #define PIN_SEG0 IOID_4
    #define PIN_SEG1 IOID_5
    #define PIN_SEG2 IOID_6
    #define PIN_SEG3 IOID_11
    #define PIN_SEG4 IOID_12
    #define PIN_SEG5 IOID_15
    #define PIN_SEG6 IOID_18
    #define PIN_SEG7 IOID_19
    #define PIN_SEG8 IOID_20
    #define PIN_SEG9 IOID_21
    #define PIN_SEG10 IOID_22
    #define PIN_SEG11 IOID_23
    #define PIN_SEG12 IOID_24
    #define PIN_SEG13 IOID_25
    #define PIN_SEG14 IOID_26
    #define PIN_SEG15 IOID_27
    #define PIN_SEG16 IOID_28
    #define PIN_SEG17 IOID_29
    #define PIN_SEG18 IOID_30
    #define PIN_SEG19 IOID_7
    
    #define PIN_PWM IOID_9
    #define PIN_PWM_N IOID_10
    
    #include <stdbool.h>
    #include <stddef.h>
    #include <stdint.h>
    
    #include <ti/devices/cc26x0r2/driverlib/ioc.h>
    #include <ti/devices/cc26x0r2/driverlib/udma.h>
    #include <ti/devices/cc26x0r2/inc/hw_ints.h>
    #include <ti/devices/cc26x0r2/inc/hw_memmap.h>
    
    #include "CC2640R2_LAUNCHXL.h"
    
    /*
     *  =============================== Crypto ===============================
     */
    #include <ti/drivers/crypto/CryptoCC26XX.h>
    
    CryptoCC26XX_Object cryptoCC26XXObjects[CC2640R2_LAUNCHXL_CRYPTOCOUNT];
    
    /*const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2640R2_LAUNCHXL_CRYPTOCOUNT] = {
        {
            .baseAddr       = CRYPTO_BASE,
            .powerMngrId    = PowerCC26XX_PERIPH_CRYPTO,
            .intNum         = INT_CRYPTO_RESULT_AVAIL_IRQ,
            .intPriority    = ~0,
        }
    };
    
    const CryptoCC26XX_Config CryptoCC26XX_config[CC2640R2_LAUNCHXL_CRYPTOCOUNT] = {
        {
             .object  = &cryptoCC26XXObjects[CC2640R2_LAUNCHXL_CRYPTO0],
             .hwAttrs = &cryptoCC26XXHWAttrs[CC2640R2_LAUNCHXL_CRYPTO0]
        },
    };
    */
    /*
     *  =============================== AESCCM ===============================
     */
    #include <ti/drivers/AESCCM.h>
    #include <ti/drivers/aesccm/AESCCMCC26XX.h>
    
    AESCCMCC26XX_Object aesccmCC26XXObjects[CC2640R2_LAUNCHXL_AESCCMCOUNT];
    
    const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCCMCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCCM_Config AESCCM_config[CC2640R2_LAUNCHXL_AESCCMCOUNT] = {
        {
             .object  = &aesccmCC26XXObjects[CC2640R2_LAUNCHXL_AESCCM0],
             .hwAttrs = &aesccmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCCM0]
        },
    };
    
    const uint_least8_t AESCCM_count = CC2640R2_LAUNCHXL_AESCCMCOUNT;
    
    
    /*
     *  =============================== AESGCM ===============================
     */
    #include <ti/drivers/AESGCM.h>
    #include <ti/drivers/aesgcm/AESGCMCC26XX.h>
    
    AESGCMCC26XX_Object aesgcmCC26XXObjects[CC2640R2_LAUNCHXL_AESGCMCOUNT];
    
    const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESGCMCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESGCM_Config AESGCM_config[CC2640R2_LAUNCHXL_AESGCMCOUNT] = {
        {
             .object  = &aesgcmCC26XXObjects[CC2640R2_LAUNCHXL_AESGCM0],
             .hwAttrs = &aesgcmCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESGCM0]
        },
    };
    
    const uint_least8_t AESGCM_count = CC2640R2_LAUNCHXL_AESGCMCOUNT;
    
    /*
     *  =============================== AESCBC ===============================
     */
    #include <ti/drivers/AESCBC.h>
    #include <ti/drivers/aescbc/AESCBCCC26XX.h>
    
    AESCBCCC26XX_Object aescbcCC26XXObjects[CC2640R2_LAUNCHXL_AESCBCCOUNT];
    
    const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCBCCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCBC_Config AESCBC_config[CC2640R2_LAUNCHXL_AESCBCCOUNT] = {
        {
             .object  = &aescbcCC26XXObjects[CC2640R2_LAUNCHXL_AESCBC0],
             .hwAttrs = &aescbcCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCBC0]
        },
    };
    
    const uint_least8_t AESCBC_count = CC2640R2_LAUNCHXL_AESCBCCOUNT;
    
    /*
     *  =============================== AESCTR ===============================
     */
    #include <ti/drivers/AESCTR.h>
    #include <ti/drivers/aesctr/AESCTRCC26XX.h>
    
    AESCTRCC26XX_Object aesctrCC26XXObjects[CC2640R2_LAUNCHXL_AESCTRCOUNT];
    
    const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCTRCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESCTR_Config AESCTR_config[CC2640R2_LAUNCHXL_AESCTRCOUNT] = {
        {
             .object  = &aesctrCC26XXObjects[CC2640R2_LAUNCHXL_AESCTR0],
             .hwAttrs = &aesctrCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESCTR0]
        },
    };
    
    const uint_least8_t AESCTR_count = CC2640R2_LAUNCHXL_AESCTRCOUNT;
    
    /*
     *  =============================== AESECB ===============================
     */
    #include <ti/drivers/AESECB.h>
    #include <ti/drivers/aesecb/AESECBCC26XX.h>
    
    AESECBCC26XX_Object aesecbCC26XXObjects[CC2640R2_LAUNCHXL_AESECBCOUNT];
    
    const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESECBCOUNT] = {
        {
            .intPriority       = ~0,
        }
    };
    
    const AESECB_Config AESECB_config[CC2640R2_LAUNCHXL_AESECBCOUNT] = {
        {
             .object  = &aesecbCC26XXObjects[CC2640R2_LAUNCHXL_AESECB0],
             .hwAttrs = &aesecbCC26XXHWAttrs[CC2640R2_LAUNCHXL_AESECB0]
        },
    };
    
    const uint_least8_t AESECB_count = CC2640R2_LAUNCHXL_AESECBCOUNT;
    
    /*
     *  =============================== AESCTRDRBG ===============================
     */
    #include <ti/drivers/AESCTRDRBG.h>
    #include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
    
    AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT];
    
    const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT] = {
        {
            .aesctrIndex       = CC2640R2_LAUNCHXL_AESCTR0,
        }
    };
    
    const AESCTRDRBG_Config AESCTRDRBG_config[CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT] = {
        {
             .object  = &aesctrdrbgXXObjects[CC2640R2_LAUNCHXL_AESCTRDRBG0],
             .hwAttrs = &aesctrdrbgXXHWAttrs[CC2640R2_LAUNCHXL_AESCTRDRBG0]
        },
    };
    
    const uint_least8_t AESCTRDRBG_count = CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT;
    
    /*
     *  =============================== TRNG ===============================
     */
    #include <ti/drivers/TRNG.h>
    #include <ti/drivers/trng/TRNGCC26XX.h>
    
    TRNGCC26XX_Object trngCC26XXObjects[CC2640R2_LAUNCHXL_TRNGCOUNT];
    
    const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC2640R2_LAUNCHXL_TRNGCOUNT] = {
        {
            .intPriority       = ~0,
            .swiPriority       = 0,
            .samplesPerCycle   = 240000,
        }
    };
    
    const TRNG_Config TRNG_config[CC2640R2_LAUNCHXL_TRNGCOUNT] = {
        {
             .object  = &trngCC26XXObjects[CC2640R2_LAUNCHXL_TRNG0],
             .hwAttrs = &trngCC26X2HWAttrs[CC2640R2_LAUNCHXL_TRNG0]
        },
    };
    
    const uint_least8_t TRNG_count = CC2640R2_LAUNCHXL_TRNGCOUNT;
    
    
    /*
     *  =============================== GPIO ===============================
     */
    #include <ti/drivers/GPIO.h>
    #include <ti/drivers/gpio/GPIOCC26XX.h>
    
    /*
     * Array of Pin configurations
     * NOTE: The order of the pin configurations must coincide with what was
     *       defined in CC2640R2_LAUNCHXL.h
     * NOTE: Pins not used for interrupts should be placed at the end of the
     *       array. Callback entries can be omitted from callbacks array to
     *       reduce memory usage.
     */
    
    GPIO_PinConfig gpioPinConfigs[] = {
        /* Input pins */
                                       PIN_PWM | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_PWM_N | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
    
                                       PIN_COM0 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_COM1 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_COM2 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_COM3 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
    
                                       PIN_SEG0 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG1 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG2 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG3 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG4 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG5 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG6 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG7 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG8 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG9 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG10 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG11 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG12 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG13 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG14 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG15 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG16 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG17 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG18 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_SEG19 | PIN_GPIO_OUTPUT_DIS | PIN_INPUT_DIS | PIN_PUSHPULL,
                                       PIN_TERMINATE
    };
    
    /*
     * Array of callback function pointers
     * NOTE: The order of the pin configurations must coincide with what was
     *       defined in CC2640R2_LAUNCH.h
     * NOTE: Pins not used for interrupts can be omitted from callbacks array to
     *       reduce memory usage (if placed at end of gpioPinConfigs array).
     */
    GPIO_CallbackFxn gpioCallbackFunctions[] = {
        NULL,  /* Button 0 */
        NULL,  /* Button 1 */
        NULL,  /* CC2640R2_LAUNCHXL_SPI_MASTER_READY */
        NULL,  /* CC2640R2_LAUNCHXL_SPI_SLAVE_READY */
    };
    
    const GPIOCC26XX_Config GPIOCC26XX_config = {
        .pinConfigs         = (GPIO_PinConfig *)gpioPinConfigs,
        .callbacks          = (GPIO_CallbackFxn *)gpioCallbackFunctions,
        .numberOfPinConfigs = CC2640R2_LAUNCHXL_GPIOCOUNT,
        .numberOfCallbacks  = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
        .intPriority        = (~0)
    };
    
    /*
     *  =============================== GPTimer ===============================
     *  Remove unused entries to reduce flash usage both in Board.c and Board.h
     */
    #include <ti/drivers/timer/GPTimerCC26XX.h>
    
    GPTimerCC26XX_Object gptimerCC26XXObjects[CC2640R2_LAUNCHXL_GPTIMERCOUNT];
    
    
    
    /*
     *  =============================== PIN ===============================
     */
    #include <ti/drivers/PIN.h>
    #include <ti/drivers/pin/PINCC26XX.h>
    
    const PIN_Config BoardGpioInitTable[] = {
    
        PIN_TERMINATE
    };
    
    const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
        .intPriority = ~0,
        .swiPriority = 0
    };
    
    /*
     *  =============================== Power ===============================
     */
    #include <ti/drivers/Power.h>
    #include <ti/drivers/power/PowerCC26XX.h>
    
    const PowerCC26XX_Config PowerCC26XX_config = {
        .policyInitFxn      = NULL,
        .policyFxn          = &PowerCC26XX_standbyPolicy,
        .calibrateFxn       = &PowerCC26XX_calibrate,
        .enablePolicy       = true,
        .calibrateRCOSC_LF  = true,
        .calibrateRCOSC_HF  = true,
    };
    
    
    /*
     *  =============================== RF Driver ===============================
     */
    #include <ti/drivers/rf/RF.h>
    
    const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
        .hwiPriority        = ~0,       /* Lowest HWI priority */
        .swiPriority        = 0,        /* Lowest SWI priority */
        .xoscHfAlwaysNeeded = true,     /* Keep XOSC dependency while in standby */
        .globalCallback     = NULL,     /* No board specific callback */
        .globalEventMask    = 0         /* No events subscribed to */
    };
    
    
    /*
     *  =============================== Watchdog ===============================
     */
    #include <ti/drivers/Watchdog.h>
    #include <ti/drivers/watchdog/WatchdogCC26XX.h>
    
    WatchdogCC26XX_Object watchdogCC26XXObjects[CC2640R2_LAUNCHXL_WATCHDOGCOUNT];
    
    const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2640R2_LAUNCHXL_WATCHDOGCOUNT] = {
        {
            .baseAddr    = WDT_BASE,
            .reloadValue = 1000 /* Reload value in milliseconds */
        },
    };
    
    const Watchdog_Config Watchdog_config[CC2640R2_LAUNCHXL_WATCHDOGCOUNT] = {
        {
            .fxnTablePtr = &WatchdogCC26XX_fxnTable,
            .object      = &watchdogCC26XXObjects[CC2640R2_LAUNCHXL_WATCHDOG0],
            .hwAttrs     = &watchdogCC26XXHWAttrs[CC2640R2_LAUNCHXL_WATCHDOG0]
        },
    };
    
    const uint_least8_t Watchdog_count = CC2640R2_LAUNCHXL_WATCHDOGCOUNT;
    
    /*
     *  Board-specific initialization function to disable external flash.
     *  This function is defined in the file CC2640R2_LAUNCHXL_fxns.c
     */
    extern void Board_initHook(void);
    
    /*
     *  ======== CC2640R2_LAUNCHXL_initGeneral ========
     */
    void CC2640R2_LAUNCHXL_initGeneral(void)
    {
        Power_init();
    
        if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
            /* Error with PIN_init */
            while (1);
        }
    
        /* Perform board-specific initialization */
        Board_initHook();
    }
    
    /*
     *  ======== Board_init ========
     */
    void Board_init(void)
    {
        CC2640R2_LAUNCHXL_initGeneral();
    }
    



    CC2640R2_LAUNCHXL.c 
    /*
     * Copyright (c) 2016-2019, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    /** ============================================================================
     *  @file       CC2640R2_LAUNCHXL.h
     *
     *  @brief      CC2640R2 LaunchPad Board Specific header file.
     *
     *  This file is responsible for setting up the board specific items for the
     *  CC2640R2_LAUNCHXL board.
     *
     *  This board file is made for the 7x7 mm QFN package, to convert this board
     *  file to use for other smaller device packages(5x5 mm and 4x4 mm QFN), the
     *  board will need to be modified since all the IO pins are not available for
     *  smaller packages. Note that the 2.7 x 2.7 mm WCSP package should use a
     *  separate board file also included within the SDK.
     *
     *  Refer to the datasheet for all the package options and IO descriptions:
     *  http://www.ti.com/lit/ds/symlink/cc2640r2f.pdf
     *
     *  For example, to change to the 4x4 package, remove all defines for all IOs
     *  not available (IOID_10 and higher) since the 4x4 package
     *  has only 10 DIO pins as listed in the datasheet. Remove the modules/pins
     *  not used including ADC, Display, SPI1, LED, and PIN due to limited pins.
     *  ============================================================================
     */
    #ifndef __CC2640R2_LAUNCHXL_BOARD_H__
    #define __CC2640R2_LAUNCHXL_BOARD_H__
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* Includes */
    #include <ti/drivers/PIN.h>
    #include <ti/devices/cc26x0r2/driverlib/ioc.h>
    
    /* Externs */
    extern const PIN_Config BoardGpioInitTable[];
    
    /* Defines */
    #define CC2640R2_LAUNCHXL
    
    /* Mapping of pins to board signals using general board aliases
     *      <board signal alias>                  <pin mapping>
     */
    
    /* Analog Capable DIOs */
    #define CC2640R2_LAUNCHXL_DIO23_ANALOG          IOID_23
    #define CC2640R2_LAUNCHXL_DIO24_ANALOG          IOID_24
    #define CC2640R2_LAUNCHXL_DIO25_ANALOG          IOID_25
    #define CC2640R2_LAUNCHXL_DIO26_ANALOG          IOID_26
    #define CC2640R2_LAUNCHXL_DIO27_ANALOG          IOID_27
    #define CC2640R2_LAUNCHXL_DIO28_ANALOG          IOID_28
    #define CC2640R2_LAUNCHXL_DIO29_ANALOG          IOID_29
    #define CC2640R2_LAUNCHXL_DIO30_ANALOG          IOID_30
    
    /* Digital IOs */
    #define CC2640R2_LAUNCHXL_DIO0                  IOID_0
    #define CC2640R2_LAUNCHXL_DIO1_RFSW             IOID_1
    #define CC2640R2_LAUNCHXL_DIO12                 IOID_12
    #define CC2640R2_LAUNCHXL_DIO15                 IOID_15
    #define CC2640R2_LAUNCHXL_DIO16_TDO             IOID_16
    #define CC2640R2_LAUNCHXL_DIO17_TDI             IOID_17
    #define CC2640R2_LAUNCHXL_DIO21                 IOID_21
    #define CC2640R2_LAUNCHXL_DIO22                 IOID_22
    
    /* Discrete Inputs */
    #define CC2640R2_LAUNCHXL_PIN_BTN1              IOID_13
    #define CC2640R2_LAUNCHXL_PIN_BTN2              IOID_14
    
    /* GPIO */
    #define CC2640R2_LAUNCHXL_GPIO_LED_ON           1
    #define CC2640R2_LAUNCHXL_GPIO_LED_OFF          0
    
    /* I2C */
    #define CC2640R2_LAUNCHXL_I2C0_SCL0             IOID_4
    #define CC2640R2_LAUNCHXL_I2C0_SDA0             IOID_5
    
    /* I2S */
    #define CC2640R2_LAUNCHXL_I2S_ADO               IOID_0
    #define CC2640R2_LAUNCHXL_I2S_ADI               IOID_1
    #define CC2640R2_LAUNCHXL_I2S_BCLK              IOID_30
    #define CC2640R2_LAUNCHXL_I2S_MCLK              PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_I2S_WCLK              IOID_29
    
    /* LEDs */
    #define CC2640R2_LAUNCHXL_PIN_LED_ON            1
    #define CC2640R2_LAUNCHXL_PIN_LED_OFF           0
    #define CC2640R2_LAUNCHXL_PIN_RLED              IOID_6
    #define CC2640R2_LAUNCHXL_PIN_GLED              IOID_7
    
    /* PWM Outputs */
    #define CC2640R2_LAUNCHXL_PWMPIN0               CC2640R2_LAUNCHXL_PIN_RLED
    #define CC2640R2_LAUNCHXL_PWMPIN1               CC2640R2_LAUNCHXL_PIN_GLED
    #define CC2640R2_LAUNCHXL_PWMPIN2               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN3               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN4               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN5               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN6               PIN_UNASSIGNED
    #define CC2640R2_LAUNCHXL_PWMPIN7               PIN_UNASSIGNED
    
    /*!
     *  @brief  Initialize the general board specific settings
     *
     *  This function initializes the general board specific settings.
     */
    void CC2640R2_LAUNCHXL_initGeneral(void);
    
    /*!
     *  @brief  Turn off the external flash on LaunchPads
     *
     */
    void CC2640R2_LAUNCHXL_shutDownExtFlash(void);
    
    /*!
     *  @brief  Wake up the external flash present on the board files
     *
     *  This function toggles the chip select for the amount of time needed
     *  to wake the chip up.
     */
    void CC2640R2_LAUNCHXL_wakeUpExtFlash(void);
    
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_CryptoName
     *  @brief  Enum of Crypto names
     */
    typedef enum CC2640R2_LAUNCHXL_CryptoName {
        CC2640R2_LAUNCHXL_CRYPTO0 = 0,
    
        CC2640R2_LAUNCHXL_CRYPTOCOUNT
    } CC2640R2_LAUNCHXL_CryptoName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCCMName
     *  @brief  Enum of AESCCM names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCCMName {
        CC2640R2_LAUNCHXL_AESCCM0 = 0,
    
        CC2640R2_LAUNCHXL_AESCCMCOUNT
    } CC2640R2_LAUNCHXL_AESCCMName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESGCMName
     *  @brief  Enum of AESGCM names
     */
    typedef enum CC2640R2_LAUNCHXL_AESGCMName {
        CC2640R2_LAUNCHXL_AESGCM0 = 0,
    
        CC2640R2_LAUNCHXL_AESGCMCOUNT
    } CC2640R2_LAUNCHXL_AESGCMName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCBCName
     *  @brief  Enum of AESCBC names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCBCName {
        CC2640R2_LAUNCHXL_AESCBC0 = 0,
    
        CC2640R2_LAUNCHXL_AESCBCCOUNT
    } CC2640R2_LAUNCHXL_AESCBCName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCTRName
     *  @brief  Enum of AESCTR names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCTRName {
        CC2640R2_LAUNCHXL_AESCTR0 = 0,
    
        CC2640R2_LAUNCHXL_AESCTRCOUNT
    } CC2640R2_LAUNCHXL_AESCTRName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESECBName
     *  @brief  Enum of AESECB names
     */
    typedef enum CC2640R2_LAUNCHXL_AESECBName {
        CC2640R2_LAUNCHXL_AESECB0 = 0,
    
        CC2640R2_LAUNCHXL_AESECBCOUNT
    } CC2640R2_LAUNCHXL_AESECBName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_AESCTRDRBGName
     *  @brief  Enum of AESCTRDRBG names
     */
    typedef enum CC2640R2_LAUNCHXL_AESCTRDRBGName {
        CC2640R2_LAUNCHXL_AESCTRDRBG0 = 0,
    
        CC2640R2_LAUNCHXL_AESCTRDRBGCOUNT
    } CC2640R2_LAUNCHXL_AESCTRDRBGName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_TRNGName
     *  @brief  Enum of TRNG names
     */
    typedef enum CC2640R2_LAUNCHXL_TRNGName {
        CC2640R2_LAUNCHXL_TRNG0 = 0,
    
        CC2640R2_LAUNCHXL_TRNGCOUNT
    } CC2640R2_LAUNCHXL_TRNGName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPIOName
     *  @brief  Enum of GPIO names
     */
    typedef enum CC2640R2_LAUNCHXL_GPIOName {
        CC2640R2_LAUNCHXL_GPIO_S1 = 0,
        CC2640R2_LAUNCHXL_GPIO_S2,
        CC2640R2_LAUNCHXL_SPI_MASTER_READY,
        CC2640R2_LAUNCHXL_SPI_SLAVE_READY,
        CC2640R2_LAUNCHXL_GPIO_LED_GREEN,
        CC2640R2_LAUNCHXL_GPIO_LED_RED,
        CC2640R2_LAUNCHXL_GPIO_TMP116_EN,
        CC2640R2_LAUNCHXL_GPIO_SPI_FLASH_CS,
        CC2640R2_LAUNCHXL_SDSPI_CS,
        CC2640R2_LAUNCHXL_GPIO_LCD_CS,
        CC2640R2_LAUNCHXL_GPIO_LCD_POWER,
        CC2640R2_LAUNCHXL_GPIO_LCD_ENABLE,
        CC2640R2_LAUNCHXL_GPIOCOUNT
    } CC2640R2_LAUNCHXL_GPIOName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPTimerName
     *  @brief  Enum of GPTimer parts
     */
    typedef enum CC2640R2_LAUNCHXL_GPTimerName {
        CC2640R2_LAUNCHXL_GPTIMER0A = 0,
        CC2640R2_LAUNCHXL_GPTIMER0B,
        CC2640R2_LAUNCHXL_GPTIMER1A,
        CC2640R2_LAUNCHXL_GPTIMER1B,
        CC2640R2_LAUNCHXL_GPTIMER2A,
        CC2640R2_LAUNCHXL_GPTIMER2B,
        CC2640R2_LAUNCHXL_GPTIMER3A,
        CC2640R2_LAUNCHXL_GPTIMER3B,
    
        CC2640R2_LAUNCHXL_GPTIMERPARTSCOUNT
    } CC2640R2_LAUNCHXL_GPTimerName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_GPTimers
     *  @brief  Enum of GPTimers
     */
    typedef enum CC2640R2_LAUNCHXL_GPTimers {
        CC2640R2_LAUNCHXL_GPTIMER0 = 0,
        CC2640R2_LAUNCHXL_GPTIMER1,
        CC2640R2_LAUNCHXL_GPTIMER2,
        CC2640R2_LAUNCHXL_GPTIMER3,
    
        CC2640R2_LAUNCHXL_GPTIMERCOUNT
    } CC2640R2_LAUNCHXL_GPTimers;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_I2CName
     *  @brief  Enum of I2C names
     */
    typedef enum CC2640R2_LAUNCHXL_I2CName {
        CC2640R2_LAUNCHXL_I2C0 = 0,
    
        CC2640R2_LAUNCHXL_I2CCOUNT
    } CC2640R2_LAUNCHXL_I2CName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_I2SName
     *  @brief  Enum of I2S names
     */
    typedef enum CC2640R2_LAUNCHXL_I2SName {
        CC2640R2_LAUNCHXL_I2S0 = 0,
    
        CC2640R2_LAUNCHXL_I2SCOUNT
    } CC2640R2_LAUNCHXL_I2SName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_NVSName
     *  @brief  Enum of NVS names
     */
    typedef enum CC2640R2_LAUNCHXL_NVSName {
    #ifndef Board_EXCLUDE_NVS_INTERNAL_FLASH
        CC2640R2_LAUNCHXL_NVSCC26XX0 = 0,
    #endif
    #ifndef Board_EXCLUDE_NVS_EXTERNAL_FLASH
        CC2640R2_LAUNCHXL_NVSSPI25X0,
    #endif
    
        CC2640R2_LAUNCHXL_NVSCOUNT
    } CC2640R2_LAUNCHXL_NVSName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_PWM
     *  @brief  Enum of PWM outputs
     */
    /*typedef enum CC2640R2_LAUNCHXL_PWMName {
        CC2640R2_LAUNCHXL_PWM0 = 0,
        CC2640R2_LAUNCHXL_PWM1,
        CC2640R2_LAUNCHXL_PWM2,
        CC2640R2_LAUNCHXL_PWM3,
        CC2640R2_LAUNCHXL_PWM4,
        CC2640R2_LAUNCHXL_PWM5,
        CC2640R2_LAUNCHXL_PWM6,
        CC2640R2_LAUNCHXL_PWM7,
    
        CC2640R2_LAUNCHXL_PWMCOUNT
    } CC2640R2_LAUNCHXL_PWMName;*/
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_SDName
     *  @brief  Enum of SD names
     */
    typedef enum CC2640R2_LAUNCHXL_SDName {
        CC2640R2_LAUNCHXL_SDSPI0 = 0,
    
        CC2640R2_LAUNCHXL_SDCOUNT
    } CC2640R2_LAUNCHXL_SDName;
    
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_UDMAName
     *  @brief  Enum of DMA buffers
     */
    typedef enum CC2640R2_LAUNCHXL_UDMAName {
        CC2640R2_LAUNCHXL_UDMA0 = 0,
    
        CC2640R2_LAUNCHXL_UDMACOUNT
    } CC2640R2_LAUNCHXL_UDMAName;
    
    /*!
     *  @def    CC2640R2_LAUNCHXL_WatchdogName
     *  @brief  Enum of Watchdogs
     */
    typedef enum CC2640R2_LAUNCHXL_WatchdogName {
        CC2640R2_LAUNCHXL_WATCHDOG0 = 0,
    
        CC2640R2_LAUNCHXL_WATCHDOGCOUNT
    } CC2640R2_LAUNCHXL_WatchdogName;
    
    #ifdef __cplusplus
    }
    #endif
    
    #endif /* __CC2640R2_LAUNCHXL_BOARD_H__ */
    


    I removed some stuff not needed in the .h also, but as it seems it's mostly just definitions for Pin names.
    Maybe it's better if I move all the GPIO configuration from GPIO_PinConfig gpioPinConfigs[] to PIN_Config BoardGpioInitTable[]?

  • BoardGpioInitTable may not be as important as mapping gpioPinConfigs to CC2640R2_LAUNCHXL_GPIOName, see this E2E thread for more details.  E2E search for relevant threads: https://e2e.ti.com/search?q=CC2640R2_LAUNCHXL_GPIOName&category=forum 

    Regards,
    Ryan

  • Hello Ryan, that was the point, thanks so much! I thought I could address any pin at any time with the corresponding IOID_x handle. But actually it seems to work this way, if I understand it correctly:
    1.) you make a list of CC2640R2_LAUNCHXL_GPIONames.
    2.) in the same order, you insert the corresponding IOID_x (or GPIOCC26XX_DIO_x) - this configures the pins, and they get an INTERNAL ID corresponding to the CC2640R2_LAUNCHXL_GPIOName enumeration, beginning with 0.
    3.) you can control the pins now using this ID. 
    Hence I changed the #defines in the first lines to the corresponding id from the GPIOName enum, and replaced the PIN_SEGy values in the gpioPinConfigs[] with just the IOID_x pin number. And now it works, I can control every single GPIO pin that I need. 
    Have a great day and thanks a lot again for helping me out here! (:

    best wishes,
    Nico