-
Notifications
You must be signed in to change notification settings - Fork 15
/
AVR Bitmap U8G2 ST7920
172 lines (150 loc) · 8.93 KB
/
AVR Bitmap U8G2 ST7920
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
XBM.ino
This will display a XBM image (generated by GIMP).
The .xbm file was pasted directly into the .ino file and moved to
flash (PROGMEM) area.
Universal 8bit Graphics Library (https://github.com/olikraus/u8g2/)
Copyright (c) 2016, olikraus@gmail.com
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* The OSHW AVR Transistor Tester project does not use the U8G2 Library or the Arduino Project IDE. I simply used a bitmap I created from scratch in GIMP to
* test my own example on my device. -Jake
*/
#include <Arduino.h>
#include <U8g2lib.h>
#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
U8G2_ST7920_128X64_1_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13 /* A4 */ , /* data=*/ 11 /* A2 */, /* CS=*/ 12 /* A3 */, /* reset=*/ 10);
#define u8g2_logo_128x64_width 128
#define u8g2_logo_128x64_height 64
static const unsigned char u8g2_logo_128x64_bits[] U8X8_PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x06, 0xfb, 0xe0, 0x0f, 0x00, 0x00, 0x20,
0x40, 0x00, 0x00, 0xfc, 0x01, 0x40, 0x00, 0x00, 0x70, 0x8c, 0xf9, 0x01,
0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x20, 0x00, 0x40, 0x00, 0x00,
0xd8, 0x8c, 0x99, 0x01, 0xe1, 0x1d, 0x0f, 0x27, 0xce, 0xe3, 0x78, 0x20,
0x1c, 0xce, 0xe3, 0x78, 0xd8, 0xdc, 0xf9, 0x01, 0x21, 0x20, 0x91, 0x20,
0x41, 0x10, 0x09, 0x20, 0x22, 0x41, 0x10, 0x09, 0xfc, 0xd9, 0xf8, 0x00,
0x21, 0x38, 0x91, 0x21, 0x43, 0x10, 0x09, 0x20, 0x3e, 0x43, 0xf0, 0x09,
0xfc, 0xd9, 0xd8, 0x00, 0x21, 0x24, 0x11, 0x26, 0x4c, 0x10, 0x09, 0x20,
0x02, 0x4c, 0x10, 0x08, 0x8c, 0x71, 0x98, 0x01, 0x21, 0x24, 0x11, 0x24,
0x48, 0x10, 0x09, 0x20, 0x02, 0x48, 0x10, 0x08, 0x06, 0x73, 0x18, 0x03,
0x21, 0x38, 0x91, 0x23, 0x87, 0xe3, 0x08, 0x20, 0x3c, 0x87, 0xe3, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08,
0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x1a, 0x06, 0x86, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x03, 0x7c, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00,
0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x73, 0xcc, 0xe1, 0x5c, 0x38, 0x33,
0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x94, 0x52,
0x23, 0x56, 0x9a, 0x48, 0x00, 0x00, 0x06, 0x60, 0x00, 0x06, 0x00, 0x00,
0x00, 0x80, 0x94, 0x5f, 0xe2, 0x52, 0x8a, 0x78, 0x00, 0x00, 0x02, 0x18,
0x03, 0x04, 0x00, 0x00, 0x00, 0x80, 0x94, 0x42, 0x82, 0x57, 0x8a, 0x08,
0x00, 0x00, 0x03, 0x04, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x4e,
0xe2, 0x9c, 0x8b, 0x33, 0x00, 0xc0, 0x01, 0x02, 0x04, 0x38, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x01,
0x08, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x01, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00,
0x10, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x01, 0x08, 0x00, 0x01, 0x00,
0x00, 0x00, 0xf0, 0xce, 0x5d, 0xd2, 0xdd, 0x01, 0x00, 0x08, 0x00, 0x01,
0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x90, 0x50, 0x52, 0x0b, 0x45, 0x02,
0x00, 0x38, 0x00, 0x01, 0x08, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x90, 0x5e,
0x12, 0xcd, 0xc5, 0x01, 0x00, 0xc0, 0x01, 0x02, 0x0c, 0x38, 0x00, 0x00,
0x00, 0x00, 0x90, 0x53, 0x96, 0x2d, 0x45, 0x00, 0x00, 0x00, 0x03, 0x06,
0x06, 0x08, 0x00, 0x00, 0x00, 0x00, 0x90, 0x5e, 0x9c, 0xc4, 0xc5, 0x01,
0x00, 0x00, 0x02, 0x0c, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x02, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04,
0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x04, 0x02, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x0c, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x01, 0x03, 0x0c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x01, 0x78, 0x08, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00,
0x80, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x00, 0x09,
0x00, 0x00, 0x84, 0x00, 0x02, 0x08, 0x00, 0x01, 0x80, 0x9b, 0xda, 0x8c,
0x99, 0x73, 0x33, 0x89, 0x19, 0xc7, 0x9c, 0xce, 0x2e, 0x8b, 0x31, 0x01,
0x80, 0xa4, 0x4a, 0x52, 0xa4, 0x14, 0x49, 0x49, 0x0a, 0x29, 0x85, 0x50,
0xa2, 0x48, 0x0a, 0x01, 0x80, 0xa4, 0x46, 0x52, 0xa4, 0x14, 0x49, 0xc9,
0x0b, 0xe9, 0x45, 0x5c, 0xa2, 0xc8, 0xbb, 0x00, 0x80, 0xa4, 0x4a, 0x52,
0xa4, 0x14, 0x49, 0x49, 0x08, 0x29, 0x44, 0x52, 0xa2, 0x48, 0xa0, 0x00,
0x80, 0xa4, 0x52, 0x8c, 0x99, 0x64, 0x31, 0x92, 0x4b, 0xc9, 0x59, 0x5c,
0x2c, 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x3d, 0xf0,
0x01, 0x00, 0x00, 0x02, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x15, 0x45, 0x40, 0xec, 0x1c, 0xcb, 0xce, 0xec, 0x8c, 0x9d, 0x19,
0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x44, 0x40, 0x04, 0xa5, 0x28, 0x22,
0x25, 0x52, 0x44, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x3c, 0x40,
0xc4, 0xa5, 0xeb, 0x22, 0x25, 0xde, 0xc5, 0x0b, 0x00, 0x00, 0x00, 0x00,
0x80, 0xaf, 0x24, 0x40, 0x24, 0x25, 0x8a, 0x22, 0x25, 0x02, 0x45, 0x08,
0x00, 0x00, 0x00, 0x00, 0x80, 0x48, 0x44, 0x40, 0xc4, 0xa5, 0x69, 0xcc,
0xc4, 0xdc, 0x98, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
void setup(void) {
/* U8g2 Project: SSD1306 Test Board */
//pinMode(10, OUTPUT);
//pinMode(9, OUTPUT);
//digitalWrite(10, 0);
//digitalWrite(9, 0);
/* U8g2 Project: T6963 Test Board */
//pinMode(18, OUTPUT);
//digitalWrite(18, 1);
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawXBMP(0,0, u8g2_logo_128x64_width, u8g2_logo_128x64_height, u8g2_logo_128x64_bits);
} while ( u8g2.nextPage() );
//delay(1000);
}