1、hs12864.h头文件:
#ifndef __HS12864_H
 #define __HS12864_H
#ifdef __cplusplus
 extern "C" {
 #endif
#include "stm32l4xx_hal.h"
// 控制线定义 - 根据实际硬件修改
 #define HS12864_RS_GPIO_PORT  GPIOC
 #define HS12864_RS_PIN        GPIO_PIN_0
 #define HS12864_RW_GPIO_PORT  GPIOC
 #define HS12864_RW_PIN        GPIO_PIN_1
 #define HS12864_E_GPIO_PORT   GPIOC
 #define HS12864_E_PIN         GPIO_PIN_2
// 数据线定义 - 假设使用GPIOA 0-7
 #define HS12864_DATA_GPIO_PORT  GPIOA
 #define HS12864_DATA_PINS       GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | \
                                  GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7
void HS12864_Init(void);
 void HS128