58 Zeilen
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			58 Zeilen
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
# OLED for AVR mikrocontrollers
 | 
						|
Library for oled-displays with SSD1306 or SH1106 display-controller connected with I2C at an AVR Atmel Atmega like Atmega328P.
 | 
						|
 | 
						|
This library allows you to display text or/and graphic at oled-display.
 | 
						|
The library need 1591 bytes flash-memory and 2 bytes sram in textmode, in graphicmode library need 2823 bytes flash-memory and 1026 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.h
 | 
						|
Settings 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:
 | 
						|
 | 
						|
Modul       | Flash        | Stat. RAM
 | 
						|
------------+--------------+------------
 | 
						|
I2C-Core    | 120 Byte     |    0
 | 
						|
FONT        | 644 Byte     |    0
 | 
						|
Oled (TXT)  | 1003 Byte    |    2 Byte
 | 
						|
Oled (GFX)  | 2009 Byte    | 1026 Byte
 | 
						|
 | 
						|
Speed (print 20 charaters to display):
 | 
						|
 | 
						|
 | 
						|
 | 
						|
Mode        | Time       | I2C-Speed
 | 
						|
------------+------------+------------
 | 
						|
Oled (TXT)  | 4.411 ms   | 400 kHz
 | 
						|
Oled (TXT)  | 15.384 ms  | 100 kHz
 | 
						|
Oled (GFX)  | 26.603 ms  | 400 kHz
 | 
						|
Oled (GFX)  | 96.294 ms  | 100 kHz
 | 
						|
 | 
						|
 | 
						|
example:
 | 
						|
 | 
						|
//****main.c****//
 | 
						|
#include "lcd.h"
 | 
						|
 | 
						|
 | 
						|
int main(void){
 | 
						|
  lcd_init(LCD_DISP_ON);    // init lcd and turn on
 | 
						|
  
 | 
						|
  lcd_puts("Hello World");  // put string from RAM to display (TEXTMODE) or buffer (GRAPHICMODE)
 | 
						|
  lcd_gotoxy(0,2);          // set cursor to first column at line 3
 | 
						|
  lcd_puts_p(PSTR("String from flash"));  // puts string form flash to display (TEXTMODE) or buffer (GRAPHICMODE)
 | 
						|
#if defined GRAPHICMODE
 | 
						|
  lcd_drawCircle(64,32,7,WHITE); // draw circle to buffer
 | 
						|
  lcd_display();                  // send buffer to display
 | 
						|
#endif
 | 
						|
  for(;;){
 | 
						|
    //main loop
 | 
						|
  }
 | 
						|
  return 0;
 | 
						|
}
 |