「Pro MicroによるOLEDディスプレイ への表示」では「Adafruit SSD1306」と「Adafruit GFX Library」ライブラリを使用してOLEDディスプレイ「SSD1306」を表示させました。今回は、ライブラリを使用しないで文字列を表示させます。
表示仕様
今回のプログラムの仕様を次に示します。
- 指定した位置から文字列を表示します。
- 文字は英数字・記号のみとします。
- 文字色は白のみ、文字サイズは10x14ドットとします。
- インタフェースはI2Cとします。
プログラムの作成
作成したプログラムを次に示します。
tomo_ssd1306.ino
/************************************************************************** This is an example for our Monochrome OLEDs based on SSD1306 drivers Pick one up today in the adafruit shop! ------> http://www.adafruit.com/category/63_98 This example is for a 128x32 pixel display using I2C to communicate 3 pins are required to interface (two I2C and one reset). Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries, with contributions from the open source community. BSD license, check license.txt for more information All text above, and the splash screen below must be included in any redistribution. **************************************************************************/ //#include <SPI.h> #include <Wire.h> #include "tomo_SSD1306.h" // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); void setup() { Wire.begin(); Serial.begin(9600); // while (!Serial); Serial.println(F("SSD1306 start")); // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } // Clear the buffer display.clearDisplay(); testdrawstyles(); // Draw 'stylized' characters delay(10000); } void loop() { } void testdrawstyles(void) { display.clearDisplay(); display.setCursor(1,0); // Start at top-left corner display.setTextColor(SSD1306_WHITE); display.gfx_setTextSize(2); display.gfx_println("0123456789"); display.gfx_println("ABCDEFGH:."); display.gfx_println("abcdefgh"); display.gfx_println("!`#$%&'(="); display.display(); delay(2000); } /////////////////////////////////////////////////////////////
tomo_SSD1306.cpp
//#include <SPI.h> #include <Arduino.h> #include <Wire.h> #include "font.h" #include "tomo_SSD1306.h" void Adafruit_SSD1306::drawPixel(int16_t x, int16_t y, uint16_t color) { if((x >= 0) && (x < WIDTH) && (y >= 0) && (y < HEIGHT)) { buffer[x + (y/8)*WIDTH] |= (1 << (y&7)); } } void Adafruit_SSD1306::drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color) { int16_t byteWidth = (w + 7) / 8; // Bitmap scanline pad = whole byte uint8_t byte = 0; for(int16_t j=0; j<h; j++, y++) { for(int16_t i=0; i<w; i++) { if(i & 7) byte <<= 1; else byte = pgm_read_byte(&bitmap[j * byteWidth + i / 8]); if(byte & 0x80) drawPixel(x+i, y, color); } } } ////////////////////////////////////////////////////////////// void Adafruit_SSD1306::gfx_drawChar( int16_t x, int16_t y, unsigned char c,uint16_t color, uint16_t bg, uint8_t size) { Serial.println(c,HEX); if( (x >= _width) || // Clip right (y >= _height) || // Clip bottom ((x + 6 * size - 1) < 0) || // Clip left ((y + 8 * size - 1) < 0)) // Clip top return; int8_t i = 0; int8_t k = 0; for( i = 0 ; i < 6 ; i++ ){ uint8_t linek; if( i == 5 ) linek = 0x0; else{ linek = pgm_read_byte(&font[c*5+i]); } Serial.println(pgm_read_byte(&font[c*5+i]),HEX); Serial.println(c,HEX); Serial.println(i,HEX); Serial.println(linek,HEX); int8_t j = 0; for( j = 0; j < 8 ; j++ ){ if( linek & 0x1 ){ if( size == 1 ){ // default size Serial.println(i,HEX); drawPixel( x+(i*2), y+(j*2), color ); drawPixel( x+(i*2)+1, y+(j*2), color ); drawPixel( x+(i*2), y+(j*2)+1, color ); drawPixel( x+(i*2)+1, y+(j*2)+1, color ); } else { // big size // gfx_fillRect( x+(i*size), y+(j*size), size, size, color ); drawPixel( x+(i*2), y+(j*2), color ); drawPixel( x+(i*2)+1, y+(j*2), color ); drawPixel( x+(i*2), y+(j*2)+1, color ); drawPixel( x+(i*2)+1, y+(j*2)+1, color ); } } else if( bg != color ){ if( size == 1 ) // default size drawPixel( x+i, y+j, bg ); else { // big size // gfx_fillRect( x+i*size, y+j*size, size, size, bg ); } } linek >>= 1; } } } void Adafruit_SSD1306::gfx_write( uint8_t ch ){ if( ch == '\n' ){ cursor_y += textsize*8; cursor_x = 0; }else if( ch == '\r' ){ // skip em }else{ gfx_drawChar(cursor_x, cursor_y, ch, textcolor, textbgcolor, textsize); cursor_x += textsize*6; } } size_t Adafruit_SSD1306::my_strlen(const char * s) { register const char * cp; cp = s; while(*cp) { cp++; } return cp-s; } void Adafruit_SSD1306::gfx_print( const char* s ){ unsigned int len = my_strlen( s ); unsigned int i = 0; for( i = 0 ; i < len ; i++ ){ gfx_write( s[i] ); } } void Adafruit_SSD1306::gfx_println( const char* s ){ Serial.println(F("gfx_println")); gfx_print( s ); gfx_write( '\n' ); } void Adafruit_SSD1306::gfx_setTextSize( uint8_t size ){ textsize = (size > 0) ? size : 1; } ////////////////////////////////////////////////////////////// Adafruit_SSD1306::Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi, int8_t rst_pin, uint32_t clkDuring, uint32_t clkAfter) : wire(twi ? twi : &Wire), buffer(NULL), mosiPin(-1), clkPin(-1), dcPin(-1), csPin(-1), rstPin(rst_pin), wireClk(clkDuring), restoreClk(clkAfter) { } Adafruit_SSD1306::~Adafruit_SSD1306(void) { if(buffer) { free(buffer); buffer = NULL; } } void Adafruit_SSD1306::ssd1306_command1(uint8_t c) { wire->beginTransmission(i2caddr); WIRE_WRITE((uint8_t)0x00); // Co = 0, D/C = 0 WIRE_WRITE(c); wire->endTransmission(); } void Adafruit_SSD1306::ssd1306_commandList(const uint8_t *c, uint8_t n) { wire->beginTransmission(i2caddr); WIRE_WRITE((uint8_t)0x00); // Co = 0, D/C = 0 uint8_t bytesOut = 1; while(n--) { if(bytesOut >= WIRE_MAX) { wire->endTransmission(); wire->beginTransmission(i2caddr); WIRE_WRITE((uint8_t)0x00); // Co = 0, D/C = 0 bytesOut = 1; } WIRE_WRITE(pgm_read_byte(c++)); bytesOut++; } wire->endTransmission(); } void Adafruit_SSD1306::ssd1306_command(uint8_t c) { ssd1306_command1(c); } bool Adafruit_SSD1306::begin(uint8_t vcs, uint8_t addr, bool reset, bool periphBegin) { Serial.println(F("Adafruit_SSD1306::begin")); if((!buffer) && !(buffer = (uint8_t *)malloc(SCREEN_WIDTH * ((SCREEN_HEIGHT + 7) / 8)))) return false; clearDisplay(); // drawBitmap((SCREEN_WIDTH - splash1_width) / 2, (SCREEN_HEIGHT - splash1_height) / 2, // splash1_data, splash1_width, splash1_height, 1); vccstate = vcs; // Setup pin directions // Using I2C // If I2C address is unspecified, use default // (0x3C for 32-pixel-tall displays, 0x3D for all others). i2caddr = addr ? addr : ((HEIGHT == 32) ? 0x3C : 0x3D); // TwoWire begin() function might be already performed by the calling // function if it has unusual circumstances (e.g. TWI variants that // can accept different SDA/SCL pins, or if two SSD1306 instances // with different addresses -- only a single begin() is needed). if(periphBegin) wire->begin(); // Reset SSD1306 if requested and reset pin specified in constructor if(reset && (rstPin >= 0)) { pinMode( rstPin, OUTPUT); digitalWrite(rstPin, HIGH); delay(1); // VDD goes high at start, pause for 1 ms digitalWrite(rstPin, LOW); // Bring reset low delay(10); // Wait 10 ms digitalWrite(rstPin, HIGH); // Bring out of reset } // Init sequence static const uint8_t PROGMEM init1[] = { SSD1306_DISPLAYOFF, // 0xAE SSD1306_SETDISPLAYCLOCKDIV, // 0xD5 0x80, // the suggested ratio 0x80 SSD1306_SETMULTIPLEX }; // 0xA8 ssd1306_commandList(init1, sizeof(init1)); ssd1306_command1(HEIGHT - 1); static const uint8_t PROGMEM init2[] = { SSD1306_SETDISPLAYOFFSET, // 0xD3 0x0, // no offset SSD1306_SETSTARTLINE | 0x0, // line #0 SSD1306_CHARGEPUMP }; // 0x8D ssd1306_commandList(init2, sizeof(init2)); ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x10 : 0x14); static const uint8_t PROGMEM init3[] = { SSD1306_MEMORYMODE, // 0x20 0x00, // 0x0 act like ks0108 SSD1306_SEGREMAP | 0x1, SSD1306_COMSCANDEC }; ssd1306_commandList(init3, sizeof(init3)); static const uint8_t PROGMEM init4b[] = { SSD1306_SETCOMPINS, // 0xDA 0x12, SSD1306_SETCONTRAST }; // 0x81 ssd1306_commandList(init4b, sizeof(init4b)); ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x9F : 0xCF); ssd1306_command1(SSD1306_SETPRECHARGE); // 0xd9 ssd1306_command1((vccstate == SSD1306_EXTERNALVCC) ? 0x22 : 0xF1); static const uint8_t PROGMEM init5[] = { SSD1306_SETVCOMDETECT, // 0xDB 0x40, SSD1306_DISPLAYALLON_RESUME, // 0xA4 SSD1306_NORMALDISPLAY, // 0xA6 SSD1306_DEACTIVATE_SCROLL, SSD1306_DISPLAYON }; // Main screen turn on ssd1306_commandList(init5, sizeof(init5)); return true; // Success } void Adafruit_SSD1306::clearDisplay(void) { memset(buffer, 0, WIDTH * ((HEIGHT + 7) / 8)); } void Adafruit_SSD1306::display(void) { static const uint8_t PROGMEM dlist1[] = { SSD1306_PAGEADDR, 0, // Page start address 0xFF, // Page end (not really, but works here) SSD1306_COLUMNADDR, 0 }; // Column start address ssd1306_commandList(dlist1, sizeof(dlist1)); ssd1306_command1(WIDTH - 1); // Column end address uint16_t count = WIDTH * ((HEIGHT + 7) / 8); uint8_t *ptr = buffer; wire->beginTransmission(i2caddr); WIRE_WRITE((uint8_t)0x40); uint8_t bytesOut = 1; while(count--) { if(bytesOut >= WIRE_MAX) { wire->endTransmission(); wire->beginTransmission(i2caddr); WIRE_WRITE((uint8_t)0x40); bytesOut = 1; } WIRE_WRITE(*ptr++); bytesOut++; } wire->endTransmission(); }
tomo_SSD1306.h
#ifndef _tomo_SSD1306_H_ #define _tomo_SSD1306_H_ #define WIRE_WRITE wire->write ///< Wire write function in recent Arduino lib #define WIRE_MAX 32 ///< Use common Arduino core default #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels #define WIDTH SCREEN_WIDTH #define HEIGHT SCREEN_HEIGHT // OLED display height, in pixels #define _width SCREEN_WIDTH #define _height SCREEN_HEIGHT // OLED display height, in pixels #define SSD1306_BLACK 0 ///< Draw 'off' pixels #define SSD1306_WHITE 1 ///< Draw 'on' pixels #define SSD1306_INVERSE 2 ///< Invert pixels #define SSD1306_MEMORYMODE 0x20 ///< See datasheet #define SSD1306_COLUMNADDR 0x21 ///< See datasheet #define SSD1306_PAGEADDR 0x22 ///< See datasheet #define SSD1306_SETCONTRAST 0x81 ///< See datasheet #define SSD1306_CHARGEPUMP 0x8D ///< See datasheet #define SSD1306_SEGREMAP 0xA0 ///< See datasheet #define SSD1306_DISPLAYALLON_RESUME 0xA4 ///< See datasheet #define SSD1306_DISPLAYALLON 0xA5 ///< Not currently used #define SSD1306_NORMALDISPLAY 0xA6 ///< See datasheet #define SSD1306_INVERTDISPLAY 0xA7 ///< See datasheet #define SSD1306_SETMULTIPLEX 0xA8 ///< See datasheet #define SSD1306_DISPLAYOFF 0xAE ///< See datasheet #define SSD1306_DISPLAYON 0xAF ///< See datasheet #define SSD1306_COMSCANINC 0xC0 ///< Not currently used #define SSD1306_COMSCANDEC 0xC8 ///< See datasheet #define SSD1306_SETDISPLAYOFFSET 0xD3 ///< See datasheet #define SSD1306_SETDISPLAYCLOCKDIV 0xD5 ///< See datasheet #define SSD1306_SETPRECHARGE 0xD9 ///< See datasheet #define SSD1306_SETCOMPINS 0xDA ///< See datasheet #define SSD1306_SETVCOMDETECT 0xDB ///< See datasheet #define SSD1306_SETLOWCOLUMN 0x00 ///< Not currently used #define SSD1306_SETHIGHCOLUMN 0x10 ///< Not currently used #define SSD1306_SETSTARTLINE 0x40 ///< See datasheet #define SSD1306_EXTERNALVCC 0x01 ///< External display voltage source #define SSD1306_SWITCHCAPVCC 0x02 ///< Gen. display voltage from 3.3V #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 ///< Init rt scroll #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27 ///< Init left scroll #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29 ///< Init diag scroll #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A ///< Init diag scroll #define SSD1306_DEACTIVATE_SCROLL 0x2E ///< Stop scroll #define SSD1306_ACTIVATE_SCROLL 0x2F ///< Start scroll #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 ///< Set scroll range class Adafruit_SSD1306{ public: // NEW CONSTRUCTORS -- recommended for new projects Adafruit_SSD1306(uint8_t w, uint8_t h, TwoWire *twi=&Wire, int8_t rst_pin=-1, uint32_t clkDuring=400000UL, uint32_t clkAfter=100000UL); Adafruit_SSD1306(uint8_t w, uint8_t h, int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin, int8_t cs_pin); // DEPRECATED CONSTRUCTORS - for back compatibility, avoid in new projects Adafruit_SSD1306(int8_t mosi_pin, int8_t sclk_pin, int8_t dc_pin, int8_t rst_pin, int8_t cs_pin); Adafruit_SSD1306(int8_t dc_pin, int8_t rst_pin, int8_t cs_pin); Adafruit_SSD1306(int8_t rst_pin = -1); ~Adafruit_SSD1306(void); bool begin(uint8_t switchvcc=SSD1306_SWITCHCAPVCC, uint8_t i2caddr=0, bool reset=true, bool periphBegin=true); void display(void); void clearDisplay(void); void setCursor(int16_t x, int16_t y) { cursor_x = x; cursor_y = y; } void setTextColor(uint16_t c) { textcolor = textbgcolor = c; } setTextSize(uint8_t s); void drawPixel(int16_t x, int16_t y, uint16_t color); void gfx_print( const char* s ); void gfx_println( const char* s ); void gfx_setTextSize( uint8_t size ); protected: void drawBitmap(int16_t x, int16_t y,const uint8_t bitmap[], int16_t w, int16_t h, uint16_t color); void Adafruit_SSD1306::ssd1306_command1(uint8_t c); void Adafruit_SSD1306::ssd1306_commandList(const uint8_t *c, uint8_t n); void Adafruit_SSD1306::ssd1306_command(uint8_t c) ; void gfx_drawChar( int16_t x, int16_t y, unsigned char c,uint16_t color, uint16_t bg, uint8_t size); void gfx_write( uint8_t ch ); size_t my_strlen(const char * s); // SPIClass *spi; TwoWire *wire; uint8_t *buffer; uint16_t textcolor, ///< 16-bit background color for print() textbgcolor; ///< 16-bit text color for print() int16_t cursor_x, ///< x location to start print()ing text cursor_y; ///< y location to start print()ing text int8_t i2caddr, vccstate, page_end; int8_t mosiPin , clkPin , dcPin , csPin, rstPin; uint8_t textsize ; uint32_t wireClk; // Wire speed for SSD1306 transfers uint32_t restoreClk; // Wire speed following SSD1306 transfers }; #endif // _tomo_SSD1306_H_
font.h
/* * File: font.h * Author: kane4d * * Created on February 6, 2018, 7:10 AM */ #ifndef FONT5X7_H #define FONT5X7_H #ifdef __cplusplus extern "C" { #endif // Standard ASCII 5x7 font const unsigned char PROGMEM font[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00, 0x18, 0x3C, 0x18, 0x00, 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00, 0x18, 0x24, 0x18, 0x00, 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x30, 0x48, 0x3A, 0x06, 0x0E, 0x26, 0x29, 0x79, 0x29, 0x26, 0x40, 0x7F, 0x05, 0x05, 0x07, 0x40, 0x7F, 0x05, 0x25, 0x3F, 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00, 0x66, 0x89, 0x95, 0x6A, 0x60, 0x60, 0x60, 0x60, 0x60, 0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x08, 0x04, 0x7E, 0x04, 0x08, 0x10, 0x20, 0x7E, 0x20, 0x10, 0x08, 0x08, 0x2A, 0x1C, 0x08, 0x08, 0x1C, 0x2A, 0x08, 0x08, 0x1E, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x30, 0x38, 0x3E, 0x38, 0x30, 0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00, 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x23, 0x13, 0x08, 0x64, 0x62, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x08, 0x07, 0x03, 0x00, 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00, 0x41, 0x22, 0x1C, 0x00, 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 0x80, 0x70, 0x30, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x60, 0x60, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00, 0x42, 0x7F, 0x40, 0x00, 0x72, 0x49, 0x49, 0x49, 0x46, 0x21, 0x41, 0x49, 0x4D, 0x33, 0x18, 0x14, 0x12, 0x7F, 0x10, 0x27, 0x45, 0x45, 0x45, 0x39, 0x3C, 0x4A, 0x49, 0x49, 0x31, 0x41, 0x21, 0x11, 0x09, 0x07, 0x36, 0x49, 0x49, 0x49, 0x36, 0x46, 0x49, 0x49, 0x29, 0x1E, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x40, 0x34, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x41, 0x22, 0x14, 0x08, 0x02, 0x01, 0x59, 0x09, 0x06, 0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x7F, 0x49, 0x49, 0x49, 0x36, 0x3E, 0x41, 0x41, 0x41, 0x22, 0x7F, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x49, 0x49, 0x49, 0x41, 0x7F, 0x09, 0x09, 0x09, 0x01, 0x3E, 0x41, 0x41, 0x51, 0x73, 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00, 0x41, 0x7F, 0x41, 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01, 0x7F, 0x08, 0x14, 0x22, 0x41, 0x7F, 0x40, 0x40, 0x40, 0x40, 0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x7F, 0x09, 0x09, 0x09, 0x06, 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x7F, 0x09, 0x19, 0x29, 0x46, 0x26, 0x49, 0x49, 0x49, 0x32, 0x03, 0x01, 0x7F, 0x01, 0x03, 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x63, 0x14, 0x08, 0x14, 0x63, 0x03, 0x04, 0x78, 0x04, 0x03, 0x61, 0x59, 0x49, 0x4D, 0x43, 0x00, 0x7F, 0x41, 0x41, 0x41, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x41, 0x41, 0x41, 0x7F, 0x04, 0x02, 0x01, 0x02, 0x04, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x03, 0x07, 0x08, 0x00, 0x20, 0x54, 0x54, 0x78, 0x40, 0x7F, 0x28, 0x44, 0x44, 0x38, 0x38, 0x44, 0x44, 0x44, 0x28, 0x38, 0x44, 0x44, 0x28, 0x7F, 0x38, 0x54, 0x54, 0x54, 0x18, 0x00, 0x08, 0x7E, 0x09, 0x02, 0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x7F, 0x08, 0x04, 0x04, 0x78, 0x00, 0x44, 0x7D, 0x40, 0x00, 0x20, 0x40, 0x40, 0x3D, 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00, 0x7C, 0x04, 0x78, 0x04, 0x78, 0x7C, 0x08, 0x04, 0x04, 0x78, 0x38, 0x44, 0x44, 0x44, 0x38, 0xFC, 0x18, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x18, 0xFC, 0x7C, 0x08, 0x04, 0x04, 0x08, 0x48, 0x54, 0x54, 0x54, 0x24, 0x04, 0x04, 0x3F, 0x44, 0x24, 0x3C, 0x40, 0x40, 0x20, 0x7C, 0x1C, 0x20, 0x40, 0x20, 0x1C, 0x3C, 0x40, 0x30, 0x40, 0x3C, 0x44, 0x28, 0x10, 0x28, 0x44, 0x4C, 0x90, 0x90, 0x90, 0x7C, 0x44, 0x64, 0x54, 0x4C, 0x44, 0x00, 0x08, 0x36, 0x41, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x41, 0x36, 0x08, 0x00, 0x02, 0x01, 0x02, 0x04, 0x02, 0x3C, 0x26, 0x23, 0x26, 0x3C, 0x1E, 0xA1, 0xA1, 0x61, 0x12, 0x3A, 0x40, 0x40, 0x20, 0x7A, 0x38, 0x54, 0x54, 0x55, 0x59, 0x21, 0x55, 0x55, 0x79, 0x41, 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut 0x21, 0x55, 0x54, 0x78, 0x40, 0x20, 0x54, 0x55, 0x79, 0x40, 0x0C, 0x1E, 0x52, 0x72, 0x12, 0x39, 0x55, 0x55, 0x55, 0x59, 0x39, 0x54, 0x54, 0x54, 0x59, 0x39, 0x55, 0x54, 0x54, 0x58, 0x00, 0x00, 0x45, 0x7C, 0x41, 0x00, 0x02, 0x45, 0x7D, 0x42, 0x00, 0x01, 0x45, 0x7C, 0x40, 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut 0xF0, 0x28, 0x25, 0x28, 0xF0, 0x7C, 0x54, 0x55, 0x45, 0x00, 0x20, 0x54, 0x54, 0x7C, 0x54, 0x7C, 0x0A, 0x09, 0x7F, 0x49, 0x32, 0x49, 0x49, 0x49, 0x32, 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut 0x32, 0x4A, 0x48, 0x48, 0x30, 0x3A, 0x41, 0x41, 0x21, 0x7A, 0x3A, 0x42, 0x40, 0x20, 0x78, 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut 0x3D, 0x40, 0x40, 0x40, 0x3D, 0x3C, 0x24, 0xFF, 0x24, 0x24, 0x48, 0x7E, 0x49, 0x43, 0x66, 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 0xFF, 0x09, 0x29, 0xF6, 0x20, 0xC0, 0x88, 0x7E, 0x09, 0x03, 0x20, 0x54, 0x54, 0x79, 0x41, 0x00, 0x00, 0x44, 0x7D, 0x41, 0x30, 0x48, 0x48, 0x4A, 0x32, 0x38, 0x40, 0x40, 0x22, 0x7A, 0x00, 0x7A, 0x0A, 0x0A, 0x72, 0x7D, 0x0D, 0x19, 0x31, 0x7D, 0x26, 0x29, 0x29, 0x2F, 0x28, 0x26, 0x29, 0x29, 0x29, 0x26, 0x30, 0x48, 0x4D, 0x40, 0x20, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 0x2F, 0x10, 0x28, 0x34, 0xFA, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x08, 0x14, 0x2A, 0x14, 0x22, 0x22, 0x14, 0x2A, 0x14, 0x08, 0xAA, 0x00, 0x55, 0x00, 0xAA, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x10, 0x10, 0x10, 0xFF, 0x00, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x10, 0x10, 0xFF, 0x00, 0xFF, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10, 0xF0, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xFF, 0x10, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14, 0x14, 0x17, 0x14, 0x10, 0x10, 0x1F, 0x10, 0x1F, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x10, 0x10, 0xF0, 0x10, 0xF0, 0x00, 0x00, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x00, 0x00, 0xF0, 0x10, 0xF0, 0x10, 0x10, 0xFF, 0x10, 0xFF, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x38, 0x44, 0x44, 0x38, 0x44, 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta 0x7E, 0x02, 0x02, 0x06, 0x06, 0x02, 0x7E, 0x02, 0x7E, 0x02, 0x63, 0x55, 0x49, 0x41, 0x63, 0x38, 0x44, 0x44, 0x3C, 0x04, 0x40, 0x7E, 0x20, 0x1E, 0x20, 0x06, 0x02, 0x7E, 0x02, 0x02, 0x99, 0xA5, 0xE7, 0xA5, 0x99, 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 0x4C, 0x72, 0x01, 0x72, 0x4C, 0x30, 0x4A, 0x4D, 0x4D, 0x30, 0x30, 0x48, 0x78, 0x48, 0x30, 0xBC, 0x62, 0x5A, 0x46, 0x3D, 0x3E, 0x49, 0x49, 0x49, 0x00, 0x7E, 0x01, 0x01, 0x01, 0x7E, 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 0x44, 0x44, 0x5F, 0x44, 0x44, 0x40, 0x51, 0x4A, 0x44, 0x40, 0x40, 0x44, 0x4A, 0x51, 0x40, 0x00, 0x00, 0xFF, 0x01, 0x03, 0xE0, 0x80, 0xFF, 0x00, 0x00, 0x08, 0x08, 0x6B, 0x6B, 0x08, 0x36, 0x12, 0x36, 0x24, 0x36, 0x06, 0x0F, 0x09, 0x0F, 0x06, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x30, 0x40, 0xFF, 0x01, 0x01, 0x00, 0x1F, 0x01, 0x01, 0x1E, 0x00, 0x19, 0x1D, 0x17, 0x12, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00 }; /* [] END OF FILE */ #ifdef __cplusplus } #endif #endif // FONT5X7_H
プログラムの実行結果
プログラムを実行するとOLEDディスプレイ「SSD1306」に次のように表示されます。