我正在研究 STM32F103,目的是实现一些库。
当我声明 NVIC_InitStructure 时,它带有红色下划线,这意味着 Eclipse 无法识别它。我在使用它之前声明过:NVIC_InitTypeDef NVIC_InitStructure;
但它是红色未划线的。
也许在使用之前需要包含一个库?
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_InitStructure.NVIC_IRQChannel = CAN1_RX0_INTERRUPTS;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = CAN1_TX_INTERRUPTS;
NVIC_Init(&NVIC_InitStructure);
最佳答案
NVIC_InitTypeDef struct 是在 STM32 标准外设库中名为 misc.h
的头文件中定义的。因此,只需将其包含在您的源文件中即可。
#include "misc.h"
致quote :
This file contains all the functions prototypes for the miscellaneous firmware library functions (add-on to CMSIS functions).
关于c - 请我尝试了解我需要的库 NVIC 以及我应该做什么来声明 NVIC_InitStructure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56650694/