0
votes

I am trying to interface a LCD with NUCLEO 64 STM32f103RB. I created project in CubeMX 6.0.1 having Cube firmware 1.8.3. I finished writing my .h file and compiled it and finished with no errors but when I included it in .c file it did not compile and produced very un expected errors.

.h file code is as bellow,

 /[![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_ */

errors in .h and .c file produced after adding .h file. screen shots are attached. Kindly explain as I am new with C and STM32 HAL. Thanks. Errors in .c file after including .h in .c and compiling

Errors in .h file after including .h in .c and compiling

1

1 Answers

0
votes

The first problem is that inside structure LCD_PIN_typedef you have a member GPIO_TypeDef port, but it should be GPIO_TypeDef *port.