Giter Club home page Giter Club logo

oled-display's Introduction

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 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.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 Static RAM
I2C-Core 120 Bytes 0 Bytes
FONT 644 Bytes 0 Bytes
OLED (Text-Mode) 1475 Bytes 3 Bytes
OLED (Graphic-Mode) 2473 Bytes 1027 Bytes

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

Mode Time I2C-Speed RAM
OLED (Text-Mode) 4.411 ms 400 kHz
OLED (Text-Mode) 15.384 ms 100 kHz
OLED (Graphic-Mode) 26.603 ms 400 kHz
OLED (Graphic-Mode) 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;
}

example for chars with double height:

//****main.c****//
#include "lcd.h"

int main(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);
        
#ifdef GRAPHICMODE
        lcd_display();
#endif
    for(;;){
    //main loop
    }   
    return 0;
}

oled-display's People

Contributors

paulklinger avatar sylaina avatar

Watchers

 avatar  avatar  avatar

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.