#include <ti/sysbios/family/arm/cc26xx/Power.h>
#include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>
#include <driverLib/timer.h>
Task_Struct taskStruct;
void taskFxn(UArg a0, UArg a1);
PIN_init(BoardGpioInitTable);
Task_Params params;
Task_Params_init(¶ms);
params.priority = TASK_PRI;
params.stackSize = TASK_STACK_SIZE;
params.stack = taskStack;
Task_construct(&taskStruct, taskFxn, ¶ms, NULL);
BIOS_start();
bool timerEnabled = 0;
PIN_Config pwmExamplePins[] = {
Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_KEY_SELECT | PIN_INPUT_EN | PIN_HYSTERESIS | PIN_HYSTERESIS | PIN_PULLUP | PIN_IRQ_NEGEDGE,
PIN_TERMINATE };
PIN_State pinState;
PIN_Handle pinHandle;
static void timerInitialize() {
TimerConfigure(GPT0_BASE, TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_PWM);
TimerLoadSet(GPT0_BASE, TIMER_A, TIMER_LOADSET);
TimerMatchSet(GPT0_BASE, TIMER_A, TIMER_MATCH);
//Stall timer when halting debugger
//TimerStallControl(GPT0_BASE, TIMER_A, true)
}
static void pinCallBack(PIN_Handle handle, PIN_Id pinId) {
if( timerEnabled) {
timerEnabled = 0;
// Allow standby in TI RTOS and stop timer
Power_releaseConstraint(Power_SB_DISALLOW);
TimerDisable(GPT0_BASE, TIMER_A);
}
else {
timerEnabled = 1;
// Disallow standby in TI RTOS to allow timer to run
Power_setConstraint(Power_SB_DISALLOW);
TimerEnable(GPT0_BASE, TIMER_A);
}
void taskFxn(UArg a0, UArg a1) {
// Register client for pins in pwmExamplePins array
pinHandle = PIN_open(&pinState, pwmExamplePins);
// Route LED1 pin on SmartRF06EB to IO event port 0 (0 = Timer0A, 1 = Timer0B, 2 = Timer1A..)
PINCC26XX_setMux(pinHandle, PIN_ID(Board_LED1), IOC_PORT_MCU_PORT_EVENT0);
PIN_registerIntCb(pinHandle, pinCallBack);
// Turn on PERIPH power domain and clock for GPT0
Power_setDependency(PERIPH_GPT0);
timerInitialize();
// 100ms
uint32_t sleepTicks = 100 * 1000/Clock_tickPeriod;
bool ledValue = 0;
while(1) {
// Let task sleep, chip will go into IDLE or STANDBY mode depending on whether timer is enabled
Task_sleep(sleepTicks);
PIN_setOutputValue(pinHandle, PIN_ID(Board_LED2), ledValue);
// Invert LED value
ledValue = (ledValue ? 0 : 1);
}
尝试从一个示例中为CC2650STK SensorTag德州仪器设备制作蜂鸣器,但它一直给出相同的错误而无法继续进行。
致命错误#1965:无法打开源文件 &#34; TI / sysbios /家庭/臂/ cc26xx / Power.h&#34;
设备本身是否缺少某些文件,或者是否应该将某些内容作为额外内容下载以继续?
感谢您的帮助。