AD-128160-UART制御用のライブラリ http://mbed.org/users/nucho/libraries/AD128160/m24mml を試してみるシンプルなプログラムです。 === image === {{http://farm8.staticflickr.com/7028/6496821539_333a08b551.jpg}} === circuit === {{http://farm8.staticflickr.com/7164/6498120233_a004e4fe29.jpg}}

Dependencies:   mbed AD128160

Committer:
nucho
Date:
Tue Dec 13 15:38:11 2011 +0000
Revision:
1:edf1eade7570
Parent:
0:4e906b12a024

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nucho 0:4e906b12a024 1 #include "mbed.h"
nucho 0:4e906b12a024 2 #include "AD128160.h"
nucho 0:4e906b12a024 3
nucho 0:4e906b12a024 4 AD128160 lcd(p9,p20);
nucho 0:4e906b12a024 5
nucho 1:edf1eade7570 6 int rgb565(int r, int g,int b) {
nucho 0:4e906b12a024 7 int rgb;
nucho 1:edf1eade7570 8
nucho 0:4e906b12a024 9 rgb = (r & 0xF8) << 8; /* RRRRR----------- */
nucho 0:4e906b12a024 10 rgb |= (g & 0xFC) << 3; /* -----GGGGGG----- */
nucho 0:4e906b12a024 11 rgb |= b >> 3; /* -----------BBBBB */
nucho 1:edf1eade7570 12
nucho 0:4e906b12a024 13 return rgb;
nucho 0:4e906b12a024 14 }
nucho 0:4e906b12a024 15
nucho 0:4e906b12a024 16 int main() {
nucho 1:edf1eade7570 17 lcd.textBackground(1,rgb565(255,0,0));
nucho 1:edf1eade7570 18
nucho 0:4e906b12a024 19 lcd.locate(2,lcd.rows()/2);
nucho 0:4e906b12a024 20 lcd.printf("Hello World!\n");
nucho 1:edf1eade7570 21
nucho 0:4e906b12a024 22 lcd.color(rgb565(0,255,0));
nucho 0:4e906b12a024 23 lcd.box(12,76,116,100,0);
nucho 0:4e906b12a024 24 lcd.box(8,120,124,146,1);
nucho 1:edf1eade7570 25
nucho 0:4e906b12a024 26 lcd.color(rgb565(255,0,0));
nucho 0:4e906b12a024 27 lcd.circle(16,40,16,0);
nucho 0:4e906b12a024 28 lcd.circle(48,40,16,1);
nucho 0:4e906b12a024 29 lcd.circle(80,40,16,1);
nucho 0:4e906b12a024 30 lcd.circle(112,40,16,0);
nucho 0:4e906b12a024 31 }