STM32 Low Layer(LL) library. At the heart of the module is a powerful single-chip low power CMOS LCD driver controller from Philips – PCD8544. The chip is designed to drive a graphic display of 84×48 pixels. It interfaces to microcontrollers through a serial bus interface SPI.
- Small code footprint
- Interrupt and Polling LCD SPI versions
- Lot of predefined fonts
- Display printf function
- No HAL dependencies
How to add CPM to the project, check the link
CPMAddPackage(
NAME Nokia5110_LCD
GITHUB_REPOSITORY ximtech/Nokia5110_LCD
GIT_TAG origin/main)
- Start project with STM32CubeMX:
- Select: Project Manager -> Advanced Settings -> SPI -> LL
- Generate Code
- Add sources to project:
- Polling LCD SPI
add_subdirectory(${STM32_CORE_SOURCE_DIR}/SPI/Polling) # add SPI dependency
include_directories(${includes}
${NOKIA5110_LCD_DIRECTORY}) # source directories
file(GLOB_RECURSE SOURCES ${sources}
${NOKIA5110_LCD_SOURCES}) # source files
- Interrupt based LCD
add_subdirectory(${STM32_CORE_SOURCE_DIR}/SPI/IT) # add for interrupt version
include_directories(${includes}
${NOKIA5110_LCD_IT_DIRECTORY}) # source directories
file(GLOB_RECURSE SOURCES ${sources}
${NOKIA5110_LCD_IT_SOURCES}) # source files
- Then Build -> Clean -> Rebuild Project
In main.h
set configuration defines or use defaults from Nokia5110_LCD.h
#define N5110_DC_GPIO_PORT GPIOC
#define N5110_RESET_GPIO_PORT GPIOC
#define N5110_CHIP_SELECT_PORT GPIOA
#define N5110_DC_PIN LL_GPIO_PIN_1
#define N5110_RESET_PIN LL_GPIO_PIN_0
#define N5110_CHIP_SELECT_PIN LL_GPIO_PIN_4
// Font define section. Uncomment fonts what you want to use
#define N5110_FONT_DEFAULT 1
//#define N5110_FONT_THICK 2
//#define N5110_FONT_AUREBESH 3
//#define N5110_FONT_SEVEN_SEGMENT 4
//#define N5110_FONT_WIDE 5
//#define N5110_FONT_TINY 6
//#define N5110_FONT_LARGE 7
//#define N5110_FONT_HUGE 8
//#define N5110_FONT_MEGA 9
Image Converter: link