• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Eingebettete Systemsoftware
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2024/25
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Systemnahe Programmierung in C (für Wiederholer)
    • SPiCboard
      • Bauanleitung
        • Programmieren im CIP
          • libspicboard-Doku
            • SPiC-IDE
              • SPiCsim
                • FAQ
                  • Projekte
                  • Prüfung
                    • Evaluation
                      • Linux libc-Doku
                        • Intern

                        SPiCboard

                        Files | Functions
                        Display contents from Flash memory

                        Display functions enabling flash memory contents. More...

                        + Collaboration diagram for Display contents from Flash memory:

                        Files

                        file  display.h
                         

                        Functions

                        int8_t sb_display_drawBitmapFromFlash (uint8_t pageStart, uint8_t colStart, uint8_t pageCount, uint8_t colCount, const __flash uint8_t *contents)
                         Draw a bitmap from the flash memory onto the OLED display. More...
                         
                        int8_t sb_display_fillScreenFromFlash (const __flash uint8_t *contents)
                         Draw the contents of the flash to the entire OLED display screen. More...
                         
                        int8_t sb_display_showStringFromFlash (uint8_t pageNum, uint8_t colStart, const __flash char *str)
                         Print a \0 terminated text string from flash on the OLED display using a 8×8 pixel font. More...
                         
                        int8_t sb_display_showStringWideFromFlash (uint8_t pageNum, uint8_t colStart, const __flash char *str)
                         Print a \0 terminated text string from flash with a (slightly) wider 8×8 pixel font onto the OLED display. More...
                         
                        int8_t sb_display_showStringSmallFromFlash (uint8_t pageNum, uint8_t colStart, const __flash char *str)
                         Print a \0 terminated text string from flash on the OLED display using a small 6×4 pixel font. More...
                         

                        Detailed Description

                        Display functions enabling flash memory contents.

                        For microcontroller-based software development, memory usage is a crucial part. The SRAM on the Atmega 328PB (the processor of the Xplained Mini / SPiCboard v3) is extremly tight compared to PCs – its 2 KB are the limiting factor for using the 128×64 pixel monochrome OLED display: Just the contents of a single screen (128×64 bits) would consume half of the available SRAM!

                        But since most data is constant, this can be stored and read from the flash program memory (with 32 KB on this microprocessor it is sixteen times the SRAM).

                        Due to the different address space, it is not possible to access the data in flash in the same way you access SRAM contents – a special instruction is required to read from this memory: the ldm instruction (instead of ld).

                        This will be done automatically by the compiler when using the Named-Address-Space keyword __flash in the variable declaration.

                        In case you have quite an old compiler not supporting this feature, you have to use the Program Space Utilities from the AVR LibC and not only tag the variables with the PROGMEM keywords but although use the pgm_read_byte function to access them.

                        The following functions use the same parameters (besides the flash keyword) as their counter parts and their function name is appended by FromFlash

                        Function Documentation

                        int8_t sb_display_drawBitmapFromFlash ( uint8_t  pageStart,
                        uint8_t  colStart,
                        uint8_t  pageCount,
                        uint8_t  colCount,
                        const __flash uint8_t *  contents 
                        )

                        Draw a bitmap from the flash memory onto the OLED display.

                        Almost the same function as sb_display_drawBitmap(), but the contents are read from the flash (program memory) - so no SRAM is wasted.

                        See also
                        sb_display_drawBitmap
                        Parameters
                        pageStartfirst page to set the top vertical position
                        colStartfirst column to set the left horizontal position
                        pageCountnumber of pages to set the bottom position
                        colCountnumber of columns to define the right border
                        contentsarray (pageCount * colCount elements) pointing to a bitmap stored in the flash memory (using either __flash namespace or PROGMEM macro)
                        Return values
                        0success
                        <0on I²C error (see sb_display_enable() return codes)
                        int8_t sb_display_fillScreenFromFlash ( const __flash uint8_t *  contents)

                        Draw the contents of the flash to the entire OLED display screen.

                        Almost same function as sb_display_fillScreen(), but the contents are read from the flash (program memory) - so no SRAM is wasted.

                        The function call is identical to

                        sb_display_drawBitmapFromFlash(0, 0, 8, 128, contents);
                        sb_display_drawBitmapFromFlash
                        int8_t sb_display_drawBitmapFromFlash(uint8_t pageStart, uint8_t colStart, uint8_t pageCount, uint8_t colCount, const __flash uint8_t *contents)
                        Draw a bitmap from the flash memory onto the OLED display.
                        Parameters
                        contentspointer to a 8*128 item array in flash memory (using either __flash namespace or PROGMEM macro)
                        Return values
                        0success
                        <0on I²C error (see sb_display_enable() return codes)
                        int8_t sb_display_showStringFromFlash ( uint8_t  pageNum,
                        uint8_t  colStart,
                        const __flash char *  str 
                        )

                        Print a \0 terminated text string from flash on the OLED display using a 8×8 pixel font.

                        Almost same function as sb_display_showString(), but the string is read from the flash (program memory) - so no SRAM is wasted.

                        The Fonts Table contains a detailed list of the available characters

                        It is possible to define an inline flash string using the PSTR macro from the Program Space Utilities:

                        static const __flash str[] = "Ipsum";
                        sb_display_showString(0, 0, "Lorem");
                        sb_display_showStringFromFlash(1, 0, str);
                        sb_display_showStringFromFlash(2, 0, PSTR("dolor"));
                        sb_display_showStringFromFlash
                        int8_t sb_display_showStringFromFlash(uint8_t pageNum, uint8_t colStart, const __flash char *str)
                        Print a \0 terminated text string from flash on the OLED display using a 8×8 pixel font.
                        sb_display_showString
                        int8_t sb_display_showString(uint8_t pageNum, uint8_t colStart, const char *str)
                        Print a \0 terminated text string on the OLED display using a 8×8 pixel font.

                        This will display Lorem , Ipsum and dolor on the subsequent lines, but only the first string will consume SRAM during runtime. The second and third call are different ways for reading from flash memory.

                        Warning
                        The font will be stored on the flash which will consume about 2300 bytes (but there is no additional overhead in case you are already using the sb_display_showString() ).
                        Parameters
                        pageNumpage number (0-7) for vertical positioning the output
                        colStartfirst column to set the horizontal position of the output
                        str0-terminated string in flash memory
                        Return values
                        >=0length of printed string (can be less than strlen(str) )
                        <0on I²C error (
                        See also
                        sb_display_enable() return codes)
                        int8_t sb_display_showStringSmallFromFlash ( uint8_t  pageNum,
                        uint8_t  colStart,
                        const __flash char *  str 
                        )

                        Print a \0 terminated text string from flash on the OLED display using a small 6×4 pixel font.

                        Almost same function as sb_display_showStringSmall(), but the string is read from the flash (program memory) - so no SRAM is wasted.

                        The Fonts Table contains a detailed list of the available characters

                        Warning
                        This font will consume about 700 bytes (but no additional overhead for using sb_display_showStringSmall() ).
                        Parameters
                        pageNumpage number (0-7) for vertical positioning the output
                        colStartfirst column to set the horizontal position of the output
                        str0-terminated string from flash
                        Return values
                        >=0length of printed string (can be less than strlen(str) )
                        <0on I²C error (
                        See also
                        sb_display_enable() return codes)
                        int8_t sb_display_showStringWideFromFlash ( uint8_t  pageNum,
                        uint8_t  colStart,
                        const __flash char *  str 
                        )

                        Print a \0 terminated text string from flash with a (slightly) wider 8×8 pixel font onto the OLED display.

                        Almost same function as sb_display_showStringWide(), but the string is read from the flash (program memory) - so no SRAM is wasted.

                        The Fonts Table contains a detailed list of the available characters.

                        Warning
                        This font will consume about 2300 bytes, too (but no additional overhead for using sb_display_showStringWide() ).
                        Parameters
                        pageNumpage number (0-7) for vertical positioning the output
                        colStartfirst column to set the horizontal position of the output
                        str0-terminated string in flash memory
                        Return values
                        >=0length of printed string (can be less than strlen(str) )
                        <0on I²C error (see sb_display_enable() return codes)
                        Friedrich-Alexander-Universität
                        Erlangen-Nürnberg

                        Schlossplatz 4
                        91054 Erlangen
                        • Impressum
                        • Datenschutz
                        • Barrierefreiheit
                        • Facebook
                        • RSS Feed
                        • Xing
                        Nach oben