Coder Social home page Coder Social logo

stm32-hal-pcd8544's Introduction

PCD8544

Driver for the PCD8544 display driver used in Nokia 5110 modules.

Usage

Connecting the PCD8544 driver to your microcontroller via an SPI (CPOL = Low, CPHA = 1 Edge) bus and the NSCE (Output, Pull-Down), DNC (Output, Pull-Down) and NRST (Output, Pull-Up) pins and initialise them using Cube. After doing so, you can use this library to interact with the driver as shown in the following example:

// Create the handle for the driver (Includes 504 byte of memory for the back buffer).
pcd8544_handle_t pcd8544_handle = {
        .spi_handle = &hspi1,
        .nsce_port = NOKIA5110_NSCE_GPIO_Port,
        .nsce_pin = NOKIA5110_NSCE_Pin,
        .dnc_port = NOKIA5110_DNC_GPIO_Port,
        .dnc_pin = NOKIA5110_DNC_Pin,
        .nrst_port = NOKIA5110_NRST_GPIO_Port,
        .nrst_pin = NOKIA5110_NRST_Pin,
};

// Initialise driver (performs basic setup and clears back buffer).
pcd8544_init(&pcd8544_handle);

// Set every second row to black (changes are only applied to back buffer).
for (uint8_t x = 0; x < PCD8544_LCD_WIDTH; x++) {
    for (uint8_t y = 0; y < PCD8544_LCD_HEIGHT; y++) {
        pcd8544_set_pixel(&pcd8544_handle, x, y, (pcd8544_color_t)(y % 2 == 0));   
    }
}

// Send back buffer to display.
pcd8544_update(&pcd8544_handle);

Supported Platforms

STM32L0 and STM32L4 are supported. The HAL header includes for other platforms may be added in pcd8544.h.

stm32-hal-pcd8544's People

Contributors

henriheimann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gxg0504

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.