我使用SDK带的PWM点灯的例程,发现无法找到定义PWM输出口的代码:
Void pwmLEDFxn(UArg arg0, UArg arg1)
{
PWM_Handle pwm1;
PWM_Params params;
uint16_t pwmPeriod = 3000; // Period and duty in microseconds
uint16_t duty = 0;
uint16_t dutyInc = 100;
PWM_Params_init(¶ms);
params.dutyUnits = PWM_DUTY_US;
params.dutyValue = 0;
params.periodUnits = PWM_PERIOD_US;
params.periodValue = pwmPeriod;
pwm1 = PWM_open(Board_PWM0, ¶ms);
这里显示打开的是Board_PWM0,我往下找依次是:
/* Generic PWM instance identifiers */
#define Board_PWM0 CC1310DK_4XD_PWM0
#define Board_PWM1 CC1310DK_4XD_PWM1
#define Board_PWM2 CC1310DK_4XD_PWM2
#define Board_PWM3 CC1310DK_4XD_PWM3
#define Board_PWM4 CC1310DK_4XD_PWM4
#define Board_PWM5 CC1310DK_4XD_PWM5
#define Board_PWM6 CC1310DK_4XD_PWM6
#define Board_PWM7 CC1310DK_4XD_PWM7
typedef enum CC1310DK_4XD_PWM
{
CC1310DK_4XD_PWM0 = 0,
CC1310DK_4XD_PWM1,
CC1310DK_4XD_PWM2,
CC1310DK_4XD_PWM3,
CC1310DK_4XD_PWM4,
CC1310DK_4XD_PWM5,
CC1310DK_4XD_PWM6,
CC1310DK_4XD_PWM7,
CC1310DK_4XD_PWMCOUNT
} CC1310DK_4XD_PWM;
并没有看到制度具体的IO口,反而在同样的头文件找到这样的定义:
/* PWM outputs */
#define Board_PWMPIN0 Board_DK_LED3
#define Board_PWMPIN1 Board_DK_LED4
#define Board_PWMPIN2 PIN_UNASSIGNED
#define Board_PWMPIN3 PIN_UNASSIGNED
#define Board_PWMPIN4 PIN_UNASSIGNED
#define Board_PWMPIN5 PIN_UNASSIGNED
#define Board_PWMPIN6 PIN_UNASSIGNED
#define Board_PWMPIN7 PIN_UNASSIGNED
#define Board_LED_ON 1 /* LEDs on CC1310 are active high */
#define Board_LED_OFF 0
#define Board_DK_LED1 PIN_UNASSIGNED
#define Board_DK_LED2 PIN_UNASSIGNED
#define Board_DK_LED3 IOID_5 /* P1.2 */
这两者是在哪里关联起来的呢?
Loops:
就是在open里面做的初始化啊(关联)。 CC1310DK_4XD_PWM 这个只是枚举啊。你是想清楚具体open函数里面怎么控制的吗?
yanqing zhou:
回复 Loops:
是的,我想知道哪里可以查看到具体的实现源码,因为在CCS里很多具体的实现函数都看不到
Felix ZF:
在CC1310DK_7XD.h文件里
/* Generic PWM instance identifiers */#define Board_PWM0 CC1310_LAUNCHXL_PWM0#define Board_PWM1 CC1310_LAUNCHXL_PWM1#define Board_PWM2 CC1310_LAUNCHXL_PWM2#define Board_PWM3 CC1310_LAUNCHXL_PWM3#define Board_PWM4 CC1310_LAUNCHXL_PWM4#define Board_PWM5 CC1310_LAUNCHXL_PWM5#define Board_PWM6 CC1310_LAUNCHXL_PWM6#define Board_PWM7 CC1310_LAUNCHXL_PWM7
Felix ZF:
回复 Felix ZF:
在CC1310DK_4XD.h文件里
/* Generic PWM instance identifiers */#define Board_PWM0 CC1310DK_4XD_PWM0#define Board_PWM1 CC1310DK_4XD_PWM1#define Board_PWM2 CC1310DK_4XD_PWM2#define Board_PWM3 CC1310DK_4XD_PWM3#define Board_PWM4 CC1310DK_4XD_PWM4#define Board_PWM5 CC1310DK_4XD_PWM5#define Board_PWM6 CC1310DK_4XD_PWM6#define Board_PWM7 CC1310DK_4XD_PWM7
Felix ZF:
回复 yanqing zhou:
C:\TI\tirtos_cc13xx_cc26xx_2_21_00_06\products\tidrivers_cc13xx_cc26xx_2_21_00_04\packages\ti\drivers\pwm\PWMTimerCC26XX.c
这个文件里有具体实现,CCS不会跳转到.c文件,只会跳转到.h文件。
你可以自己到对应文件夹找到.c文件查看具体实现。