Driver and Graphics library for MicroOLED 0.66'' (64 x 48 pixel) display with SSD1306 controller. Display can be obtained from Sparkfun or from diverse Chinese sellers (similar displays) via Aliexpress. Display is driven via SPI. The library can be very easily adapted to other OLED displays (up to 128 x 64 pixel) with SSD1306 controller by setting defines and changing controller init commands accordingly.

Dependents:   MicroOLED_Test

Small test-program that briefly shows the basic usage of the library:

#include "mbed.h"
#include "SFE_MicroOLED.h"
 
DigitalOut myled(LED1);
SPI my_spi(p5, p6, p7);
MicroOLED my_oled(my_spi, p11, p10, p9);
 
int main() {
    my_oled.init(0, 8000000);
    my_oled.clear(ALL);
    my_oled.puts("Hello all!");
    my_oled.circle(16, 31, 16);
    my_oled.line(0, 9, 63, 47);
    my_oled.rectFill(33, 32, 8, 8);
    my_oled.display();
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}
Committer:
synvox
Date:
Thu Mar 19 03:37:35 2015 +0000
Revision:
0:b7fc78d2b795
Library for MicroOLED 0.66'' (64 x 48 pixel) display with SSD1306 controller

Who changed what in which revision?

UserRevisionLine numberNew contents of line
synvox 0:b7fc78d2b795 1 /******************************************************************************
synvox 0:b7fc78d2b795 2 7segment.h
synvox 0:b7fc78d2b795 3 Definition for 7-segment font
synvox 0:b7fc78d2b795 4
synvox 0:b7fc78d2b795 5 This file was imported from the MicroView library, written by GeekAmmo
synvox 0:b7fc78d2b795 6 (https://github.com/geekammo/MicroView-Arduino-Library), and released under
synvox 0:b7fc78d2b795 7 the terms of the GNU General Public License as published by the Free Software
synvox 0:b7fc78d2b795 8 Foundation, either version 3 of the License, or (at your option) any later
synvox 0:b7fc78d2b795 9 version.
synvox 0:b7fc78d2b795 10
synvox 0:b7fc78d2b795 11 This program is distributed in the hope that it will be useful,
synvox 0:b7fc78d2b795 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
synvox 0:b7fc78d2b795 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
synvox 0:b7fc78d2b795 14 GNU General Public License for more details.
synvox 0:b7fc78d2b795 15
synvox 0:b7fc78d2b795 16 You should have received a copy of the GNU General Public License
synvox 0:b7fc78d2b795 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
synvox 0:b7fc78d2b795 18 ******************************************************************************/
synvox 0:b7fc78d2b795 19 #ifndef FONT7SEGMENT_H
synvox 0:b7fc78d2b795 20 #define FONT7SEGMENT_H
synvox 0:b7fc78d2b795 21
synvox 0:b7fc78d2b795 22 static const unsigned char sevensegment[] = {
synvox 0:b7fc78d2b795 23 // first row defines - FONTWIDTH, FONTHEIGHT, ASCII START CHAR, TOTAL CHARACTERS, FONT MAP WIDTH HIGH, FONT MAP WIDTH LOW (2,56 meaning 256)
synvox 0:b7fc78d2b795 24 10,16,46,12,1,20,
synvox 0:b7fc78d2b795 25 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
synvox 0:b7fc78d2b795 26 0x00, 0x00, 0x00, 0x00, 0x78, 0xFC, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, 0xFC, 0x78, 0x00, 0x00,
synvox 0:b7fc78d2b795 27 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02,
synvox 0:b7fc78d2b795 28 0xFC, 0x78, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x7E, 0xFF, 0x00, 0x80,
synvox 0:b7fc78d2b795 29 0x80, 0x80, 0x80, 0x00, 0xFF, 0x7E, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00,
synvox 0:b7fc78d2b795 30 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x03,
synvox 0:b7fc78d2b795 31 0x03, 0x02, 0xFC, 0x78, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x78, 0xFC,
synvox 0:b7fc78d2b795 32 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x00, 0x00, 0x00, 0x60, 0xF0, 0xF0, 0x60, 0x00,
synvox 0:b7fc78d2b795 33 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x40, 0xC0,
synvox 0:b7fc78d2b795 34 0xC0, 0xC0, 0xC0, 0x40, 0x3F, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E,
synvox 0:b7fc78d2b795 35 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x00, 0x00, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1,
synvox 0:b7fc78d2b795 36 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0x7E, 0x00, 0x00,
synvox 0:b7fc78d2b795 37 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41,
synvox 0:b7fc78d2b795 38 0x3E, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x1C, 0x3E, 0x41, 0xC1,
synvox 0:b7fc78d2b795 39 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C
synvox 0:b7fc78d2b795 40 };
synvox 0:b7fc78d2b795 41 #endif