我正在尝试将液晶显示器与NUCLEO 64 STM32f103RB连接。我在具有立方体固件1.8.3的CubeMX 6.0.1中创建了项目。我完成了我的.h文件的编写和编译,并且没有任何错误,但是当我将它包含在.c文件中时,它没有编译,并且产生了非常意想不到的错误。
.h文件代码如下:
/[![enter image description here][1]][1]* S6D0154_LCD.h
*
* Created on: 16-Nov-2020
* Author: NUCLEO
*/
#ifndef INC_S6D0154_LCD_H_
#define INC_S6D0154_LCD_H_
#include "stm32f103xb.h"
#include "stm32f1xx_hal_gpio.h"
typedef struct{
uint16_t pin; // LCD Pins interface to STM32.
GPIO_TypeDef port;
}LCD_PIN_typedef;
typedef enum{
write_index,
write_WDR, // LCD Operation to be performed.
read_status,
read_RDR
}LCD_OPERATION;
typedef enum{
pins_READ, // STM32 port_pins mode for LCD_data_pins interface.
pins_WRITE
}LCD_INTERFACE_MODE;
//................................................
//...........LCD_PINS CONNECTIONS................|
//................................................
LCD_PIN_typedef LCD_D0 = {GPIO_PIN_9, GPIOA};
LCD_PIN_typedef LCD_D1 = {GPIO_PIN_7, GPIOC};
LCD_PIN_typedef LCD_D2 = {GPIO_PIN_10, GPIOA};
LCD_PIN_typedef LCD_D3 = {GPIO_PIN_3, GPIOB};
LCD_PIN_typedef LCD_D4 = {GPIO_PIN_5, GPIOB};
LCD_PIN_typedef LCD_D5 = {GPIO_PIN_4, GPIOB};
LCD_PIN_typedef LCD_D6 = {GPIO_PIN_10, GPIOB};
LCD_PIN_typedef LCD_D7 = {GPIO_PIN_8, GPIOA};
//..................................................
LCD_PIN_typedef LCD_RESET = {GPIO_PIN_1, GPIOC};
LCD_PIN_typedef LCD_RD = {GPIO_PIN_0, GPIOA};
LCD_PIN_typedef LCD_WR = {GPIO_PIN_1, GPIOA};
LCD_PIN_typedef LCD_RS = {GPIO_PIN_4, GPIOA};
LCD_PIN_typedef LCD_CS = {GPIO_PIN_0, GPIOB};
//...................................................
//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//...................................................
//...............LCD_OPERATIONS.....................|
//...................................................
void LCD_PIN_WRITE(LCD_PIN_typedef pin, GPIO_PinState state);
uint32_t LCD_UPDATE(uint32_t lcd_data, LCD_OPERATION operation);
void LCD_READ_INIT(void);
void LCD_WRITE_INIT(void);
void LCD_INIT(void);
#endif /* INC_S6D0154_LCD_H_ */添加.h文件后,在.h和.c文件中产生错误。屏幕截图已附加。请解释一下,因为我是C和STM32 HAL的新手。谢谢。


发布于 2020-11-18 18:42:17
第一个问题是,在structure LCD_PIN_typedef内部有一个成员GPIO_TypeDef port,但它应该是GPIO_TypeDef *port。
https://stackoverflow.com/questions/64890508
复制相似问题