Pergunta

Isso já aconteceu comigo algumas vezes e estou tentando descobrir a causa raiz disso.Resumindo, recebo esses erros dizendo que algo está indefinido, mas pelo que posso dizer, não deveria ser.Como é mostrado abaixo, incluí pin_map.h que, na linha ~6580, define todos os três erros que estou recebendo (SSI1CLK, SS1RX e SS1TX sendo indefinidos).

Nas propriedades do meu projeto incluí C:\StellarisWare e usei definições de vários outros arquivos.Isso só acontece de vez em quando e, pela minha vida, não consigo entender.Alguém pode me dizer o que estou fazendo de errado?

Observe que estou usando a placa de avaliação LM3S2965 da TI com Code Composer Studio.

#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);

}

O arquivo pin_map.h é muito, muito longo, mas as definições em questão são:

#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

O erro em si é:

Description Resource    Path    Location    Type
#20 identifier "GPIO_PE0_SSI1CLK" is undefined  SPI.c   /Sandbox 1v1v1/SPI  line 23 C/C++ Problem
Foi útil?

Solução

Certifique-se de que pin_map.h esteja realmente no diretório driverlib.Além disso, existem macros envolvidas nessas definições?Por exemplo:

#ifdef SOME_MACRO
    #define GPIO_PE0_SSI1CLK 0x00040002
#endif

Talvez seja necessário #define "SOME_MACRO"

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top