cancel
Showing results for 
Search instead for 
Did you mean: 

I receive no errors while compiling the header file( attached in details), for a LCD interface, but as I include this header in my .c file a lot of errors and warnings appear. I am new in c and HAL, kindly give some detail or reference for knowledge base

WRaso.1
Associate II

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

I am using SW4STM32 and STM32CubeMX 6.01 and CubeF1 FW 1.83

5 REPLIES 5
KnarfB
Principal III

A header file is never compiled, only included in .c files.

There are errors (red crosses) in the HAL driver libs. This should not be the case.

Generate a new, empty project without S6D0154_LCD. Check that it builds correctly. Then, insert S6D0154_LCD again.

TDK
Guru

> #include "stm32f103xb.h"

> #include "stm32f1xx_hal_gpio.h"

You should only be including the first of these files. Everything else in included automatically based on your stm32f1xx_hal_conf.h file. Change the comments within the configuration file to include modules as needed.

If you feel a post has answered your question, please click "Accept as Solution".

Including #include "stm32f103xb.h" in S6D0154.h produces symbol'GPIO_Pin_0' can not be resolved semantic error. Including #include "stm32f1xx_hal_gpio.h" resolve these errors in S6D0154.h file but compilation is not successful and strange errors appear in Core/inc folder. Instead of including stm32f1xx_hal_gpio.h I included stm32f1xx_hal.h file in S6D0154.h, now all the errors in S6D0154.h files cleared and project compiled successfully without any errors and warnings.

For me this was a fluke, Kindly give some guideline regarding including .h HAL files, (as I included stm32f1xx_hal_gpio.h to resolve "symbol'GPIO_Pin_0' can not be resolved semantic error", which resolved issues in .h file but project not compiled)0693W000005Bu0YQAS.png

I should have said you only include stm32f1xx_hal.h
Take a look at some example projects:
https://github.com/STMicroelectronics/STM32CubeF1/blob/master/Projects/STM32F103RB-Nucleo/Examples/GPIO/GPIO_IOToggle/Inc/main.h
If you feel a post has answered your question, please click "Accept as Solution".

Actually only stm32f1xx.h must be included in code and STM32F103xB and USE_HAL_DRIVER must be defined globally.