AQM1248A LCD + GT20L16J1Y Japanese font ROM with Nucleo

Dependencies:   GT20L16J1Y_font aqm1248a_lcd mbed

Fork of Nucleo_AQM1248A by Masato YAMANISHI

/media/uploads/masato/gt20l16j1y.jpg

STM32 Nucleo L152RE/mbed と Freescale FRDM-KL05Z で秋月 AQM1248A グラフィック LCD をドライブに日本語フォントROM、GT20L16J1Y_font を追加。雪だるまの人GT20L16J1Y_font ライブラリとUTF-8によるサンプルを流用。

フォントROMのほうはLCDとは別系統のSPIを使用。SPI 信号線にはプルアップ抵抗を付けている(裏面にチップ抵抗)。LCDドライバに組み込んで同じSPIを使うのもありかも。

STM32 Nucleo ボードの電源のページにも書いた通り、Nucleo ボードで USB で電源だけを供給する場合には SB1 をショートします。

main.cpp

Committer:
masato
Date:
2014-04-27
Revision:
2:862f6ab24cfc
Parent:
0:69bb996225c1
Child:
3:93270b9f6a01

File content as of revision 2:862f6ab24cfc:

#include "mbed.h"
#include "aqm1248a_lcd.h"

aqm1248a_lcd lcd;

const static 
char mbedlogo128x48[768]
= {
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc7,0x83,0xe0,0x3c,0x7c,0x00,0x7e,0x00,0x3e,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xdf,0xef,0xf8,0x3d,0xfe,0x01,0xff,0x80,0x7f,0xbc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xff,0xff,0xf8,0x3f,0xff,0x03,0xff,0xc0,0xff,0xfc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xf1,0xfc,0x7c,0x3f,0x0f,0x87,0xc3,0xe1,0xf0,0xfc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xe0,0xf8,0x3c,0x3e,0x07,0x87,0x81,0xe1,0xe0,0x7c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0x00,0xe3,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0x00,0xf3,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0xff,0xf3,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0xff,0xf3,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0xff,0xf3,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0x03,0xcf,0x00,0x03,0xc0,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3e,0x03,0xcf,0x00,0x03,0xc0,0x7c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3e,0x07,0x87,0x80,0x01,0xe0,0x7c,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3f,0x0f,0x87,0xc1,0xc1,0xf0,0xfc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3f,0xff,0x03,0xff,0xf0,0xff,0xfc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3d,0xfe,0x01,0xff,0xe0,0x7f,0xbc,0x00,0x00,0x00,
   0x00,0x00,0x03,0xc0,0xf0,0x3c,0x3c,0xfc,0x00,0x7f,0x00,0x3f,0x3c,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
   0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};


const static struct Bitmap logo = {
  128,
  48,
  16,
  (char*)mbedlogo128x48,
};

const char target[] = 
#if defined(TARGET_NUCLEO_L152RE)
"STM32 Nucleo L152RE"
#elif defined(TARGET_KL05Z)
"Freescale FRDM-KL05Z"
#else
"????"
#endif
;

int main() {
    printf("%s\r\n", target);
    lcd.setmode(NORMAL);
    // lcd.set_font((unsigned char*) Arial_9);
    lcd.set_contrast(25);
    while (1) {
        lcd.cls();
        lcd.locate(0,0);
        lcd.printf("\r\n %s!\r\n This is AQM1248A demo.", target);

        wait(1);
        lcd.line(0, 0, lcd.width()-1, 0, 1);
        lcd.line(0, 0, lcd.width()-1, lcd.height()-1, 1);
        lcd.line(0, 0, 0, lcd.height()-1, 1);
        wait(1);
        lcd.circle(12, 32, 10, 1);
        lcd.fillcircle(24, 32, 10, 1);
        lcd.rect(36, 32, 48, 44, 1);
        lcd.fillrect(60, 32, 72, 44, 1);
        wait(1);
        lcd.print_bm(logo, 0, 0);
        // lcd.copy_to_lcd();
        lcd.printf("\r\n\r\n  %s", target);
        
        wait(12);
    }
}