Revision 0:279a3320c2c0, committed 2009-12-03
- Comitter:
- Sim
- Date:
- Thu Dec 03 17:18:33 2009 +0000
- Commit message:
Changed in this revision
diff -r 000000000000 -r 279a3320c2c0 font4.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/font4.h Thu Dec 03 17:18:33 2009 +0000
@@ -0,0 +1,258 @@
+const unsigned char font4[4*256] = {
+ 0x00, 0x00, 0x00, 0x00, // 00
+ 0x00, 0x00, 0x00, 0x00, // 01
+ 0x00, 0x00, 0x00, 0x00, // 02
+ 0x00, 0x00, 0x00, 0x00, // 03
+ 0x00, 0x00, 0x00, 0x00, // 04
+ 0x00, 0x00, 0x00, 0x00, // 05
+ 0x00, 0x00, 0x00, 0x00, // 06
+ 0x00, 0x00, 0x00, 0x00, // 07
+ 0x00, 0x00, 0x00, 0x00, // 08
+ 0x00, 0x00, 0x00, 0x00, // 09
+ 0x00, 0x00, 0x00, 0x00, // 0a
+ 0x00, 0x00, 0x00, 0x00, // 0b
+ 0x00, 0x00, 0x00, 0x00, // 0c
+ 0x00, 0x00, 0x00, 0x00, // 0d
+ 0x00, 0x00, 0x00, 0x00, // 0e
+ 0x00, 0x00, 0x00, 0x00, // 0f
+ 0x00, 0x00, 0x00, 0x00, // 10
+ 0x00, 0x00, 0x00, 0x00, // 11
+ 0x00, 0x00, 0x00, 0x00, // 12
+ 0x00, 0x00, 0x00, 0x00, // 13
+ 0x00, 0x00, 0x00, 0x00, // 14
+ 0x00, 0x00, 0x00, 0x00, // 15
+ 0x00, 0x00, 0x00, 0x00, // 16
+ 0x00, 0x00, 0x00, 0x00, // 17
+ 0x00, 0x00, 0x00, 0x00, // 18
+ 0x00, 0x00, 0x00, 0x00, // 19
+ 0x00, 0x00, 0x00, 0x00, // 1a
+ 0x00, 0x00, 0x00, 0x00, // 1b
+ 0x00, 0x00, 0x00, 0x00, // 1c
+ 0x00, 0x00, 0x00, 0x00, // 1d
+ 0x00, 0x00, 0x00, 0x00, // 1e
+ 0x00, 0x00, 0x00, 0x00, // 1f
+ 0x00, 0x00, 0x00, 0x00, // 20
+ 0x00, 0x5e, 0x00, 0x00, // 21
+ 0x06, 0x00, 0x06, 0x00, // 22
+ 0x7e, 0x24, 0x7e, 0x00, // 23
+ 0x2c, 0x7e, 0x34, 0x00, // 24
+ 0x24, 0x10, 0x48, 0x00, // 25
+ 0x64, 0x7a, 0x54, 0x00, // 26
+ 0x04, 0x02, 0x00, 0x00, // 27
+ 0x00, 0x7c, 0x82, 0x00, // 28
+ 0x82, 0x7c, 0x00, 0x00, // 29
+ 0x14, 0x0e, 0x14, 0x00, // 2a
+ 0x10, 0x7c, 0x10, 0x00, // 2b
+ 0x00, 0x80, 0x40, 0x00, // 2c
+ 0x10, 0x10, 0x10, 0x00, // 2d
+ 0x00, 0x40, 0x00, 0x00, // 2e
+ 0x20, 0x10, 0x08, 0x00, // 2f
+ 0x38, 0x54, 0x38, 0x00, // 30
+ 0x48, 0x7c, 0x40, 0x00, // 31
+ 0x64, 0x54, 0x48, 0x00, // 32
+ 0x44, 0x54, 0x28, 0x00, // 33
+ 0x30, 0x28, 0x7c, 0x00, // 34
+ 0x5c, 0x54, 0x24, 0x00, // 35
+ 0x38, 0x54, 0x24, 0x00, // 36
+ 0x04, 0x74, 0x0c, 0x00, // 37
+ 0x28, 0x54, 0x28, 0x00, // 38
+ 0x48, 0x54, 0x38, 0x00, // 39
+ 0x00, 0x28, 0x00, 0x00, // 3a
+ 0x40, 0x28, 0x00, 0x00, // 3b
+ 0x10, 0x28, 0x44, 0x00, // 3c
+ 0x28, 0x28, 0x28, 0x00, // 3d
+ 0x44, 0x28, 0x10, 0x00, // 3e
+ 0x04, 0x52, 0x0c, 0x00, // 3f
+ 0x24, 0x52, 0x3c, 0x00, // 40
+ 0x7c, 0x12, 0x7c, 0x00, // 41
+ 0x7e, 0x4a, 0x34, 0x00, // 42
+ 0x3c, 0x42, 0x42, 0x00, // 43
+ 0x7e, 0x42, 0x3c, 0x00, // 44
+ 0x7e, 0x4a, 0x42, 0x00, // 45
+ 0x7e, 0x0a, 0x02, 0x00, // 46
+ 0x3c, 0x42, 0x72, 0x00, // 47
+ 0x7e, 0x10, 0x7e, 0x00, // 48
+ 0x42, 0x7e, 0x42, 0x00, // 49
+ 0x20, 0x40, 0x3e, 0x00, // 4a
+ 0x7e, 0x08, 0x76, 0x00, // 4b
+ 0x7e, 0x40, 0x40, 0x00, // 4c
+ 0x7e, 0x0c, 0x7e, 0x00, // 4d
+ 0x7e, 0x02, 0x7c, 0x00, // 4e
+ 0x3c, 0x42, 0x3c, 0x00, // 4f
+ 0x7e, 0x12, 0x0c, 0x00, // 50
+ 0x3c, 0x42, 0xbc, 0x00, // 51
+ 0x7e, 0x12, 0x6c, 0x00, // 52
+ 0x44, 0x4a, 0x32, 0x00, // 53
+ 0x02, 0x7e, 0x02, 0x00, // 54
+ 0x7e, 0x40, 0x7e, 0x00, // 55
+ 0x7e, 0x20, 0x1e, 0x00, // 56
+ 0x7e, 0x30, 0x7e, 0x00, // 57
+ 0x66, 0x18, 0x66, 0x00, // 58
+ 0x06, 0x78, 0x06, 0x00, // 59
+ 0x62, 0x5a, 0x46, 0x00, // 5a
+ 0x00, 0xfe, 0x82, 0x00, // 5b
+ 0x2a, 0x7c, 0x2a, 0x00, // 5c
+ 0x82, 0xfe, 0x00, 0x00, // 5d
+ 0x04, 0x02, 0x04, 0x00, // 5e
+ 0x80, 0x80, 0x80, 0x00, // 5f
+ 0x00, 0x02, 0x04, 0x00, // 60
+ 0x30, 0x48, 0x78, 0x00, // 61
+ 0x7e, 0x48, 0x30, 0x00, // 62
+ 0x30, 0x48, 0x48, 0x00, // 63
+ 0x30, 0x48, 0x7e, 0x00, // 64
+ 0x30, 0x58, 0x58, 0x00, // 65
+ 0x08, 0x7e, 0x0a, 0x00, // 66
+ 0x90, 0xa8, 0x78, 0x00, // 67
+ 0x7e, 0x08, 0x70, 0x00, // 68
+ 0x00, 0x7a, 0x00, 0x00, // 69
+ 0x80, 0x7a, 0x00, 0x00, // 6a
+ 0x7e, 0x10, 0x68, 0x00, // 6b
+ 0x02, 0x7e, 0x00, 0x00, // 6c
+ 0x78, 0x38, 0x70, 0x00, // 6d
+ 0x78, 0x08, 0x70, 0x00, // 6e
+ 0x30, 0x48, 0x30, 0x00, // 6f
+ 0xf8, 0x48, 0x30, 0x00, // 70
+ 0x30, 0x48, 0xf8, 0x00, // 71
+ 0x78, 0x10, 0x08, 0x00, // 72
+ 0x50, 0x78, 0x28, 0x00, // 73
+ 0x08, 0x7c, 0x48, 0x00, // 74
+ 0x78, 0x40, 0x78, 0x00, // 75
+ 0x78, 0x20, 0x18, 0x00, // 76
+ 0x78, 0x60, 0x78, 0x00, // 77
+ 0x48, 0x30, 0x48, 0x00, // 78
+ 0x98, 0xa0, 0x78, 0x00, // 79
+ 0x48, 0x68, 0x58, 0x00, // 7a
+ 0x10, 0x6c, 0x82, 0x00, // 7b
+ 0x00, 0xfe, 0x00, 0x00, // 7c
+ 0x82, 0x6c, 0x10, 0x00, // 7d
+ 0x02, 0x02, 0x02, 0x00, // 7e
+ 0x00, 0x00, 0x00, 0x00, // 7f
+ 0x00, 0x00, 0x00, 0x00, // 80
+ 0x00, 0x00, 0x00, 0x00, // 81
+ 0x00, 0x00, 0x00, 0x00, // 82
+ 0x00, 0x00, 0x00, 0x00, // 83
+ 0x00, 0x00, 0x00, 0x00, // 84
+ 0x00, 0x00, 0x00, 0x00, // 85
+ 0x00, 0x00, 0x00, 0x00, // 86
+ 0x00, 0x00, 0x00, 0x00, // 87
+ 0x00, 0x00, 0x00, 0x00, // 88
+ 0x00, 0x00, 0x00, 0x00, // 89
+ 0x00, 0x00, 0x00, 0x00, // 8a
+ 0x00, 0x00, 0x00, 0x00, // 8b
+ 0x00, 0x00, 0x00, 0x00, // 8c
+ 0x00, 0x00, 0x00, 0x00, // 8d
+ 0x00, 0x00, 0x00, 0x00, // 8e
+ 0x00, 0x00, 0x00, 0x00, // 8f
+ 0x00, 0x00, 0x00, 0x00, // 90
+ 0x00, 0x00, 0x00, 0x00, // 91
+ 0x00, 0x00, 0x00, 0x00, // 92
+ 0x00, 0x00, 0x00, 0x00, // 93
+ 0x00, 0x00, 0x00, 0x00, // 94
+ 0x00, 0x00, 0x00, 0x00, // 95
+ 0x00, 0x00, 0x00, 0x00, // 96
+ 0x00, 0x00, 0x00, 0x00, // 97
+ 0x00, 0x00, 0x00, 0x00, // 98
+ 0x00, 0x00, 0x00, 0x00, // 99
+ 0x00, 0x00, 0x00, 0x00, // 9a
+ 0x00, 0x00, 0x00, 0x00, // 9b
+ 0x00, 0x00, 0x00, 0x00, // 9c
+ 0x00, 0x00, 0x00, 0x00, // 9d
+ 0x00, 0x00, 0x00, 0x00, // 9e
+ 0x00, 0x00, 0x00, 0x00, // 9f
+ 0x00, 0x00, 0x00, 0x00, // a0
+ 0x20, 0x50, 0x20, 0x00, // a1
+ 0x3e, 0x02, 0x02, 0x00, // a2
+ 0x40, 0x40, 0x7c, 0x00, // a3
+ 0x20, 0x40, 0x00, 0x00, // a4
+ 0x00, 0x10, 0x00, 0x00, // a5
+ 0x4a, 0x2a, 0x1e, 0x00, // a6
+ 0x48, 0x38, 0x18, 0x00, // a7
+ 0x20, 0x70, 0x08, 0x00, // a8
+ 0x30, 0x18, 0x70, 0x00, // a9
+ 0x50, 0x70, 0x50, 0x00, // aa
+ 0x50, 0x30, 0x78, 0x00, // ab
+ 0x10, 0x78, 0x30, 0x00, // ac
+ 0x50, 0x70, 0x40, 0x00, // ad
+ 0x48, 0x58, 0x78, 0x00, // ae
+ 0x58, 0x58, 0x38, 0x00, // af
+ 0x08, 0x10, 0x10, 0x00, // b0
+ 0x42, 0x3a, 0x0e, 0x00, // b1
+ 0x10, 0x78, 0x06, 0x00, // b2
+ 0x0c, 0x46, 0x3c, 0x00, // b3
+ 0x44, 0x7c, 0x44, 0x00, // b4
+ 0x24, 0x14, 0x7e, 0x00, // b5
+ 0x64, 0x1e, 0x7c, 0x00, // b6
+ 0x14, 0x7e, 0x14, 0x00, // b7
+ 0x48, 0x26, 0x1c, 0x00, // b8
+ 0x4e, 0x3c, 0x04, 0x00, // b9
+ 0x44, 0x44, 0x7c, 0x00, // ba
+ 0x4e, 0x24, 0x1e, 0x00, // bb
+ 0x4a, 0x4a, 0x20, 0x00, // bc
+ 0x42, 0x32, 0x4e, 0x00, // bd
+ 0x7e, 0x44, 0x5c, 0x00, // be
+ 0x42, 0x2c, 0x1e, 0x00, // bf
+ 0x48, 0x36, 0x1c, 0x00, // c0
+ 0x4a, 0x3e, 0x0a, 0x00, // c1
+ 0x4c, 0x4c, 0x3c, 0x00, // c2
+ 0x4a, 0x3a, 0x0a, 0x00, // c3
+ 0x7e, 0x08, 0x10, 0x00, // c4
+ 0x48, 0x3e, 0x08, 0x00, // c5
+ 0x40, 0x44, 0x44, 0x00, // c6
+ 0x4a, 0x32, 0x4e, 0x00, // c7
+ 0x24, 0x76, 0x2c, 0x00, // c8
+ 0x40, 0x20, 0x1e, 0x00, // c9
+ 0x78, 0x02, 0x7c, 0x00, // ca
+ 0x3e, 0x48, 0x48, 0x00, // cb
+ 0x42, 0x22, 0x1e, 0x00, // cc
+ 0x18, 0x06, 0x38, 0x00, // cd
+ 0x34, 0x7e, 0x34, 0x00, // ce
+ 0x12, 0x32, 0x4e, 0x00, // cf
+ 0x44, 0x54, 0x54, 0x00, // d0
+ 0x70, 0x4e, 0x60, 0x00, // d1
+ 0x64, 0x18, 0x26, 0x00, // d2
+ 0x0a, 0x7e, 0x4a, 0x00, // d3
+ 0x04, 0x7e, 0x1c, 0x00, // d4
+ 0x42, 0x7e, 0x40, 0x00, // d5
+ 0x4a, 0x4a, 0x7e, 0x00, // d6
+ 0x4a, 0x4a, 0x3a, 0x00, // d7
+ 0x0e, 0x40, 0x3e, 0x00, // d8
+ 0x78, 0x7e, 0x40, 0x00, // d9
+ 0x7e, 0x40, 0x20, 0x00, // da
+ 0x7c, 0x44, 0x7c, 0x00, // db
+ 0x46, 0x22, 0x1e, 0x00, // dc
+ 0x42, 0x42, 0x30, 0x00, // dd
+ 0x02, 0x00, 0x02, 0x00, // de
+ 0x04, 0x0a, 0x04, 0x00, // df
+ 0x00, 0x00, 0x00, 0x00, // e0
+ 0x00, 0x00, 0x00, 0x00, // e1
+ 0x00, 0x00, 0x00, 0x00, // e2
+ 0x00, 0x00, 0x00, 0x00, // e3
+ 0x00, 0x00, 0x00, 0x00, // e4
+ 0x00, 0x00, 0x00, 0x00, // e5
+ 0x00, 0x00, 0x00, 0x00, // e6
+ 0x00, 0x00, 0x00, 0x00, // e7
+ 0x00, 0x00, 0x00, 0x00, // e8
+ 0x00, 0x00, 0x00, 0x00, // e9
+ 0x00, 0x00, 0x00, 0x00, // ea
+ 0x00, 0x00, 0x00, 0x00, // eb
+ 0x00, 0x00, 0x00, 0x00, // ec
+ 0x00, 0x00, 0x00, 0x00, // ed
+ 0x00, 0x00, 0x00, 0x00, // ee
+ 0x00, 0x00, 0x00, 0x00, // ef
+ 0x00, 0x00, 0x00, 0x00, // f0
+ 0x00, 0x00, 0x00, 0x00, // f1
+ 0x00, 0x00, 0x00, 0x00, // f2
+ 0x00, 0x00, 0x00, 0x00, // f3
+ 0x00, 0x00, 0x00, 0x00, // f4
+ 0x00, 0x00, 0x00, 0x00, // f5
+ 0x00, 0x00, 0x00, 0x00, // f6
+ 0x00, 0x00, 0x00, 0x00, // f7
+ 0x00, 0x00, 0x00, 0x00, // f8
+ 0x00, 0x00, 0x00, 0x00, // f9
+ 0x00, 0x00, 0x00, 0x00, // fa
+ 0x00, 0x00, 0x00, 0x00, // fb
+ 0x00, 0x00, 0x00, 0x00, // fc
+ 0x00, 0x00, 0x00, 0x00, // fd
+ 0x00, 0x00, 0x00, 0x00, // fe
+ 0x00, 0x00, 0x00, 0x00, // ff
+};
diff -r 000000000000 -r 279a3320c2c0 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Dec 03 17:18:33 2009 +0000
@@ -0,0 +1,116 @@
+// AD-12864-SPI test program
+// About AD-12864-SPI, see http://www.aitendo.co.jp/product/1622.
+
+// Pin allocation
+// 1 p21 #CS1 with 10k ohm pull-up
+// 2 p22 #RESET with 10k ohm pull-up
+// 3 p23 A0 ... 0:command 1:data
+// 4 p13 SCK
+// 5 p11 MOSI
+// 6 Vdd
+// 7 Vss
+// 8 NC LED_A
+
+#include "mbed.h"
+#include "font4.h"
+
+DigitalOut cs(p21);
+DigitalOut rst(p22);
+DigitalOut a0(p23);
+SPI spi(p11, p12, p13); // mosi, miso, sclk
+
+void regwrite(unsigned char c){
+ cs = a0 = 0;
+ spi.write(c);
+ cs = 1;
+}
+
+void datawrite(unsigned char c){
+ cs = 0;
+ a0 = 1;
+ spi.write(c);
+ cs = 1;
+}
+
+// set position (x, 8*y)
+void locate(int x, int y){
+ regwrite(0xb0 | (y & 0x0f)); // Page Address Set (see 2.4.3)
+ regwrite(0x10 | (x >> 4 & 0x0f)); // Column Address Set (see 2.4.4)
+ regwrite(x & 0x0f);
+}
+
+void cls(void){
+ int x, y;
+ for(y = 0; y < 8; y++){
+ locate(0, y);
+ for(x = 0; x < 128; x++) datawrite(0x00);
+ }
+}
+
+void plot(int x, int y){
+ locate(x, y >> 3);
+ datawrite(1 << (y & 7));
+}
+
+void init(){
+ spi.format(8,0); // nazo
+ spi.frequency(10000000); // modify later
+
+ // reset
+ wait_ms(200);
+ rst = 0;
+ wait_ms(200);
+ rst = 1;
+
+ // initialize sequence
+ regwrite(0xaf); // display on (see 2.4.1)
+ regwrite(0x2f); // power control set (see 2.4.16)
+ regwrite(0x81); // set electronic volume mode (see 2.4.18)
+// regwrite(0x1f); // electronic volume data 00-3f
+ regwrite(0x00); // electronic volume data 00-3f
+ regwrite(0x27); // V5 Volatge Regulator Internal Resister Ratio Set (see 2.4.17)
+ regwrite(0xa2); // LCD Bias Set ... 1/9 bias (see 2.4.11)
+ regwrite(0xc8); // Common Output Mode Select ... Reverse (see 2.4.15)
+ regwrite(0xa0); // ADC Select ... Normal (see 2.4.8)
+ regwrite(0xa4); // Display All Points ON/OFF ... normal (see 2.4.10)
+ regwrite(0xa6); // Display Normal/Reverse ... normal (see 2.4.9)
+ regwrite(0xac); // Static Indicator ... off (see 2.4.19)
+ regwrite(0x00); // off
+ regwrite(0x40); // Display Strat Line Set ... 0 (see 2.4.2)
+ regwrite(0xe0); // Write Mode Set
+}
+
+void drawchar(unsigned char c){
+ const unsigned char *p = &font4[c << 2];
+ datawrite(p[0]);
+ datawrite(p[1]);
+ datawrite(p[2]);
+ datawrite(p[3]);
+}
+
+void drawtext(const char *s){
+ unsigned char c;
+ while((c = *s++) != '\0') drawchar(c);
+}
+
+int main() {
+ int x, y, c;
+ char buf[16];
+
+ init();
+ cls();
+
+ locate(0, 0);
+ sprintf(buf, "%08x", 0xdeadbeef);
+ drawtext(buf);
+ wait_ms(2000);
+
+ c = 0;
+ for(y = 0; y < 8; y++){
+ locate(0, y);
+ for(x = 0; x < 32; x++) drawchar(c++);
+ }
+ while(1) ;
+
+
+}
diff -r 000000000000 -r 279a3320c2c0 mbed.bld
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld Thu Dec 03 17:18:33 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/49a220cc26e0