Skip to content

Commit

Permalink
Merge pull request afiskon#22 from dmitry-kandiner/master
Browse files Browse the repository at this point in the history
Added support for 128x32 displays
  • Loading branch information
afiskon committed Mar 18, 2020
2 parents 147ca0a + b2d1f49 commit dcdae48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ssd1306/ssd1306.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,13 @@ void ssd1306_Init(void) {
#endif

ssd1306_WriteCommand(0xA8); //--set multiplex ratio(1 to 64) - CHECK
#if (SSD1306_HEIGHT == 32)
ssd1306_WriteCommand(0x1F); //
#elif (SSD1306_HEIGHT == 64)
ssd1306_WriteCommand(0x3F); //
#else
#error "Only 32 or 64 lines of height are supported!"
#endif

ssd1306_WriteCommand(0xA4); //0xa4,Output follows RAM content;0xa5,Output ignores RAM content

Expand All @@ -114,7 +120,13 @@ void ssd1306_Init(void) {
ssd1306_WriteCommand(0x22); //

ssd1306_WriteCommand(0xDA); //--set com pins hardware configuration - CHECK
#if (SSD1306_HEIGHT == 32)
ssd1306_WriteCommand(0x02);
#elif (SSD1306_HEIGHT == 64)
ssd1306_WriteCommand(0x12);
#else
#error "Only 32 or 64 lines of height are supported!"
#endif

ssd1306_WriteCommand(0xDB); //--set vcomh
ssd1306_WriteCommand(0x20); //0x20,0.77xVcc
Expand Down
2 changes: 2 additions & 0 deletions ssd1306/ssd1306.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ _BEGIN_STD_C
#include "stm32f3xx_hal.h"
#elif defined(STM32H7)
#include "stm32h7xx_hal.h"
#elif defined(STM32F7)
#include "stm32f7xx_hal.h"
#else
#error "SSD1306 library was tested only on STM32F1, STM32F3, STM32F4, STM32L0, STM32L4, STM32H7 MCU families. Please modify ssd1306.h if you know what you are doing. Also please send a pull request if it turns out the library works on other MCU's as well!"
#endif
Expand Down

0 comments on commit dcdae48

Please sign in to comment.