SDK中按键中断切换LED状态的例程 在PIN_init中初始化的引脚是 6 7; 在mainThread 函数中初始化的引脚变成 4,5 中断里面操作的也是4,5 不明白为什么
void CC1310_LAUNCHXL_initGeneral(void)
{
Power_init();
if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
/* Error with PIN_init */
while (1);
}
/* Perform board-specific initialization */
Board_initHook();
}
BoardGpioInitTable数组中的CC1310_LAUNCHXL_PIN_RLED和CC1310_LAUNCHXL_PIN_GLED 最终指向的是 IOID_6 、IOID_7
void *mainThread(void *arg0)
{
/* Call driver init functions */
GPIO_init();
/* Configure the LED and button pins */
GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(Board_GPIO_LED1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
GPIO_setConfig(Board_GPIO_BUTTON0, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
/* Turn on user LED */
GPIO_write(Board_GPIO_LED0, Board_GPIO_LED_ON);
/* install Button callback */
GPIO_setCallback(Board_GPIO_BUTTON0, gpioButtonFxn0);
/* Enable interrupts */
GPIO_enableInt(Board_GPIO_BUTTON0);
/*
* If more than one input pin is available for your device, interrupts
* will be enabled on Board_GPIO_BUTTON1.
*/
if (Board_GPIO_BUTTON0 != Board_GPIO_BUTTON1) {
/* Configure BUTTON1 pin */
GPIO_setConfig(Board_GPIO_BUTTON1, GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_FALLING);
/* Install Button callback */
GPIO_setCallback(Board_GPIO_BUTTON1, gpioButtonFxn1);
GPIO_enableInt(Board_GPIO_BUTTON1);
}
return (NULL);
}
#define Board_GPIO_LED0 CC1310_LAUNCHXL_GPIO_LED_RED
#define Board_GPIO_LED1 CC1310_LAUNCHXL_GPIO_LED_GREEN
#define Board_GPIO_RLED CC1310_LAUNCHXL_GPIO_LED_RED
#define Board_GPIO_GLED CC1310_LAUNCHXL_GPIO_LED_GREEN
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;
Board_GPIO_LED0 ,Board_GPIO_LED1 最终指向枚举 值是4根5;实际上开发板的IO口是连接到6根7的 不明白为什么这样子
Alvin Chen:
这个无所谓,不是指向那个IO,不会影响实际上的执行,这个里面的4,5不代表IO而是代表enum 里面的第几个。
YiKai Chen:
我看了Board_GPIO_LED0 ,Board_GPIO_LED1最终指向是6根7,你要不要重裝一次全新的SDK再試試
user5950534:
回复 Alvin Chen:
enum里面的第几个,值不就是4与5吗? 我还是不理解为什么;并且两个灯是enum里的第五个跟第六个
user5950534:
回复 YiKai Chen:
好的,我去官网在重新载一个最新的SDK试试。