这是我写的代码:这样可以吗?
void NVIC_Configuration(void)
{
// 这个优先级怎么设置啊?
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}
static void board_init(void)
{
delay_init();
NVIC_Configuration();
LED_Init();
uart_init(9600);
EXTIX_Init();
}
int main(void)
{
board_init();
xQueue = xQueueCreate(3, sizeof(xData));
xTaskCreate(vSenderTask, "sender 1", 1000, (void *)&(xStructData[0]), 2, NULL);
xTaskCreate(vSenderTask, "sender 2", 1000, (void *)&(xStructData[1]), 2, NULL);
xTaskCreate(vReceiverTask, "receiver", 1000, NULL, 1, NULL);
vTaskStartScheduler();
for(;;);
}
// 按键中断,这样写可以吗?
void EXTI0_IRQHandler(void)
{
// 利用延时去按键抖动怎么写啊?
//delay_ms(10); //????
// 这样写可以吗
//vTaskDelay(10/portTICK_RATE_MS);
if(WK_UP==1)
{
LED0=!LED0;
LED1=!LED1;
}
EXTI_ClearITPendingBit(EXTI_Line0); //????EXTI0???·??????
}
void EXTI9_5_IRQHandler(void)
{
//delay_ms(10); //????
//vTaskDelay(10/portTICK_RATE_MS);
if(KEY0==0) {
LED0=!LED0;
}
EXTI_ClearITPendingBit(EXTI_Line5); //????LINE5????????±ê????
}
void EXTI15_10_IRQHandler(void)
{
//delay_ms(10); //????
//vTaskDelay(10/portTICK_RATE_MS);
if(KEY1==0)
{
LED1=!LED1;
}
EXTI_ClearITPendingBit(EXTI_Line15); //????LINE15???·??????
}
这是我写的代码:这样可以吗?
void NVIC_Configuration(void)
{
// 这个优先级怎么设置啊?
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
}
static void board_init(void)
{
delay_init();
NVIC_Configuration();
LED_Init();
uart_init(9600);
EXTIX_Init();
}
int main(void)
{
board_init();
xQueue = xQueueCreate(3, sizeof(xData));
xTaskCreate(vSenderTask, "sender 1", 1000, (void *)&(xStructData[0]), 2, NULL);
xTaskCreate(vSenderTask, "sender 2", 1000, (void *)&(xStructData[1]), 2, NULL);
xTaskCreate(vReceiverTask, "receiver", 1000, NULL, 1, NULL);
vTaskStartScheduler();
for(;;);
}
// 按键中断,这样写可以吗?
void EXTI0_IRQHandler(void)
{
// 利用延时去按键抖动怎么写啊?
//delay_ms(10); //????
// 这样写可以吗
//vTaskDelay(10/portTICK_RATE_MS);
if(WK_UP==1)
{
LED0=!LED0;
LED1=!LED1;
}
EXTI_ClearITPendingBit(EXTI_Line0); //????EXTI0???·??????
}
void EXTI9_5_IRQHandler(void)
{
//delay_ms(10); //????
//vTaskDelay(10/portTICK_RATE_MS);
if(KEY0==0) {
LED0=!LED0;
}
EXTI_ClearITPendingBit(EXTI_Line5); //????LINE5????????±ê????
}
void EXTI15_10_IRQHandler(void)
{
//delay_ms(10); //????
//vTaskDelay(10/portTICK_RATE_MS);
if(KEY1==0)
{
LED1=!LED1;
}
EXTI_ClearITPendingBit(EXTI_Line15); //????LINE15???·??????
}
1
举报