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.

CC1310: CC1310_LAUNCHXL_GPIOName与IOID的定义的区别

Part Number: CC1310
Other Parts Discussed in Thread: TMP116

typedef enum CC1310_LAUNCHXL_GPIOName {
CC1310_LAUNCHXL_GPIO_S1 = 0,
CC1310_LAUNCHXL_GPIO_S2,
CC1310_LAUNCHXL_SPI_MASTER_READY,
CC1310_LAUNCHXL_SPI_SLAVE_READY,
CC1310_LAUNCHXL_GPIO_LED_GREEN,
CC1310_LAUNCHXL_GPIO_LED_RED,
CC1310_LAUNCHXL_GPIO_TMP116_EN,
CC1310_LAUNCHXL_GPIO_SPI_FLASH_CS,
CC1310_LAUNCHXL_SDSPI_CS,
CC1310_LAUNCHXL_GPIO_LCD_CS,
CC1310_LAUNCHXL_GPIO_LCD_POWER,
CC1310_LAUNCHXL_GPIO_LCD_ENABLE,
CC1310_LAUNCHXL_GPIOCOUNT
} CC1310_LAUNCHXL_GPIOName;

/* Discrete Inputs */
#define CC1310_LAUNCHXL_PIN_BTN1 IOID_13
#define CC1310_LAUNCHXL_PIN_BTN2 IOID_14

区别是啥,我直接用IOID的定义方式去设置Output可以正常工作,但是设置为input后就触发不了,原因未知

  • 关系是枚举中的引脚配置顺序必须与CC1310_LAUNCHXL.c 中的GPIO配置数组保持一致:

    *  =============================== 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 CC1310_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,  /* CC1310_LAUNCHXL_SPI_MASTER_READY */
        GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG,  /* CC1310_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 */
    
    };

  • 设置为input后就触发不了應該是你程序沒設置好

  • 配置如下,帮忙看一下有啥问题

    PIN_State asic_pinState;
    asic_pinHandle = PIN_open(&asic_pinState, asic_pinTable);
    if (asic_pinHandle == NULL)
    {
    while(1);
    }

    PIN_Status status = PIN_registerIntCb(asic_pinHandle, &asic_int_handler);
    if (status != PIN_SUCCESS)
    {
    while(1);
    }

    void asic_int_handler(uint_least8_t index)
    {
    int_flag++;
    }

    IOID_13| PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_NEGEDGE, 

  • 看起來沒有什麼問題,你直接用pininterrupt例程可以正確執行嗎?