Identificador indefinido
-
20-12-2019 - |
Pregunta
Esto me ha pasado algunas veces y estoy tratando de averiguar la causa raíz de ella.En pocas palabras, entiendo estos errores diciendo que algo no está definido, pero tan cerca, como puedo decir que no debería serlo.Como se muestra a continuación, he incluido pin_map.h que, en línea ~ 6580 define los tres errores que recibo (SSI1CLK, SS1RX y SS1TX que se indefinía).
En mis propiedades del proyecto, he incluido C: \ stellarisware y han utilizado define de varios otros archivos.Solo sucede de vez en cuando y por la vida de mí, no puedo entenderlo.¿Puede alguien decirme qué estoy haciendo mal?
Tenga en cuenta que estoy usando la placa de evaluación LM3S2965 de TI con el estudio del compositor de código.
#include "inc/lm3s2965.h"
#include "inc/hw_ints.h"
#include "inc/hw_ssi.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/ssi.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
void init_SPI(void){
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
GPIOPinConfigure(GPIO_PE0_SSI1CLK);
GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE,GPIO_PIN_1);
GPIOPinConfigure(GPIO_PE2_SSI1RX);
GPIOPinConfigure(GPIO_PE3_SSI1TX);
GPIOPinWrite(GPIO_PORTE_BASE,GPIO_PIN_1,GPIO_PIN_1);
SSIDisable(SSI1_BASE);
GPIOPinTypeSSI(GPIO_PORTE_BASE, GPIO_PIN_3 | GPIO_PIN_2 |
GPIO_PIN_0);
SSIConfigSetExpClk(SSI1_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI1_BASE);
}
El archivo pin_map.h es muy, muy largo, pero los define en cuestión son:
#define GPIO_PE0_SSI1CLK 0x00040002
#define GPIO_PE0_CCP3 0x00040003
#define GPIO_PE0_EPI0S8 0x00040008
#define GPIO_PE1_SSI1FSS 0x00040402
#define GPIO_PE1_CCP2 0x00040404
#define GPIO_PE1_CCP6 0x00040405
#define GPIO_PE1_EPI0S9 0x00040408
#define GPIO_PE2_CCP4 0x00040801
#define GPIO_PE2_SSI1RX 0x00040802
#define GPIO_PE2_CCP2 0x00040805
#define GPIO_PE2_EPI0S24 0x00040808
#define GPIO_PE3_CCP1 0x00040C01
#define GPIO_PE3_SSI1TX 0x00040C02
#define GPIO_PE3_CCP7 0x00040C05
#define GPIO_PE3_EPI0S25 0x00040C08
El error en sí es:
Description Resource Path Location Type
#20 identifier "GPIO_PE0_SSI1CLK" is undefined SPI.c /Sandbox 1v1v1/SPI line 23 C/C++ Problem
Solución
Asegúrese de que PIN_MAP.H esté en realidad en el directorio DriverLib.Además, ¿hay macros envueltos alrededor de estas definiciones?Por ejemplo:
#ifdef SOME_MACRO
#define GPIO_PE0_SSI1CLK 0x00040002
#endif
Es posible que tenga para #define "some_macro"