GithubHelp home page GithubHelp logo

ssd1306-stm32hal's Introduction

ssd1306-stm32HAL

ssd1306 library for stm32 using stm32-hal library's. This library works with i2c and is configured for 128x64 oled panels by default.

If you search 4-wire SPI support, you can find it in the afiskon/stm32-ssd1306 fork.

If you need a font generator to add custom fonts you can find it here: the-this-pointer/glcd-font-calculator.

Usage

Compile and link the library files in your project.

- font.c 
- ssd1306.c

A full example for stm32f411 discovery is located in the example folder.

Small example:

#include "ssd1306.h"
#include "fonts.h"

I2C_HandleTypeDef hi2c1;

// Init lcd using one of the stm32HAL i2c typedefs
ssd1306_Init(&hi2c1);

// Write data to local screenbuffer
ssd1306_SetCursor(0, 36);
ssd1306_WriteString("4ilo", Font_11x18, White);

// Copy all data from local screenbuffer to the screen
ssd1306_UpdateScreen(&hi2c1);

128x32 example

The library can be used with different screen sizes by redefining the SSD1306_WIDTH and SSD_1306_HEIGHT defines. Some smaller screens might be wired with interlacing, if you encounter issues related to interlacing defining SSD1306_COM_LR_REMAP will configure the controller to support this feature.

make EXTRA_CFLAGS="-DSSD1306_HEIGHT=32 -DSSD1306_COM_LR_REMAP"

Some screens might also be using another 'Sequential COM pin configuration'. Defining SSD1306_COM_ALTERNATIVE_PIN_CONFIG as 0 will configure the controller to use another configuration.

make EXTRA_CFLAGS="-DSSD1306_HEIGHT=32 -DSSD1306_COM_LR_REMAP -DSSD1306_COM_ALTERNATIVE_PIN_CONFIG=0"

ssd1306-stm32hal's People

Contributors

4ilo avatar afiskon avatar notalabs avatar the-this-pointer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssd1306-stm32hal's Issues

Vertical interlacing and correct screen size setup

With some 128x32 displays default settings don't work and need to be adjusted:

  • Line 43 of ssd1306.c has to be modified according to the size of the screen that is used. Specifically, number of horizontal lines.
  • Line 52 of ssd1306.c has to be modified depending on exact manufacturing method of 32 line displays. It seems that some manufacturers do one to one mapping of 32 lines to 32 pins and leave 32 to 63 unused, while some interlace, so mapping becomes 0 to 0, 1 to 2, 2 to 4, 3 to 6, etc. This type of mapping can be taken into account by flipping bit 5 of command 0xDA.
    Which way specific screen is manufactured is impossible to know, so it has to be tested. Adjustment is trivial, however.
    @4ilo, if you'd like me to submit a branch to propose a fix for this issue, assign it to me.

P.S. I've emailed you about it earlier, but you can ignore that email now that I found the source of the problem.

Screen not quite filled

Your code appear to work quite well, I am using an STM32F411CE "Black Pill" module the only problem I seem to have is that the right side of the display is not being filled and this is a SSD1306 128X64 module that I have previously tried with other controllers and never saw this problem. I did try defining: SSD1306_COM_LR_REMAP but it did not appear to change anything.

I have attached a photo of the lcd screen
Do you have any suggestions
Thank you so much.

IMG_0917
?

DrawBitmap.

Is there any way to include the Drawqbitmap function?

I made a fork with SPI support and some refactorings... not sure what next

Hello Oliver,

First of all, thank you so much for sharing this library! It was exactly what I was looking for and it worked flawlessly.

I wanted to make you know that I made a fork of your library:

https://github.com/afiskon/stm32-ssd1306

I refactored the code a bit (e.g. all library files are in one directory now, and examples are in other directories), implemented some minor features I needed (e.g. mirroring support) and most importantly - my fork supports 4-wire SPI protocol.

I was hoping perhaps we could somehow merge our libraries. The problem is - I'm not sure how. The structure differs quote a lot so I can't simply send a pull request. Would you be interested in moving my code to your repository entirely? Or maybe vice versa - closing your repository with redirect to mine? Or maybe you wold be interested in just mentioning my fork in README.md of your library so people could easily find it if they need SPI support?

What do you think?

How to generate fonts for uint16_t?

May I ask what software did you use to generate the font to 16bits format?
code as shown below:

static const uint16_t Font7x10 [] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // sp
0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0000, 0x1000, 0x0000, 0x0000, // !
0x2800, 0x2800, 0x2800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // "
:::
:::

Custom Font ,

Hey hello there,

I need to import a specific font , do you have a converter in order to import my fonts?

font generated question

Hello,
I can run normally with your driver, but now I need to change the ASCII font size, Chinese character set and modify the picture. I would like to ask what software you use for module extraction and generation, could you tell me the specific software and procedures of module extraction? Thank you very much!
For example, if I need a font larger than 16x26, how do I generate this data?

Correction to my previous issue

Hi again, On the last photo I show a large filled rectangle on the right hand side of the screen , I meant to remove the rectangle which the code told it to draw, my mistake. However, the problem is still visible on the right edge of the screen as there seems to be a series of pixels lit-up from top to bottom that I can't seem to get rid of. I have attached a new picture of that. Also it looks like my starting point on the left of the screen is cut off in some places
Sorry for my previous screw up

Once again ...Thank you

IMG_0918
.

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.