我正在为Microchip Harmony Framework编写驱动程序。它看起来像是一个Linux驱动程序。我有一个结构体(NRF24L01_MainStateInfo),它存储驱动程序所需的所有状态,它只是由枚举值组成的“集合”。我已经努力了2天,但还是遇到了这个错误:
"../../../../framework/driver/nrf24l01/src/states/initialization_state/../../../drv_nrf24l01.h:51:2: error: unknown type name 'NRF24L01_MainStateInfo'"
该结构体具有一个该类型的成员(错误指向的位置)如下:
"../../../../framework/driver/nrf24l01/src/states/initialization_state/../../../drv_nrf24l01.h:51:2: error: unknown type name 'NRF24L01_MainStateInfo'"
该结构体具有一个该类型的成员(错误指向的位置)如下:
#ifndef __DRV_NRF24L01_H__
#define __DRV_NRF24L01_H__
// Framework include
//...
// Project specific include
#include "src/memory_map.h"
#include "src/nrf_definitions.h"
#include "src/states/drv_nrf24l01_main_state.h" // NRF24L01_MainStateInfo defined here
#include "src/bus/drv_nrf24l01_bus.h"
//...
typedef struct _nrf24l01_driver_info {
// Driver in use? (already configured)
bool inUse;
// Driver's mutex
OSAL_MUTEX_HANDLE_TYPE drvMutex;
// Driver configuration
NRF24L01_ConfigData config;
// Client count. Useless since there is a mapping 1:1 between driver and client
uint8_t clientCnt;
// Driver system status (returned by status)
SYS_STATUS status;
// FSM state
NRF24L01_MainStateInfo state; // <-- This member generate the error
// Bus information
NRF24L01_BusVTable vTable;
void *busInfo;
} NRF24L01_DriverInfo;
//...
#endif
NRF24L01_MainStateInfo
结构在 src/states/drv_nrf24l01_main_state.h
中声明,如下所示:
#ifndef __DRV__NRF24L01_MAIN_STATE_H__
#define __DRV__NRF24L01_MAIN_STATE_H__
//#include "../../drv_nrf24l01.h"
#include "initialization_state/drv_nrf24l01_init_state.h"
struct _nrf24l01_driver_info;
/*
Main driver state. These are the state that the developer will see.
*/
typedef enum {
NRF24L01_MAIN_STATE_UNINITIALIZED = 0,
NRF24L01_MAIN_STATE_INITIALIZATION,
NRF24L01_MAIN_STATE_RUNNING,
NRF24L01_MAIN_STATE_CLOSING,
NRF24L01_MAIN_STATE_CLOSED
} NRF24L01_MAIN_STATE;
typedef struct _nrf24l01_mainstate_info {
NRF24L01_MAIN_STATE mainState;
NRF24L01_INIT_STATE initState;
} NRF24L01_MainStateInfo;
int32_t DRV_nRF24L01_MainStateTask(struct _nrf24l01_driver_info *pDrv);
#endif /* end of include guard: __DRV__NRF24L01_MAIN_STATE_H__ */
我现在不明白为什么会出现这个错误。
目录树如下:
nrf24l01 .
│ drv_nrf24l01.h
│ LICENSE
│ README.md
│
├───config
│ .gitignore
│ drv_nrf.hconfig
│ drv_nrf24l01.hconfig
│ drv_nrf24l01_idx.ftl
│
├───src
│ │ drv_nrf24l01.c
│ │ memory_map.h
│ │ nrf_definitions.h
│ │
│ ├───bus
│ │ │ drv_nrf24l01_bus.h
│ │ │
│ │ └───spi
│ │ drv_nrf24l01_spi.c
│ │ drv_nrf24l01_spi.h
│ │
│ ├───internal
│ │ drv_nrf_internal.c
│ │ drv_nrf_internal.h
│ │
│ └───states
│ │ drv_nrf24l01_main_state.c
│ │ drv_nrf24l01_main_state.h
│ │
│ ├───closing_state
│ ├───initialization_state
│ │ drv_nrf24l01_init_state.c
│ │ drv_nrf24l01_init_state.h
│ │
│ └───running_state
└───templates
system_config.h.ftl
system_definitions.h.INC.ftl
system_definitions.h.OBJ.ftl
system_init.c.DRV.ftl
system_init.c.INIT.ftl
system_interrupt.c.ftl
system_tasks.c.ftl
也许我漏掉了什么?
编译器是 xc32-gcc,微控制器是 PIC32MX110F016B。