Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Library for OLED-displays runs on AVR

License

NotificationsYou must be signed in to change notification settings

Sylaina/oled-display

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library for oled-displays with SSD1306, SSD1309 or SH1106 display-controller connected with I2C or SPI at an AVR Atmel Atmega like Atmega328P.

This library allows you to display text or/and graphic at oled-display.The library need less than 2 kilobytes flash-memory and 3 bytes sram in textmode, in graphicmode library need less than 3 kilobytes flash-memory and 1027 bytes static sram so you can use oled-displays e.g with Atmega48PA (only with textmode).Library is only tested with 128x64 Pixel display, lower resolution not tested but should work too.

If you want to use your own I2C library you have to fit i2c-function at lcd-library.Settings for I2C-bus have to set at i2c.hSettings for display have to set at lcd.h

If you want to use characters like e.g. ä set your compiler input-charset to utf-8 and your compiler exec-charset to iso-8859-15 (look at makefile line 115).

Testcondition: Display: SSD1306 OLED, Compiler Optimizelevel: -Os, µC: Atmega328p @ 8 MHz internal RC

Memory:

ModulFlashStatic RAM
I2C-Core220 Bytes0 Bytes
FONT660 Bytes0 Bytes
OLED (Text-Mode)1437 Bytes2 Bytes
OLED (Graphic-Mode)2561 Bytes1026 Bytes

Speed (print 20 charaters (1 line) in normal size to display):

ModeTimeI2C-Speed
OLED (Text-Mode)4.411 ms400 kHz
OLED (Text-Mode)15.384 ms100 kHz
OLED (Graphic-Mode)26.603 ms400 kHz
OLED (Graphic-Mode)96.294 ms100 kHz

example:

//****main.c****//#include"lcd.h"intmain(void){lcd_init(LCD_DISP_ON);// init lcd and turn onlcd_puts("Hello World");// put string from RAM to display (TEXTMODE) or buffer (GRAPHICMODE)lcd_gotoxy(0,2);// set cursor to first column at line 3lcd_puts_p(PSTR("String from flash"));// puts string form flash to display (TEXTMODE) or buffer (GRAPHICMODE)#if definedGRAPHICMODElcd_drawCircle(64,32,7,WHITE);// draw circle to bufferlcd_display();// send buffer to display#endiffor(;;){//main loop  }return0;}

example for chars with double height:

//****main.c****//#include"lcd.h"intmain(void){lcd_init(LCD_DISP_ON);lcd_clrscr();lcd_set_contrast(0x00);lcd_gotoxy(4,1);lcd_puts("Normal Size");lcd_charMode(DOUBLESIZE);lcd_gotoxy(0,4);lcd_puts("  Double  \r\n   Size");lcd_charMode(NORMALSIZE);#ifdefGRAPHICMODElcd_display();#endiffor(;;){//main loop    }return0;}


[8]ページ先頭

©2009-2025 Movatter.jp