How to use SPI in other .c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-04-12 1:47 AM
Hi everybody,
Actually I start a new project with a ST7567 driver for LCD 128x64.
I have create my project with CubeIDE . CubeIDE generate my code in the main.c like this :
/* Private variables ---------------------------------------------------------*/
RTC_HandleTypeDef hrtc;
SPI_HandleTypeDef hspi1;
/* USER CODE BEGIN PV */
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_RTC_Init(void);
static void MX_SPI1_Init(void);
/* USER CODE BEGIN PFP */
/* USER CODE END PFP */
It's ok .
Now to drive my screen I would like to create files like st7567_driver.h and a st7567_driver.c file.
This way I could create my functions relating to the driver in these files. Functions such as "draw pixel", "send command", "send data", etc....
But to communicate with the driver I have to use SPI1 create in my main.c.
So I get an error when I try to use the HAL_SPI_Transmit function in st7567_driver.c
I don't know how to declare to my st7567_driver.c file as I use the SPI1 declare in my main.c
Thank you for your help
Solved! Go to Solution.
- Labels:
-
STM32L0 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2024-04-12 3:01 AM - edited 2024-04-12 3:01 AM
Thank you so much for your reactivity. I can continue my learning and my code
Best regards

- « Previous
-
- 1
- 2
- Next »