├── .cproject ├── .project ├── Makefile ├── README.md ├── driver ├── Adafruit_GFX_AS.cpp ├── Adafruit_ILI9341_fast_as.cpp ├── Font16.c ├── Font32.c ├── Font64.c ├── Font7s.c ├── hspi.c ├── mini-printf.c └── uart.c ├── include ├── cpp_routines │ └── routines.h ├── cube.h ├── driver │ ├── Adafruit_GFX_AS.h │ ├── Adafruit_ILI9341_fast_as.h │ ├── Font16.h │ ├── Font32.h │ ├── Font64.h │ ├── Font7s.h │ ├── Load_fonts.h │ ├── hspi.h │ ├── mini-printf.h │ ├── spi_register.h │ ├── uart.h │ └── uart_register.h ├── espmissingincludes.h ├── math │ └── cordic.h └── user_config.h ├── math └── cordic.c └── user ├── cube.cpp ├── routines.cpp ├── ui.cpp └── user_main.cpp /.cproject: -------------------------------------------------------------------------------- 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 | 30 | 31 | 32 | 33 | 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 | mingw32-make.exe 74 | -f ${ProjDirPath}/Makefile 75 | all 76 | true 77 | true 78 | true 79 | 80 | 81 | mingw32-make.exe 82 | -f ${ProjDirPath}/Makefile 83 | clean 84 | true 85 | true 86 | true 87 | 88 | 89 | mingw32-make.exe 90 | -f ${ProjDirPath}/Makefile 91 | flash 92 | true 93 | true 94 | true 95 | 96 | 97 | mingw32-make.exe 98 | -f ${ProjDirPath}/Makefile 99 | flashonefile 100 | true 101 | true 102 | true 103 | 104 | 105 | mingw32-make.exe 106 | -f ${ProjDirPath}/Makefile 107 | rebuild 108 | true 109 | true 110 | true 111 | 112 | 113 | mingw32-make.exe 114 | -f ${ProjDirPath}/Makefile 115 | flashinit 116 | true 117 | true 118 | true 119 | 120 | 121 | mingw32-make.exe 122 | -f ${ProjDirPath}/Makefile 123 | flashboot 124 | true 125 | true 126 | true 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | eps8266_adafruit_ili9341 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ############################################################# 2 | # 3 | # Root Level Makefile 4 | # 5 | # (c) by CHERTS 6 | # 7 | ############################################################# 8 | 9 | BUILD_BASE = build 10 | FW_BASE = firmware 11 | 12 | # Base directory for the compiler 13 | XTENSA_TOOLS_ROOT ?= c:/Espressif/xtensa-lx106-elf/bin 14 | 15 | # base directory of the ESP8266 SDK package, absolute 16 | SDK_BASE ?= c:/Espressif/ESP8266_SDK 17 | 18 | # esptool path and port 19 | SDK_TOOLS ?= c:/Espressif/utils 20 | ESPTOOL ?= $(SDK_TOOLS)/esptool.exe 21 | ESPPORT ?= COM11 22 | 23 | # BOOT = none 24 | # BOOT = old - boot_v1.1 25 | # BOOT = new - boot_v1.2+ 26 | BOOT?=none 27 | # APP = 0 - eagle.flash.bin + eagle.irom0text.bin 28 | # APP = 1 - user1.bin 29 | # APP = 2 - user2.bin 30 | APP?=0 31 | # SPI_SPEED = 20MHz, 26.7MHz, 40MHz, 80MHz 32 | SPI_SPEED?=40 33 | # SPI_MODE: QIO, QOUT, DIO, DOUT 34 | SPI_MODE?=QIO 35 | # SPI_SIZE: 256KB, 512KB, 1024KB, 2048KB, 4096KB 36 | SPI_SIZE?=512 37 | 38 | ifeq ($(BOOT), new) 39 | boot = new 40 | else 41 | ifeq ($(BOOT), old) 42 | boot = old 43 | else 44 | boot = none 45 | endif 46 | endif 47 | 48 | ifeq ($(APP), 1) 49 | app = 1 50 | else 51 | ifeq ($(APP), 2) 52 | app = 2 53 | else 54 | app = 0 55 | endif 56 | endif 57 | 58 | ifeq ($(SPI_SPEED), 26.7) 59 | freqdiv = 1 60 | else 61 | ifeq ($(SPI_SPEED), 20) 62 | freqdiv = 2 63 | else 64 | ifeq ($(SPI_SPEED), 80) 65 | freqdiv = 15 66 | else 67 | freqdiv = 0 68 | endif 69 | endif 70 | endif 71 | 72 | 73 | ifeq ($(SPI_MODE), QOUT) 74 | mode = 1 75 | else 76 | ifeq ($(SPI_MODE), DIO) 77 | mode = 2 78 | else 79 | ifeq ($(SPI_MODE), DOUT) 80 | mode = 3 81 | else 82 | mode = 0 83 | endif 84 | endif 85 | endif 86 | 87 | # flash larger than 1024KB only use 1024KB to storage user1.bin and user2.bin 88 | ifeq ($(SPI_SIZE), 256) 89 | size = 1 90 | flash = 256 91 | else 92 | ifeq ($(SPI_SIZE), 1024) 93 | size = 2 94 | flash = 1024 95 | else 96 | ifeq ($(SPI_SIZE), 2048) 97 | size = 3 98 | flash = 1024 99 | else 100 | ifeq ($(SPI_SIZE), 4096) 101 | size = 4 102 | flash = 1024 103 | else 104 | size = 0 105 | flash = 512 106 | endif 107 | endif 108 | endif 109 | endif 110 | 111 | ifeq ($(flash), 512) 112 | ifeq ($(app), 1) 113 | addr = 0x01000 114 | else 115 | ifeq ($(app), 2) 116 | addr = 0x41000 117 | endif 118 | endif 119 | else 120 | ifeq ($(flash), 1024) 121 | ifeq ($(app), 1) 122 | addr = 0x01000 123 | else 124 | ifeq ($(app), 2) 125 | addr = 0x81000 126 | endif 127 | endif 128 | endif 129 | endif 130 | 131 | # name for the target project 132 | TARGET = app 133 | 134 | # which modules (subdirectories) of the project to include in compiling 135 | MODULES = driver math user 136 | EXTRA_INCDIR = include include\driver include\math $(SDK_BASE)/../include 137 | 138 | # libraries used in this project, mainly provided by the SDK 139 | LIBS = c gcc hal phy pp net80211 lwip wpa main 140 | 141 | # compiler flags using during compilation of source files 142 | CFLAGS = -O2 -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -D__ets__ -DICACHE_FLASH 143 | CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions 144 | 145 | # linker flags used to generate the main object file 146 | LDFLAGS = -nostdlib -Wl,--no-check-sections -u call_user_start -Wl,-static 147 | 148 | # linker script used for the above linkier step 149 | LD_SCRIPT = eagle.app.v6.cpp.ld 150 | 151 | ifneq ($(boot), none) 152 | ifneq ($(app),0) 153 | LD_SCRIPT = eagle.app.v6.$(boot).$(flash).app$(app).cpp.ld 154 | BIN_NAME = user$(app).$(flash).$(boot) 155 | endif 156 | else 157 | app = 0 158 | endif 159 | 160 | # various paths from the SDK used in this project 161 | SDK_LIBDIR = lib 162 | SDK_LDDIR = ld 163 | SDK_INCDIR = include include/json 164 | 165 | # select which tools to use as compiler, librarian and linker 166 | CC := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc 167 | CXX := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-g++ 168 | AR := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-ar 169 | LD := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-gcc 170 | OBJCOPY := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objcopy 171 | OBJDUMP := $(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump 172 | 173 | # no user configurable options below here 174 | SRC_DIR := $(MODULES) 175 | BUILD_DIR := $(addprefix $(BUILD_BASE)/,$(MODULES)) 176 | 177 | SDK_LIBDIR := $(addprefix $(SDK_BASE)/,$(SDK_LIBDIR)) 178 | SDK_INCDIR := $(addprefix -I$(SDK_BASE)/,$(SDK_INCDIR)) 179 | 180 | SRC := $(foreach sdir,$(SRC_DIR),$(wildcard $(sdir)/*.c*)) 181 | C_OBJ := $(patsubst %.c,%.o,$(SRC)) 182 | CXX_OBJ := $(patsubst %.cpp,%.o,$(C_OBJ)) 183 | OBJ := $(patsubst %.o,$(BUILD_BASE)/%.o,$(CXX_OBJ)) 184 | LIBS := $(addprefix -l,$(LIBS)) 185 | APP_AR := $(addprefix $(BUILD_BASE)/,$(TARGET)_app.a) 186 | TARGET_OUT := $(addprefix $(BUILD_BASE)/,$(TARGET).out) 187 | 188 | LD_SCRIPT := $(addprefix -T$(SDK_BASE)/$(SDK_LDDIR)/,$(LD_SCRIPT)) 189 | 190 | INCDIR := $(addprefix -I,$(SRC_DIR)) 191 | EXTRA_INCDIR := $(addprefix -I,$(EXTRA_INCDIR)) 192 | MODULE_INCDIR := $(addsuffix /include,$(INCDIR)) 193 | 194 | V ?= $(VERBOSE) 195 | ifeq ("$(V)","1") 196 | Q := 197 | vecho := @true 198 | else 199 | Q := @ 200 | vecho := @echo 201 | endif 202 | 203 | vpath %.c $(SRC_DIR) 204 | vpath %.cpp $(SRC_DIR) 205 | 206 | define compile-objects 207 | $1/%.o: %.c 208 | $(vecho) "CC $$<" 209 | $(Q) $(CC) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CFLAGS) -c $$< -o $$@ 210 | $1/%.o: %.cpp 211 | $(vecho) "C+ $$<" 212 | $(Q) $(CXX) $(INCDIR) $(MODULE_INCDIR) $(EXTRA_INCDIR) $(SDK_INCDIR) $(CXXFLAGS) -c $$< -o $$@ 213 | endef 214 | 215 | .PHONY: all checkdirs clean 216 | 217 | all: checkdirs $(TARGET_OUT) $(FW_FILE_1) $(FW_FILE_2) 218 | 219 | $(TARGET_OUT): $(APP_AR) 220 | $(vecho) "LD $@" 221 | $(Q) $(LD) -L$(SDK_LIBDIR) $(LD_SCRIPT) $(LDFLAGS) -Wl,--start-group $(LIBS) $(APP_AR) -Wl,--end-group -o $@ 222 | $(vecho) "Run objcopy, please wait..." 223 | $(Q) $(OBJCOPY) --only-section .text -O binary $@ eagle.app.v6.text.bin 224 | $(Q) $(OBJCOPY) --only-section .data -O binary $@ eagle.app.v6.data.bin 225 | $(Q) $(OBJCOPY) --only-section .rodata -O binary $@ eagle.app.v6.rodata.bin 226 | $(Q) $(OBJCOPY) --only-section .irom0.text -O binary $@ eagle.app.v6.irom0text.bin 227 | $(vecho) "objcopy done" 228 | $(vecho) "Run gen_appbin.exe" 229 | ifeq ($(app), 0) 230 | $(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 0 $(mode) $(freqdiv) $(size) 231 | $(Q) mv eagle.app.flash.bin firmware/eagle.flash.bin 232 | $(Q) mv eagle.app.v6.irom0text.bin firmware/eagle.irom0text.bin 233 | $(Q) rm eagle.app.v6.* 234 | $(vecho) "No boot needed." 235 | $(vecho) "Generate eagle.flash.bin and eagle.irom0text.bin successully in folder firmware." 236 | $(vecho) "eagle.flash.bin-------->0x00000" 237 | $(vecho) "eagle.irom0text.bin---->0x40000" 238 | else 239 | ifeq ($(boot), new) 240 | $(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 2 $(mode) $(freqdiv) $(size) 241 | $(vecho) "Support boot_v1.2 and +" 242 | else 243 | $(Q) $(SDK_TOOLS)/gen_appbin.exe $@ 1 $(mode) $(freqdiv) $(size) 244 | $(vecho) "Support boot_v1.1 and +" 245 | endif 246 | $(Q) mv eagle.app.flash.bin firmware/upgrade/$(BIN_NAME).bin 247 | $(Q) rm eagle.app.v6.* 248 | $(vecho) "Generate $(BIN_NAME).bin successully in folder firmware/upgrade." 249 | $(vecho) "boot_v1.x.bin------->0x00000" 250 | $(vecho) "$(BIN_NAME).bin--->$(addr)" 251 | endif 252 | $(vecho) "Done" 253 | 254 | $(APP_AR): $(OBJ) 255 | $(vecho) "AR $@" 256 | $(Q) $(AR) cru $@ $^ 257 | 258 | checkdirs: $(BUILD_DIR) $(FW_BASE) 259 | 260 | $(BUILD_DIR): 261 | $(Q) mkdir -p $@ 262 | 263 | firmware: 264 | $(Q) mkdir -p $@ 265 | $(Q) mkdir -p $@/upgrade 266 | 267 | flashonefile: all 268 | $(OBJCOPY) --only-section .text -O binary $(TARGET_OUT) eagle.app.v6.text.bin 269 | $(OBJCOPY) --only-section .data -O binary $(TARGET_OUT) eagle.app.v6.data.bin 270 | $(OBJCOPY) --only-section .rodata -O binary $(TARGET_OUT) eagle.app.v6.rodata.bin 271 | $(OBJCOPY) --only-section .irom0.text -O binary $(TARGET_OUT) eagle.app.v6.irom0text.bin 272 | $(SDK_TOOLS)/gen_appbin_old.exe $(TARGET_OUT) v6 273 | $(SDK_TOOLS)/gen_flashbin.exe eagle.app.v6.flash.bin eagle.app.v6.irom0text.bin 0x40000 274 | rm -f eagle.app.v6.data.bin 275 | rm -f eagle.app.v6.flash.bin 276 | rm -f eagle.app.v6.irom0text.bin 277 | rm -f eagle.app.v6.rodata.bin 278 | rm -f eagle.app.v6.text.bin 279 | rm -f eagle.app.sym 280 | mv eagle.app.flash.bin firmware/ 281 | $(vecho) "No boot needed." 282 | $(vecho) "Generate eagle.app.flash.bin successully in folder firmware." 283 | $(vecho) "eagle.app.flash.bin-------->0x00000" 284 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash 0x00000 firmware/eagle.app.flash.bin 285 | 286 | flashboot: all flashinit 287 | ifeq ($(boot), new) 288 | $(vecho) "Flash boot_v1.2 and +" 289 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash 0x00000 $(SDK_BASE)/bin/boot_v1.2.bin 290 | endif 291 | ifeq ($(boot), old) 292 | $(vecho) "Flash boot_v1.1 and +" 293 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash 0x00000 $(SDK_BASE)/bin/boot_v1.1.bin 294 | endif 295 | ifeq ($(boot), none) 296 | $(vecho) "No boot needed." 297 | endif 298 | 299 | flash: all 300 | ifeq ($(app), 0) 301 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash 0x00000 firmware/eagle.flash.bin 0x40000 firmware/eagle.irom0text.bin 302 | else 303 | ifeq ($(boot), none) 304 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash 0x00000 firmware/eagle.flash.bin 0x40000 firmware/eagle.irom0text.bin 305 | else 306 | $(ESPTOOL) -p $(ESPPORT) -b 256000 write_flash $(addr) firmware/upgrade/$(BIN_NAME).bin 307 | endif 308 | endif 309 | 310 | flashinit: 311 | $(vecho) "Flash init data default and blank data." 312 | $(ESPTOOL) -p $(ESPPORT) write_flash 0x7c000 $(SDK_BASE)/bin/esp_init_data_default.bin 0x7e000 $(SDK_BASE)/bin/blank.bin 313 | 314 | rebuild: clean all 315 | 316 | clean: 317 | $(Q) rm -f $(APP_AR) 318 | $(Q) rm -f $(TARGET_OUT) 319 | $(Q) rm -rf $(BUILD_DIR) 320 | $(Q) rm -rf $(BUILD_BASE) 321 | $(Q) rm -rf $(FW_BASE) 322 | 323 | $(foreach bdir,$(BUILD_DIR),$(eval $(call compile-objects,$(bdir)))) 324 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Credits 2 | Port of modified Adafruit library for ILI9341-based TFT displays. 3 | 4 | Original lib: https://github.com/adafruit/Adafruit_ILI9341 5 | 6 | The library is extended with text rendering routines got from here: http://www.instructables.com/id/Arduino-TFT-display-and-font-library/?ALLSTEPS 7 | 8 | Original hspi code: https://github.com/Perfer/esp8266_ili9341 9 | 10 | The sample project is to be built with ESP8266 Unofficial Development Kit aka UDK. 11 | http://esp8266.ru/forum/threads/obsuzhdenie-unofficial-development-kit-for-espressif-esp8266.32/ 12 | 13 | ## ILI9341 driver 14 | The driver itself and needed dependencies are in /driver and /include/driver. 15 | The driver is written in C++ which is not well supported by ESP8266 toolchain and sdk, so some dirty hack is needed to properly contstruct C++ objects. The code for this is in user/routines.cpp. 16 | 17 | ## SPI staff 18 | In spite of the fact that according to the datasheet max ILI9341's clock speed is 10MHz mine robustly works at up to 40MHz so I added SPI speed prescaler macro at the beginning of hspi.c. 19 | Defining it to 1 means HSPI will be clocked at 40MHz, 4 means 10 MHz. 20 | 21 | ## Sample code 22 | The sample code consists of two parts: 23 | 24 | 1) Rotating cube https://youtu.be/kEWThKicO0Q 25 | 26 | 2) Sample HVAC controller UI (for the extended version of this: http://habrahabr.ru/post/214257/) https://youtu.be/VraLl8XK1CI 27 | 28 | What to demonstrate is controlled by macro UIDEMO defined at the beginning of user_main.cpp. If it's defined then the sample HVAC controller UI is shown, else, the rotating cube is rendered. 29 | 30 | ## Wiring 31 | The code uses hardware HSPI with hardware controlled CS, so the wiring shall be as follows: 32 | 33 | ILI9341 pin --> ESP8266 pin 34 | 35 | MOSI --> GPIO13 36 | 37 | CLK --> GPIO14 38 | 39 | CS --> GPIO15 40 | 41 | DC --> GPIO2 42 | 43 | Reset to 3.3v 44 | 45 | GND to ground 46 | 47 | MISO may be left unconnected 48 | 49 | 50 | -------------------------------------------------------------------------------- /driver/Adafruit_GFX_AS.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This is the core graphics library for all our displays, providing a common 3 | set of graphics primitives (points, lines, circles, etc.). It needs to be 4 | paired with a hardware-specific library for each display device we carry 5 | (to handle the lower-level functions). 6 | 7 | Adafruit invests time and resources providing this open source code, please 8 | support Adafruit & open-source hardware by purchasing products from Adafruit! 9 | 10 | Copyright (c) 2013 Adafruit Industries. All rights reserved. 11 | 12 | Redistribution and use in source and binary forms, with or without 13 | modification, are permitted provided that the following conditions are met: 14 | 15 | - Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | - Redistributions in binary form must reproduce the above copyright notice, 18 | this list of conditions and the following disclaimer in the documentation 19 | and/or other materials provided with the distribution. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "Adafruit_GFX_AS.h" 35 | 36 | extern "C" { 37 | #include "mini-printf.h" 38 | } 39 | 40 | #ifdef LOAD_FONT2 41 | #include "Font16.h" 42 | #endif 43 | 44 | #ifdef LOAD_FONT4 45 | #include "Font32.h" 46 | #endif 47 | 48 | #ifdef LOAD_FONT6 49 | #include "Font64.h" 50 | #endif 51 | 52 | #ifdef LOAD_FONT7 53 | #include "Font7s.h" 54 | #endif 55 | 56 | #define abs(x) ((x)<0 ? -(x) : (x)) 57 | #define swap(x, y) do { typeof(x) temp##x##y = x; x = y; y = temp##x##y; } while (0) 58 | 59 | ICACHE_FLASH_ATTR Adafruit_GFX_AS::Adafruit_GFX_AS(int16_t w, int16_t h): 60 | WIDTH(w), HEIGHT(h) 61 | { 62 | _width = WIDTH; 63 | _height = HEIGHT; 64 | rotation = 0; 65 | textcolor = textbgcolor = 0xFFFF; 66 | wrap = true; 67 | } 68 | 69 | // Draw a circle outline 70 | ICACHE_FLASH_ATTR void Adafruit_GFX_AS::drawCircle(int16_t x0, int16_t y0, int16_t r, 71 | uint16_t color) { 72 | int16_t f = 1 - r; 73 | int16_t ddF_x = 1; 74 | int16_t ddF_y = -2 * r; 75 | int16_t x = 0; 76 | int16_t y = r; 77 | 78 | drawPixel(x0 , y0+r, color); 79 | drawPixel(x0 , y0-r, color); 80 | drawPixel(x0+r, y0 , color); 81 | drawPixel(x0-r, y0 , color); 82 | 83 | while (x= 0) { 85 | y--; 86 | ddF_y += 2; 87 | f += ddF_y; 88 | } 89 | x++; 90 | ddF_x += 2; 91 | f += ddF_x; 92 | 93 | drawPixel(x0 + x, y0 + y, color); 94 | drawPixel(x0 - x, y0 + y, color); 95 | drawPixel(x0 + x, y0 - y, color); 96 | drawPixel(x0 - x, y0 - y, color); 97 | drawPixel(x0 + y, y0 + x, color); 98 | drawPixel(x0 - y, y0 + x, color); 99 | drawPixel(x0 + y, y0 - x, color); 100 | drawPixel(x0 - y, y0 - x, color); 101 | } 102 | } 103 | 104 | ICACHE_FLASH_ATTR void Adafruit_GFX_AS::drawCircleHelper( int16_t x0, int16_t y0, 105 | int16_t r, uint8_t cornername, uint16_t color) { 106 | int16_t f = 1 - r; 107 | int16_t ddF_x = 1; 108 | int16_t ddF_y = -2 * r; 109 | int16_t x = 0; 110 | int16_t y = r; 111 | 112 | while (x= 0) { 114 | y--; 115 | ddF_y += 2; 116 | f += ddF_y; 117 | } 118 | x++; 119 | ddF_x += 2; 120 | f += ddF_x; 121 | if (cornername & 0x4) { 122 | drawPixel(x0 + x, y0 + y, color); 123 | drawPixel(x0 + y, y0 + x, color); 124 | } 125 | if (cornername & 0x2) { 126 | drawPixel(x0 + x, y0 - y, color); 127 | drawPixel(x0 + y, y0 - x, color); 128 | } 129 | if (cornername & 0x8) { 130 | drawPixel(x0 - y, y0 + x, color); 131 | drawPixel(x0 - x, y0 + y, color); 132 | } 133 | if (cornername & 0x1) { 134 | drawPixel(x0 - y, y0 - x, color); 135 | drawPixel(x0 - x, y0 - y, color); 136 | } 137 | } 138 | } 139 | 140 | ICACHE_FLASH_ATTR void Adafruit_GFX_AS::fillCircle(int16_t x0, int16_t y0, int16_t r, 141 | uint16_t color) { 142 | drawFastVLine(x0, y0-r, 2*r+1, color); 143 | fillCircleHelper(x0, y0, r, 3, 0, color); 144 | } 145 | 146 | // Used to do circles and roundrects 147 | ICACHE_FLASH_ATTR void Adafruit_GFX_AS::fillCircleHelper(int16_t x0, int16_t y0, int16_t r, 148 | uint8_t cornername, int16_t delta, uint16_t color) { 149 | 150 | int16_t f = 1 - r; 151 | int16_t ddF_x = 1; 152 | int16_t ddF_y = -2 * r; 153 | int16_t x = 0; 154 | int16_t y = r; 155 | 156 | while (x= 0) { 158 | y--; 159 | ddF_y += 2; 160 | f += ddF_y; 161 | } 162 | x++; 163 | ddF_x += 2; 164 | f += ddF_x; 165 | 166 | if (cornername & 0x1) { 167 | drawFastVLine(x0+x, y0-y, 2*y+1+delta, color); 168 | drawFastVLine(x0+y, y0-x, 2*x+1+delta, color); 169 | } 170 | if (cornername & 0x2) { 171 | drawFastVLine(x0-x, y0-y, 2*y+1+delta, color); 172 | drawFastVLine(x0-y, y0-x, 2*x+1+delta, color); 173 | } 174 | } 175 | } 176 | 177 | // Bresenham's algorithm - thx wikpedia 178 | void Adafruit_GFX_AS::drawLine(int16_t x0, int16_t y0, 179 | int16_t x1, int16_t y1, 180 | uint16_t color) { 181 | int16_t steep = abs(y1 - y0) > abs(x1 - x0); 182 | if (steep) { 183 | swap(x0, y0); 184 | swap(x1, y1); 185 | } 186 | 187 | if (x0 > x1) { 188 | swap(x0, x1); 189 | swap(y0, y1); 190 | } 191 | 192 | int16_t dx, dy; 193 | dx = x1 - x0; 194 | dy = abs(y1 - y0); 195 | 196 | int16_t err = dx / 2; 197 | int16_t ystep; 198 | 199 | if (y0 < y1) { 200 | ystep = 1; 201 | } else { 202 | ystep = -1; 203 | } 204 | 205 | for (; x0<=x1; x0++) { 206 | if (steep) { 207 | drawPixel(y0, x0, color); 208 | } else { 209 | drawPixel(x0, y0, color); 210 | } 211 | err -= dy; 212 | if (err < 0) { 213 | y0 += ystep; 214 | err += dx; 215 | } 216 | } 217 | } 218 | 219 | // Draw a rectangle 220 | void Adafruit_GFX_AS::drawRect(int16_t x, int16_t y, 221 | int16_t w, int16_t h, 222 | uint16_t color) { 223 | drawFastHLine(x, y, w, color); 224 | drawFastHLine(x, y+h-1, w, color); 225 | drawFastVLine(x, y, h, color); 226 | drawFastVLine(x+w-1, y, h, color); 227 | } 228 | 229 | void Adafruit_GFX_AS::drawFastVLine(int16_t x, int16_t y, 230 | int16_t h, uint16_t color) { 231 | // Update in subclasses if desired! 232 | drawLine(x, y, x, y+h-1, color); 233 | } 234 | 235 | void Adafruit_GFX_AS::drawFastHLine(int16_t x, int16_t y, 236 | int16_t w, uint16_t color) { 237 | // Update in subclasses if desired! 238 | drawLine(x, y, x+w-1, y, color); 239 | } 240 | 241 | void Adafruit_GFX_AS::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, 242 | uint16_t color) { 243 | // Update in subclasses if desired! 244 | for (int16_t i=x; i= y1 >= y0) 296 | if (y0 > y1) { 297 | swap(y0, y1); swap(x0, x1); 298 | } 299 | if (y1 > y2) { 300 | swap(y2, y1); swap(x2, x1); 301 | } 302 | if (y0 > y1) { 303 | swap(y0, y1); swap(x0, x1); 304 | } 305 | 306 | if(y0 == y2) { // Handle awkward all-on-same-line case as its own thing 307 | a = b = x0; 308 | if(x1 < a) a = x1; 309 | else if(x1 > b) b = x1; 310 | if(x2 < a) a = x2; 311 | else if(x2 > b) b = x2; 312 | drawFastHLine(a, y0, b-a+1, color); 313 | return; 314 | } 315 | 316 | int16_t 317 | dx01 = x1 - x0, 318 | dy01 = y1 - y0, 319 | dx02 = x2 - x0, 320 | dy02 = y2 - y0, 321 | dx12 = x2 - x1, 322 | dy12 = y2 - y1, 323 | sa = 0, 324 | sb = 0; 325 | 326 | // For upper part of triangle, find scanline crossings for segments 327 | // 0-1 and 0-2. If y1=y2 (flat-bottomed triangle), the scanline y1 328 | // is included here (and second loop will be skipped, avoiding a /0 329 | // error there), otherwise scanline y1 is skipped here and handled 330 | // in the second loop...which also avoids a /0 error here if y0=y1 331 | // (flat-topped triangle). 332 | if(y1 == y2) last = y1; // Include y1 scanline 333 | else last = y1-1; // Skip it 334 | 335 | for(y=y0; y<=last; y++) { 336 | a = x0 + sa / dy01; 337 | b = x0 + sb / dy02; 338 | sa += dx01; 339 | sb += dx02; 340 | /* longhand: 341 | a = x0 + (x1 - x0) * (y - y0) / (y1 - y0); 342 | b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); 343 | */ 344 | if(a > b) swap(a,b); 345 | drawFastHLine(a, y, b-a+1, color); 346 | } 347 | 348 | // For lower part of triangle, find scanline crossings for segments 349 | // 0-2 and 1-2. This loop is skipped if y1=y2. 350 | sa = dx12 * (y - y1); 351 | sb = dx02 * (y - y0); 352 | for(; y<=y2; y++) { 353 | a = x1 + sa / dy12; 354 | b = x0 + sb / dy02; 355 | sa += dx12; 356 | sb += dx02; 357 | /* longhand: 358 | a = x1 + (x2 - x1) * (y - y1) / (y2 - y1); 359 | b = x0 + (x2 - x0) * (y - y0) / (y2 - y0); 360 | */ 361 | if(a > b) swap(a,b); 362 | drawFastHLine(a, y, b-a+1, color); 363 | } 364 | } 365 | 366 | void Adafruit_GFX_AS::drawBitmap(int16_t x, int16_t y, 367 | const uint16_t *bitmap, int16_t w, int16_t h) { 368 | 369 | 370 | for(uint16_t j=0; j0) 700 | { 701 | xPlus = drawChar('.',poX, poY, size); 702 | poX += xPlus; /* Move cursor right */ 703 | sumX += xPlus; 704 | } 705 | else 706 | { 707 | return sumX; 708 | } 709 | 710 | decy = floatNumber - temp; 711 | for(unsigned char i=0; i 6 | #include 7 | #include 8 | #include "hspi.h" 9 | #include "espmissingincludes.h" 10 | } 11 | 12 | #define SWAPBYTES(i) ((i>>8) | (i<<8)) 13 | ICACHE_FLASH_ATTR Adafruit_ILI9341::Adafruit_ILI9341() : Adafruit_GFX_AS(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT) { 14 | tabcolor = 0; 15 | } 16 | 17 | void Adafruit_ILI9341::transmitCmdData(uint8_t cmd, const uint8_t *data, uint8_t numDataByte) 18 | { 19 | hspi_wait_ready(); 20 | TFT_DC_COMMAND; 21 | hspi_send_uint8(cmd); 22 | hspi_wait_ready(); 23 | TFT_DC_DATA; 24 | hspi_send_data(data, numDataByte); 25 | } 26 | 27 | ICACHE_FLASH_ATTR void Adafruit_ILI9341::begin(void) { 28 | //Set communication using HW SPI Port 29 | hspi_init(); 30 | TFT_DC_INIT; 31 | TFT_RST_INIT; 32 | 33 | TFT_RST_ACTIVE; 34 | os_delay_us(10000); 35 | TFT_RST_DEACTIVE; 36 | os_delay_us(1000); 37 | 38 | uint8_t data[15] = {0}; 39 | 40 | data[0] = 0x39; 41 | data[1] = 0x2C; 42 | data[2] = 0x00; 43 | data[3] = 0x34; 44 | data[4] = 0x02; 45 | transmitCmdData(0xCB, data, 5); 46 | 47 | data[0] = 0x00; 48 | data[1] = 0XC1; 49 | data[2] = 0X30; 50 | transmitCmdData(0xCF, data, 3); 51 | 52 | data[0] = 0x85; 53 | data[1] = 0x00; 54 | data[2] = 0x78; 55 | transmitCmdData(0xE8, data, 3); 56 | 57 | data[0] = 0x00; 58 | data[1] = 0x00; 59 | transmitCmdData(0xEA, data, 2); 60 | 61 | data[0] = 0x64; 62 | data[1] = 0x03; 63 | data[2] = 0X12; 64 | data[3] = 0X81; 65 | transmitCmdData(0xED, data, 4); 66 | 67 | data[0] = 0x20; 68 | transmitCmdData(0xF7, data, 1); 69 | 70 | data[0] = 0x23; //VRH[5:0] 71 | transmitCmdData(0xC0, data, 1); //Power control 72 | 73 | data[0] = 0x10; //SAP[2:0];BT[3:0] 74 | transmitCmdData(0xC1, data, 1); //Power control 75 | 76 | data[0] = 0x3e; //Contrast 77 | data[1] = 0x28; 78 | transmitCmdData(0xC5, data, 2); //VCM control 79 | 80 | data[0] = 0x86; //-- 81 | transmitCmdData(0xC7, data, 1); //VCM control2 82 | 83 | data[0] = 0x48; //C8 84 | transmitCmdData(0x36, data, 1); // Memory Access Control 85 | 86 | data[0] = 0x55; 87 | transmitCmdData(0x3A, data, 1); 88 | 89 | data[0] = 0x00; 90 | data[1] = 0x18; 91 | transmitCmdData(0xB1, data, 2); 92 | 93 | data[0] = 0x08; 94 | data[1] = 0x82; 95 | data[2] = 0x27; 96 | transmitCmdData(0xB6, data, 3); // Display Function Control 97 | 98 | data[0] = 0x00; 99 | transmitCmdData(0xF2, data, 1); // 3Gamma Function Disable 100 | 101 | data[0] = 0x01; 102 | transmitCmdData(0x26, data, 1); //Gamma curve selected 103 | 104 | data[0] = 0x0F; 105 | data[1] = 0x31; 106 | data[2] = 0x2B; 107 | data[3] = 0x0C; 108 | data[4] = 0x0E; 109 | data[5] = 0x08; 110 | data[6] = 0x4E; 111 | data[7] = 0xF1; 112 | data[8] = 0x37; 113 | data[9] = 0x07; 114 | data[10] = 0x10; 115 | data[11] = 0x03; 116 | data[12] = 0x0E; 117 | data[13] = 0x09; 118 | data[14] = 0x00; 119 | transmitCmdData(0xE0, data, 15); //Set Gamma 120 | 121 | data[0] = 0x00; 122 | data[1] = 0x0E; 123 | data[2] = 0x14; 124 | data[3] = 0x03; 125 | data[4] = 0x11; 126 | data[5] = 0x07; 127 | data[6] = 0x31; 128 | data[7] = 0xC1; 129 | data[8] = 0x48; 130 | data[9] = 0x08; 131 | data[10] = 0x0F; 132 | data[11] = 0x0C; 133 | data[12] = 0x31; 134 | data[13] = 0x36; 135 | data[14] = 0x0F; 136 | transmitCmdData(0xE1, data, 15); //Set Gamma 137 | 138 | transmitCmd(0x11); //Exit Sleep 139 | os_delay_us(120000); 140 | 141 | transmitCmd(0x29); //Display on 142 | transmitCmd(0x2c); 143 | } 144 | 145 | void Adafruit_ILI9341::drawPixel(int16_t x, int16_t y, uint16_t color) { 146 | 147 | if((x < 0) ||(x >= _width) || (y < 0) || (y >= _height)) return; 148 | setAddrWindow(x,y,x+1,y+1); 149 | transmitData(SWAPBYTES(color)); 150 | } 151 | 152 | 153 | void Adafruit_ILI9341::drawFastVLine(int16_t x, int16_t y, int16_t h, 154 | uint16_t color) { 155 | 156 | // Rudimentary clipping 157 | if((x >= _width) || (y >= _height)) return; 158 | 159 | if((y+h-1) >= _height) 160 | h = _height-y; 161 | 162 | setAddrWindow(x, y, x, y+h-1); 163 | transmitData(SWAPBYTES(color), h); 164 | } 165 | 166 | void Adafruit_ILI9341::drawFastHLine(int16_t x, int16_t y, int16_t w, 167 | uint16_t color) { 168 | 169 | // Rudimentary clipping 170 | if((x >= _width) || (y >= _height)) return; 171 | if((x+w-1) >= _width) w = _width-x; 172 | setAddrWindow(x, y, x+w-1, y); 173 | transmitData(SWAPBYTES(color), w); 174 | } 175 | 176 | ICACHE_FLASH_ATTR void Adafruit_ILI9341::fillScreen(uint16_t color) { 177 | fillRect(0, 0, _width, _height, color); 178 | } 179 | 180 | // fill a rectangle 181 | void Adafruit_ILI9341::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, 182 | uint16_t color) { 183 | 184 | // rudimentary clipping (drawChar w/big text requires this) 185 | if((x >= _width) || (y >= _height)) return; 186 | if((x + w - 1) >= _width) w = _width - x; 187 | if((y + h - 1) >= _height) h = _height - y; 188 | 189 | setAddrWindow(x, y, x+w-1, y+h-1); 190 | transmitData(SWAPBYTES(color), h*w); 191 | } 192 | 193 | 194 | // Pass 8-bit (each) R,G,B, get back 16-bit packed color 195 | uint16_t Adafruit_ILI9341::color565(uint8_t r, uint8_t g, uint8_t b) { 196 | return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3); 197 | } 198 | 199 | 200 | #define MADCTL_MY 0x80 201 | #define MADCTL_MX 0x40 202 | #define MADCTL_MV 0x20 203 | #define MADCTL_ML 0x10 204 | #define MADCTL_RGB 0x00 205 | #define MADCTL_BGR 0x08 206 | #define MADCTL_MH 0x04 207 | 208 | void Adafruit_ILI9341::setRotation(uint8_t m) { 209 | 210 | uint8_t data; 211 | rotation = m % 4; // can't be higher than 3 212 | switch (rotation) { 213 | case 0: 214 | data = MADCTL_MX | MADCTL_BGR; 215 | _width = ILI9341_TFTWIDTH; 216 | _height = ILI9341_TFTHEIGHT; 217 | break; 218 | case 1: 219 | data = MADCTL_MV | MADCTL_BGR; 220 | _width = ILI9341_TFTHEIGHT; 221 | _height = ILI9341_TFTWIDTH; 222 | break; 223 | case 2: 224 | data = MADCTL_MY | MADCTL_BGR; 225 | _width = ILI9341_TFTWIDTH; 226 | _height = ILI9341_TFTHEIGHT; 227 | break; 228 | case 3: 229 | data = MADCTL_MX | MADCTL_MY | MADCTL_MV | MADCTL_BGR; 230 | _width = ILI9341_TFTHEIGHT; 231 | _height = ILI9341_TFTWIDTH; 232 | break; 233 | } 234 | transmitCmdData(ILI9341_MADCTL, &data, 1); 235 | } 236 | 237 | 238 | void Adafruit_ILI9341::invertDisplay(bool i) { 239 | transmitCmd(i ? ILI9341_INVON : ILI9341_INVOFF); 240 | } 241 | -------------------------------------------------------------------------------- /driver/Font16.c: -------------------------------------------------------------------------------- 1 | // Font size 2 2 | 3 | #include "Font16.h" 4 | 5 | const unsigned char widtbl_f16[96] = // character width table 6 | { 7 | 5, 2, 3, 8, 7, 8, 8, 2, // char 32 - 39 8 | 6, 6, 7, 5, 2, 5, 4, 6, // char 40 - 47 9 | 7, 7, 7, 7, 7, 7, 7, 7, // char 48 - 55 10 | 7, 7, 2, 2, 5, 5, 5, 7, // char 56 - 63 11 | 8, 7, 7, 7, 7, 7, 7, 7, // char 64 - 71 12 | 6, 3, 7, 7, 6, 9, 7, 7, // char 72 - 79 13 | 7, 7, 7, 7, 7, 7, 7, 9, // char 80 - 87 14 | 7, 7, 7, 3, 6, 3, 16, 16, // char 88 - 95 15 | 3, 6, 6, 6, 6, 6, 5, 6, // char 96 - 103 16 | 6, 4, 4, 5, 4, 7, 6, 7, // char 104 - 111 17 | 6, 7, 5, 5, 4, 6, 7, 7, // char 112 - 119 18 | 5, 6, 6, 11, 16, 8, 2, 13 // char 120 - 127 19 | }; 20 | 21 | // Row format, MSB left 22 | 23 | const unsigned char chr_f16_20[16] = // 1 unsigned char per row 24 | { 25 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 26 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 27 | }; 28 | const unsigned char chr_f16_21[16] = // 1 unsigned char per row 29 | { 30 | 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11 31 | 0x00, 0x40, 0x00, 0x00, 0x00 // row 12 - 16 32 | }; 33 | const unsigned char chr_f16_22[16] = // 1 unsigned char per row 34 | { 35 | 0x00, 0x00, 0xA0, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 36 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 37 | }; 38 | const unsigned char chr_f16_23[16] = // 1 unsigned char per row 39 | { 40 | 0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0xFF, 0x24, 0x24, 0xFF, 0x24, // row 1 - 11 41 | 0x24, 0x24, 0x00, 0x00, 0x00 // row 12 - 16 42 | }; 43 | const unsigned char chr_f16_24[16] = // 1 unsigned char per row 44 | { 45 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x40, 0x70, 0x40, 0x40, // row 1 - 11 46 | 0x40, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16 47 | }; 48 | const unsigned char chr_f16_25[16] = // 1 unsigned char per row 49 | { 50 | 0x00, 0x00, 0x00, 0x61, 0x91, 0x92, 0x64, 0x08, 0x10, 0x26, 0x49, // row 1 - 11 51 | 0x89, 0x86, 0x00, 0x00, 0x00 // row 12 - 16 52 | }; 53 | const unsigned char chr_f16_26[16] = // 1 unsigned char per row 54 | { 55 | 0x00, 0x00, 0x00, 0x20, 0x50, 0x88, 0x88, 0x50, 0x20, 0x52, 0x8C, // row 1 - 11 56 | 0x8C, 0x73, 0x00, 0x00, 0x00 // row 12 - 16 57 | }; 58 | const unsigned char chr_f16_27[16] = // 1 unsigned char per row 59 | { 60 | 0x00, 0x00, 0x40, 0x40, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 61 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 62 | }; 63 | const unsigned char chr_f16_28[16] = // 1 unsigned char per row 64 | { 65 | 0x00, 0x0C, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11 66 | 0x40, 0x40, 0x20, 0x10, 0x0C // row 12 - 16 67 | }; 68 | const unsigned char chr_f16_29[16] = // 1 unsigned char per row 69 | { 70 | 0x00, 0xC0, 0x20, 0x10, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, // row 1 - 11 71 | 0x08, 0x08, 0x10, 0x20, 0xC0 // row 12 - 16 72 | }; 73 | const unsigned char chr_f16_2A[16] = // 1 unsigned char per row 74 | { 75 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x92, 0x54, 0x38, 0x54, 0x92, 0x10, // row 1 - 11 76 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 77 | }; 78 | const unsigned char chr_f16_2B[16] = // 1 unsigned char per row 79 | { 80 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, // row 1 - 11 81 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 82 | }; 83 | const unsigned char chr_f16_2C[16] = // 1 unsigned char per row 84 | { 85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 86 | 0xC0, 0xC0, 0x40, 0x80, 0x00 // row 12 - 16 87 | }; 88 | const unsigned char chr_f16_2D[16] = // 1 unsigned char per row 89 | { 90 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, // row 1 - 11 91 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 92 | }; 93 | const unsigned char chr_f16_2E[16] = // 1 unsigned char per row 94 | { 95 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 96 | 0xC0, 0xC0, 0x00, 0x00, 0x00 // row 12 - 16 97 | }; 98 | const unsigned char chr_f16_2F[16] = // 1 unsigned char per row 99 | { 100 | 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, // row 1 - 11 101 | 0x40, 0x80, 0x80, 0x00, 0x00 // row 12 - 16 102 | }; 103 | const unsigned char chr_f16_30[16] = // 1 unsigned char per row 104 | { 105 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x82, 0x82, 0x82, 0x82, 0x44, // row 1 - 11 106 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 107 | }; 108 | const unsigned char chr_f16_31[16] = // 1 unsigned char per row 109 | { 110 | 0x00, 0x00, 0x00, 0x10, 0x30, 0x50, 0x10, 0x10, 0x10, 0x10, 0x10, // row 1 - 11 111 | 0x10, 0x7C, 0x00, 0x00, 0x00 // row 12 - 16 112 | }; 113 | const unsigned char chr_f16_32[16] = // 1 unsigned char per row 114 | { 115 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x02, 0x04, 0x18, 0x20, 0x40, // row 1 - 11 116 | 0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16 117 | }; 118 | const unsigned char chr_f16_33[16] = // 1 unsigned char per row 119 | { 120 | 0x00, 0x00, 0x00, 0x78, 0x84, 0x02, 0x04, 0x38, 0x04, 0x02, 0x02, // row 1 - 11 121 | 0x84, 0x78, 0x00, 0x00, 0x00 // row 12 - 16 122 | }; 123 | const unsigned char chr_f16_34[16] = // 1 unsigned char per row 124 | { 125 | 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, 0x44, 0x84, 0xFE, 0x04, // row 1 - 11 126 | 0x04, 0x04, 0x00, 0x00, 0x00 // row 12 - 16 127 | }; 128 | const unsigned char chr_f16_35[16] = // 1 unsigned char per row 129 | { 130 | 0x00, 0x00, 0x00, 0xFC, 0x80, 0x80, 0x80, 0xF8, 0x04, 0x02, 0x02, // row 1 - 11 131 | 0x84, 0x78, 0x00, 0x00, 0x00 // row 12 - 16 132 | }; 133 | const unsigned char chr_f16_36[16] = // 1 unsigned char per row 134 | { 135 | 0x00, 0x00, 0x00, 0x3C, 0x40, 0x80, 0x80, 0xB8, 0xC4, 0x82, 0x82, // row 1 - 11 136 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 137 | }; 138 | const unsigned char chr_f16_37[16] = // 1 unsigned char per row 139 | { 140 | 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, // row 1 - 11 141 | 0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 142 | }; 143 | const unsigned char chr_f16_38[16] = // 1 unsigned char per row 144 | { 145 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x44, 0x38, 0x44, 0x82, 0x82, // row 1 - 11 146 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 147 | }; 148 | const unsigned char chr_f16_39[16] = // 1 unsigned char per row 149 | { 150 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x46, 0x3A, 0x02, 0x02, // row 1 - 11 151 | 0x04, 0x78, 0x00, 0x00, 0x00 // row 12 - 16 152 | }; 153 | const unsigned char chr_f16_3A[16] = // 1 unsigned char per row 154 | { 155 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, // row 1 - 11 156 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 157 | }; 158 | const unsigned char chr_f16_3B[16] = // 1 unsigned char per row 159 | { 160 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, 0x00, 0xC0, 0xC0, // row 1 - 11 161 | 0x40, 0x80, 0x00, 0x00, 0x00 // row 12 - 16 162 | }; 163 | const unsigned char chr_f16_3C[16] = // 1 unsigned char per row 164 | { 165 | 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20, // row 1 - 11 166 | 0x10, 0x08, 0x00, 0x00, 0x00 // row 12 - 16 167 | }; 168 | const unsigned char chr_f16_3D[16] = // 1 unsigned char per row 169 | { 170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, // row 1 - 11 171 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 172 | }; 173 | const unsigned char chr_f16_3E[16] = // 1 unsigned char per row 174 | { 175 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x10, 0x20, // row 1 - 11 176 | 0x40, 0x80, 0x00, 0x00, 0x00 // row 12 - 16 177 | }; 178 | const unsigned char chr_f16_3F[16] = // 1 unsigned char per row 179 | { 180 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x02, 0x04, 0x08, 0x10, 0x10, // row 1 - 11 181 | 0x00, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 182 | }; 183 | const unsigned char chr_f16_40[16] = // 1 unsigned char per row 184 | { 185 | 0x00, 0x00, 0x00, 0x3C, 0x42, 0x99, 0xA5, 0xA5, 0xA5, 0xA5, 0x9E, // row 1 - 11 186 | 0x40, 0x3E, 0x00, 0x00, 0x00 // row 12 - 16 187 | }; 188 | const unsigned char chr_f16_41[16] = // 1 unsigned char per row 189 | { 190 | 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x7C, 0x82, // row 1 - 11 191 | 0x82, 0x82, 0x00, 0x00, 0x00 // row 12 - 16 192 | }; 193 | const unsigned char chr_f16_42[16] = // 1 unsigned char per row 194 | { 195 | 0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x84, 0xF8, 0x84, 0x82, 0x82, // row 1 - 11 196 | 0x84, 0xF8, 0x00, 0x00, 0x00 // row 12 - 16 197 | }; 198 | const unsigned char chr_f16_43[16] = // 1 unsigned char per row 199 | { 200 | 0x00, 0x00, 0x00, 0x3C, 0x42, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11 201 | 0x42, 0x3C, 0x00, 0x00, 0x00 // row 12 - 16 202 | }; 203 | const unsigned char chr_f16_44[16] = // 1 unsigned char per row 204 | { 205 | 0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11 206 | 0x84, 0xF8, 0x00, 0x00, 0x00 // row 12 - 16 207 | }; 208 | const unsigned char chr_f16_45[16] = // 1 unsigned char per row 209 | { 210 | 0x00, 0x00, 0x00, 0xFE, 0x80, 0x80, 0x80, 0xFC, 0x80, 0x80, 0x80, // row 1 - 11 211 | 0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16 212 | }; 213 | const unsigned char chr_f16_46[16] = // 1 unsigned char per row 214 | { 215 | 0x00, 0x00, 0x00, 0xFE, 0x80, 0x80, 0x80, 0xF8, 0x80, 0x80, 0x80, // row 1 - 11 216 | 0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16 217 | }; 218 | const unsigned char chr_f16_47[16] = // 1 unsigned char per row 219 | { 220 | 0x00, 0x00, 0x00, 0x3C, 0x42, 0x80, 0x80, 0x80, 0x9C, 0x82, 0x82, // row 1 - 11 221 | 0x42, 0x3C, 0x00, 0x00, 0x00 // row 12 - 16 222 | }; 223 | const unsigned char chr_f16_48[16] = // 1 unsigned char per row 224 | { 225 | 0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0xFC, 0x84, 0x84, 0x84, // row 1 - 11 226 | 0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16 227 | }; 228 | const unsigned char chr_f16_49[16] = // 1 unsigned char per row 229 | { 230 | 0x00, 0x00, 0x00, 0xE0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11 231 | 0x40, 0xE0, 0x00, 0x00, 0x00 // row 12 - 16 232 | }; 233 | const unsigned char chr_f16_4A[16] = // 1 unsigned char per row 234 | { 235 | 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x82, // row 1 - 11 236 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 237 | }; 238 | const unsigned char chr_f16_4B[16] = // 1 unsigned char per row 239 | { 240 | 0x00, 0x00, 0x00, 0x84, 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88, // row 1 - 11 241 | 0x84, 0x82, 0x00, 0x00, 0x00 // row 12 - 16 242 | }; 243 | const unsigned char chr_f16_4C[16] = // 1 unsigned char per row 244 | { 245 | 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11 246 | 0x80, 0xFC, 0x00, 0x00, 0x00 // row 12 - 16 247 | }; 248 | const unsigned char chr_f16_4D[32] = // 2 unsigned chars per row 249 | { 250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x80, 0xC1, 0x80, 0xA2, 0x80, // row 1 - 6 251 | 0xA2, 0x80, 0x94, 0x80, 0x94, 0x80, 0x88, 0x80, 0x88, 0x80, 0x80, 0x80, // row 7 - 12 252 | 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 253 | }; 254 | const unsigned char chr_f16_4E[16] = // 1 unsigned char per row 255 | { 256 | 0x00, 0x00, 0x00, 0xC2, 0xC2, 0xA2, 0xA2, 0x92, 0x92, 0x8A, 0x8A, // row 1 - 11 257 | 0x86, 0x86, 0x00, 0x00, 0x00 // row 12 - 16 258 | }; 259 | const unsigned char chr_f16_4F[16] = // 1 unsigned char per row 260 | { 261 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11 262 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 263 | }; 264 | const unsigned char chr_f16_50[16] = // 1 unsigned char per row 265 | { 266 | 0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x82, 0x84, 0xF8, 0x80, // row 1 - 11 267 | 0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16 268 | }; 269 | const unsigned char chr_f16_51[16] = // 1 unsigned char per row 270 | { 271 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11 272 | 0x44, 0x38, 0x08, 0x06, 0x00 // row 12 - 16 273 | }; 274 | const unsigned char chr_f16_52[16] = // 1 unsigned char per row 275 | { 276 | 0x00, 0x00, 0x00, 0xF8, 0x84, 0x82, 0x82, 0x84, 0xF8, 0x90, 0x88, // row 1 - 11 277 | 0x84, 0x82, 0x00, 0x00, 0x00 // row 12 - 16 278 | }; 279 | const unsigned char chr_f16_53[16] = // 1 unsigned char per row 280 | { 281 | 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x80, 0x60, 0x1C, 0x02, 0x82, // row 1 - 11 282 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 283 | }; 284 | const unsigned char chr_f16_54[16] = // 1 unsigned char per row 285 | { 286 | 0x00, 0x00, 0x00, 0xFE, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, // row 1 - 11 287 | 0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 288 | }; 289 | const unsigned char chr_f16_55[16] = // 1 unsigned char per row 290 | { 291 | 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, // row 1 - 11 292 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 293 | }; 294 | const unsigned char chr_f16_56[16] = // 1 unsigned char per row 295 | { 296 | 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, // row 1 - 11 297 | 0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 298 | }; 299 | const unsigned char chr_f16_57[32] = // 2 unsigned chars per row 300 | { 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 6 302 | 0x88, 0x80, 0x88, 0x80, 0x49, 0x00, 0x55, 0x00, 0x55, 0x00, 0x22, 0x00, // row 7 - 12 303 | 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 304 | }; 305 | const unsigned char chr_f16_58[16] = // 1 unsigned char per row 306 | { 307 | 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44, // row 1 - 11 308 | 0x82, 0x82, 0x00, 0x00, 0x00 // row 12 - 16 309 | }; 310 | const unsigned char chr_f16_59[16] = // 1 unsigned char per row 311 | { 312 | 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, // row 1 - 11 313 | 0x10, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 314 | }; 315 | const unsigned char chr_f16_5A[16] = // 1 unsigned char per row 316 | { 317 | 0x00, 0x00, 0x00, 0xFE, 0x02, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, // row 1 - 11 318 | 0x80, 0xFE, 0x00, 0x00, 0x00 // row 12 - 16 319 | }; 320 | const unsigned char chr_f16_5B[16] = // 1 unsigned char per row 321 | { 322 | 0x00, 0x00, 0xE0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // row 1 - 11 323 | 0x80, 0x80, 0xE0, 0x00, 0x00 // row 12 - 16 324 | }; 325 | const unsigned char chr_f16_5C[16] = // 1 unsigned char per row 326 | { 327 | 0x00, 0x00, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, // row 1 - 11 328 | 0x40, 0x80, 0x80, 0x00, 0x00 // row 12 - 16 329 | }; 330 | const unsigned char chr_f16_5D[16] = // 1 unsigned char per row 331 | { 332 | 0x00, 0x00, 0xE0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, // row 1 - 11 333 | 0x20, 0x20, 0xE0, 0x00, 0x00 // row 12 - 16 334 | }; 335 | const unsigned char chr_f16_5E[32] = // 2 unsigned chars per row 336 | { 337 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7B, 0xDE, 0x84, 0x21, 0x84, 0x21, // row 1 - 6 338 | 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, 0x84, 0x21, // row 7 - 12 339 | 0x84, 0x21, 0x84, 0x21, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 340 | }; 341 | const unsigned char chr_f16_5F[32] = // 2 unsigned chars per row 342 | { 343 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x08, 0x52, 0x94, 0x4A, 0x52, // row 1 - 6 344 | 0x84, 0x21, 0x84, 0x21, 0x08, 0x42, 0x08, 0x42, 0x10, 0x84, 0x10, 0x84, // row 7 - 12 345 | 0x21, 0x08, 0x21, 0x08, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 346 | }; 347 | const unsigned char chr_f16_60[16] = // 1 unsigned char per row 348 | { 349 | 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 350 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 351 | }; 352 | const unsigned char chr_f16_61[16] = // 1 unsigned char per row 353 | { 354 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x08, 0x04, 0x74, 0x8C, // row 1 - 11 355 | 0x8C, 0x74, 0x00, 0x00, 0x00 // row 12 - 16 356 | }; 357 | const unsigned char chr_f16_62[16] = // 1 unsigned char per row 358 | { 359 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11 360 | 0xC8, 0xB0, 0x00, 0x00, 0x00 // row 12 - 16 361 | }; 362 | const unsigned char chr_f16_63[16] = // 1 unsigned char per row 363 | { 364 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x80, 0x80, 0x80, // row 1 - 11 365 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 366 | }; 367 | const unsigned char chr_f16_64[16] = // 1 unsigned char per row 368 | { 369 | 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x34, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11 370 | 0x4C, 0x34, 0x00, 0x00, 0x00 // row 12 - 16 371 | }; 372 | const unsigned char chr_f16_65[16] = // 1 unsigned char per row 373 | { 374 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x84, 0xF8, 0x80, // row 1 - 11 375 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 376 | }; 377 | const unsigned char chr_f16_66[16] = // 1 unsigned char per row 378 | { 379 | 0x00, 0x00, 0x00, 0x30, 0x48, 0x40, 0x40, 0x40, 0xE0, 0x40, 0x40, // row 1 - 11 380 | 0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16 381 | }; 382 | const unsigned char chr_f16_67[16] = // 1 unsigned char per row 383 | { 384 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11 385 | 0x4C, 0x34, 0x04, 0x08, 0x70 // row 12 - 16 386 | }; 387 | const unsigned char chr_f16_68[16] = // 1 unsigned char per row 388 | { 389 | 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11 390 | 0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16 391 | }; 392 | const unsigned char chr_f16_69[16] = // 1 unsigned char per row 393 | { 394 | 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11 395 | 0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16 396 | }; 397 | const unsigned char chr_f16_6A[16] = // 1 unsigned char per row 398 | { 399 | 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, // row 1 - 11 400 | 0x10, 0x10, 0x10, 0x90, 0x60 // row 12 - 16 401 | }; 402 | const unsigned char chr_f16_6B[16] = // 1 unsigned char per row 403 | { 404 | 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x88, 0x90, 0xA0, 0xC0, 0xA0, // row 1 - 11 405 | 0x90, 0x88, 0x00, 0x00, 0x00 // row 12 - 16 406 | }; 407 | const unsigned char chr_f16_6C[16] = // 1 unsigned char per row 408 | { 409 | 0x00, 0x00, 0x00, 0xC0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, // row 1 - 11 410 | 0x40, 0x40, 0x00, 0x00, 0x00 // row 12 - 16 411 | }; 412 | const unsigned char chr_f16_6D[16] = // 1 unsigned char per row 413 | { 414 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAC, 0xD2, 0x92, 0x92, 0x92, // row 1 - 11 415 | 0x92, 0x92, 0x00, 0x00, 0x00 // row 12 - 16 416 | }; 417 | const unsigned char chr_f16_6E[16] = // 1 unsigned char per row 418 | { 419 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11 420 | 0x84, 0x84, 0x00, 0x00, 0x00 // row 12 - 16 421 | }; 422 | const unsigned char chr_f16_6F[16] = // 1 unsigned char per row 423 | { 424 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x82, 0x82, // row 1 - 11 425 | 0x44, 0x38, 0x00, 0x00, 0x00 // row 12 - 16 426 | }; 427 | const unsigned char chr_f16_70[16] = // 1 unsigned char per row 428 | { 429 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x84, 0x84, 0x84, // row 1 - 11 430 | 0xC8, 0xB0, 0x80, 0x80, 0x80 // row 12 - 16 431 | }; 432 | const unsigned char chr_f16_71[16] = // 1 unsigned char per row 433 | { 434 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x4C, 0x84, 0x84, 0x84, // row 1 - 11 435 | 0x4C, 0x34, 0x04, 0x04, 0x06 // row 12 - 16 436 | }; 437 | const unsigned char chr_f16_72[16] = // 1 unsigned char per row 438 | { 439 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0xC8, 0x80, 0x80, 0x80, // row 1 - 11 440 | 0x80, 0x80, 0x00, 0x00, 0x00 // row 12 - 16 441 | }; 442 | const unsigned char chr_f16_73[16] = // 1 unsigned char per row 443 | { 444 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x88, 0x80, 0x70, 0x08, // row 1 - 11 445 | 0x88, 0x70, 0x00, 0x00, 0x00 // row 12 - 16 446 | }; 447 | const unsigned char chr_f16_74[16] = // 1 unsigned char per row 448 | { 449 | 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0xE0, 0x40, 0x40, 0x40, 0x40, // row 1 - 11 450 | 0x40, 0x30, 0x00, 0x00, 0x00 // row 12 - 16 451 | }; 452 | const unsigned char chr_f16_75[16] = // 1 unsigned char per row 453 | { 454 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, // row 1 - 11 455 | 0x4C, 0x34, 0x00, 0x00, 0x00 // row 12 - 16 456 | }; 457 | const unsigned char chr_f16_76[16] = // 1 unsigned char per row 458 | { 459 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x82, 0x44, // row 1 - 11 460 | 0x28, 0x10, 0x00, 0x00, 0x00 // row 12 - 16 461 | }; 462 | const unsigned char chr_f16_77[16] = // 1 unsigned char per row 463 | { 464 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x92, 0x92, // row 1 - 11 465 | 0xAA, 0x44, 0x00, 0x00, 0x00 // row 12 - 16 466 | }; 467 | const unsigned char chr_f16_78[16] = // 1 unsigned char per row 468 | { 469 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88, 0x50, 0x20, 0x50, // row 1 - 11 470 | 0x88, 0x88, 0x00, 0x00, 0x00 // row 12 - 16 471 | }; 472 | const unsigned char chr_f16_79[16] = // 1 unsigned char per row 473 | { 474 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x84, 0x84, 0x84, 0x84, // row 1 - 11 475 | 0x4C, 0x34, 0x04, 0x08, 0x70 // row 12 - 16 476 | }; 477 | const unsigned char chr_f16_7A[16] = // 1 unsigned char per row 478 | { 479 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x04, 0x08, 0x30, 0x40, // row 1 - 11 480 | 0x80, 0xFC, 0x00, 0x00, 0x00 // row 12 - 16 481 | }; 482 | const unsigned char chr_f16_7B[32] = // 2 unsigned chars per row 483 | { 484 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x41, 0x00, 0x9C, 0x80, // row 1 - 6 485 | 0xA0, 0x80, 0xA0, 0x80, 0xA0, 0x80, 0x9C, 0x80, 0x41, 0x00, 0x3E, 0x00, // row 7 - 12 486 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 487 | }; 488 | const unsigned char chr_f16_7C[32] = // 2 unsigned chars per row 489 | { 490 | 0x00, 0x00, 0xF0, 0x00, 0x88, 0x00, 0x88, 0x00, 0xF0, 0x00, 0xA3, 0xC0, // row 1 - 6 491 | 0x92, 0x20, 0x8A, 0x20, 0x03, 0xC4, 0x02, 0x0A, 0x02, 0x11, 0x02, 0x11, // row 7 - 12 492 | 0x00, 0x1F, 0x00, 0x11, 0x00, 0x11, 0x00, 0x00 // row 13 - 16 493 | }; 494 | const unsigned char chr_f16_7D[16] = // 1 unsigned char per row 495 | { 496 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, // row 1 - 11 497 | 0x32, 0x2C, 0x20, 0x40, 0x80 // row 12 - 16 498 | }; 499 | const unsigned char chr_f16_7E[16] = // 1 unsigned char per row 500 | { 501 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 11 502 | 0x00, 0x00, 0x00, 0x00, 0x00 // row 12 - 16 503 | }; 504 | const unsigned char chr_f16_7F[32] = // 2 unsigned chars per row 505 | { 506 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6 507 | 0x00, 0x00, 0x34, 0xD0, 0x2A, 0xA8, 0x2A, 0xA8, 0x2A, 0xA8, 0x2A, 0xA8, // row 7 - 12 508 | 0x2A, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 13 - 16 509 | }; 510 | 511 | const unsigned char* chrtbl_f16[96] = // character pointer table 512 | { 513 | chr_f16_20, chr_f16_21, chr_f16_22, chr_f16_23, chr_f16_24, chr_f16_25, chr_f16_26, chr_f16_27, 514 | chr_f16_28, chr_f16_29, chr_f16_2A, chr_f16_2B, chr_f16_2C, chr_f16_2D, chr_f16_2E, chr_f16_2F, 515 | chr_f16_30, chr_f16_31, chr_f16_32, chr_f16_33, chr_f16_34, chr_f16_35, chr_f16_36, chr_f16_37, 516 | chr_f16_38, chr_f16_39, chr_f16_3A, chr_f16_3B, chr_f16_3C, chr_f16_3D, chr_f16_3E, chr_f16_3F, 517 | chr_f16_40, chr_f16_41, chr_f16_42, chr_f16_43, chr_f16_44, chr_f16_45, chr_f16_46, chr_f16_47, 518 | chr_f16_48, chr_f16_49, chr_f16_4A, chr_f16_4B, chr_f16_4C, chr_f16_4D, chr_f16_4E, chr_f16_4F, 519 | chr_f16_50, chr_f16_51, chr_f16_52, chr_f16_53, chr_f16_54, chr_f16_55, chr_f16_56, chr_f16_57, 520 | chr_f16_58, chr_f16_59, chr_f16_5A, chr_f16_5B, chr_f16_5C, chr_f16_5D, chr_f16_5E, chr_f16_5F, 521 | chr_f16_60, chr_f16_61, chr_f16_62, chr_f16_63, chr_f16_64, chr_f16_65, chr_f16_66, chr_f16_67, 522 | chr_f16_68, chr_f16_69, chr_f16_6A, chr_f16_6B, chr_f16_6C, chr_f16_6D, chr_f16_6E, chr_f16_6F, 523 | chr_f16_70, chr_f16_71, chr_f16_72, chr_f16_73, chr_f16_74, chr_f16_75, chr_f16_76, chr_f16_77, 524 | chr_f16_78, chr_f16_79, chr_f16_7A, chr_f16_7B, chr_f16_7C, chr_f16_7D, chr_f16_7E, chr_f16_7F 525 | }; 526 | -------------------------------------------------------------------------------- /driver/Font64.c: -------------------------------------------------------------------------------- 1 | // Font size 6 is intended to display numbers and time 2 | // This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 . : a p m 3 | // The Pipe character | is a narrow space to aid formatting 4 | // All other characters print as a space 5 | 6 | 7 | #include "Font64.h" 8 | 9 | const unsigned char widtbl_f64[96] = // character width table 10 | { 11 | 15, 15, 15, 15, 15, 15, 15, 15, // char 32 - 39 12 | 15, 15, 15, 15, 15, 15, 18, 15, // char 40 - 47 13 | 30, 30, 30, 30, 30, 30, 30, 30, // char 48 - 55 14 | 30, 30, 18, 15, 15, 15, 15, 15, // char 56 - 63 15 | 15, 15, 15, 15, 15, 15, 15, 15, // char 64 - 71 16 | 15, 15, 15, 15, 15, 15, 15, 15, // char 72 - 79 17 | 15, 15, 15, 15, 15, 15, 15, 15, // char 80 - 87 18 | 15, 15, 15, 15, 15, 15, 15, 15, // char 88 - 95 19 | 15, 30, 15, 15, 15, 15, 15, 15, // char 96 - 103 20 | 15, 15, 15, 15, 15, 45, 15, 15, // char 104 - 111 21 | 32, 15, 15, 15, 15, 15, 15, 15, // char 112 - 119 22 | 15, 15, 15, 15, 10, 15, 15, 15 // char 120 - 127 23 | }; 24 | 25 | // Row format, MSB left 26 | 27 | const unsigned char chr_f64_20[96] = // 2 bytes per row 28 | { 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42 36 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48 37 | }; 38 | const unsigned char chr_f64_2E[144] = // 3 bytes per row 39 | { 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 4 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 8 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 9 - 12 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 16 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 17 - 20 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 21 - 24 46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 28 47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 29 - 32 48 | 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 33 - 36 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 40 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 44 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 45 - 48 52 | }; 53 | const unsigned char chr_f64_30[192] = // 4 bytes per row 54 | { 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 1 - 3 56 | 0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6 57 | 0x1F, 0x00, 0x3E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9 58 | 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12 59 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 13 - 15 60 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 16 - 18 61 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 19 - 21 62 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 22 - 24 63 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 25 - 27 64 | 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 28 - 30 65 | 0x1E, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33 66 | 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 34 - 36 67 | 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 71 | }; 72 | const unsigned char chr_f64_31[192] = // 4 bytes per row 73 | { 74 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xC0, 0x00, 0x00, 0x01, 0xC0, 0x00, // row 1 - 3 75 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 4 - 6 76 | 0x00, 0x0F, 0xC0, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x07, 0xFF, 0xC0, 0x00, // row 7 - 9 77 | 0x07, 0xFF, 0xC0, 0x00, 0x07, 0xFB, 0xC0, 0x00, 0x07, 0xC3, 0xC0, 0x00, // row 10 - 12 78 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 13 - 15 79 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 16 - 18 80 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 19 - 21 81 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 22 - 24 82 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 25 - 27 83 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 28 - 30 84 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 31 - 33 85 | 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x03, 0xC0, 0x00, // row 34 - 36 86 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 87 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 89 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 90 | }; 91 | const unsigned char chr_f64_32[192] = // 4 bytes per row 92 | { 93 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0xFF, 0xF8, 0x00, // row 1 - 3 94 | 0x03, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xFE, 0x00, 0x07, 0xE0, 0x7F, 0x00, // row 4 - 6 95 | 0x0F, 0x80, 0x1F, 0x00, 0x0F, 0x80, 0x0F, 0x00, 0x0F, 0x00, 0x0F, 0x80, // row 7 - 9 96 | 0x1F, 0x00, 0x07, 0x80, 0x1E, 0x00, 0x07, 0x80, 0x1E, 0x00, 0x07, 0x80, // row 10 - 12 97 | 0x1E, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x80, // row 13 - 15 98 | 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0x00, // row 16 - 18 99 | 0x00, 0x00, 0x7E, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x07, 0xF8, 0x00, // row 19 - 21 100 | 0x00, 0x1F, 0xF0, 0x00, 0x00, 0x3F, 0xE0, 0x00, 0x00, 0xFF, 0x80, 0x00, // row 22 - 24 101 | 0x01, 0xFE, 0x00, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, // row 25 - 27 102 | 0x0F, 0xC0, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, // row 28 - 30 103 | 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x80, // row 31 - 33 104 | 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, // row 34 - 36 105 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 106 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 108 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 109 | }; 110 | const unsigned char chr_f64_33[192] = // 4 bytes per row 111 | { 112 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 1 - 3 113 | 0x07, 0xFF, 0xFC, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6 114 | 0x1F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9 115 | 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12 116 | 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3E, 0x00, // row 13 - 15 117 | 0x00, 0x00, 0x7E, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x3F, 0xF0, 0x00, // row 16 - 18 118 | 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x3F, 0xFE, 0x00, 0x00, 0x00, 0x7F, 0x00, // row 19 - 21 119 | 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x0F, 0x80, // row 22 - 24 120 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27 121 | 0x7C, 0x00, 0x0F, 0x80, 0x7C, 0x00, 0x1F, 0x80, 0x3E, 0x00, 0x1F, 0x00, // row 28 - 30 122 | 0x3F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, 0x0F, 0xFF, 0xFC, 0x00, // row 31 - 33 123 | 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, 0x00, 0x7F, 0x80, 0x00, // row 34 - 36 124 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 125 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 126 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 127 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 128 | }; 129 | const unsigned char chr_f64_34[192] = // 4 bytes per row 130 | { 131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 1 - 3 132 | 0x00, 0x01, 0xF0, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x07, 0xF0, 0x00, // row 4 - 6 133 | 0x00, 0x07, 0xF0, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x00, 0x1E, 0xF0, 0x00, // row 7 - 9 134 | 0x00, 0x1E, 0xF0, 0x00, 0x00, 0x3C, 0xF0, 0x00, 0x00, 0x78, 0xF0, 0x00, // row 10 - 12 135 | 0x00, 0xF8, 0xF0, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x01, 0xE0, 0xF0, 0x00, // row 13 - 15 136 | 0x03, 0xC0, 0xF0, 0x00, 0x07, 0xC0, 0xF0, 0x00, 0x07, 0x80, 0xF0, 0x00, // row 16 - 18 137 | 0x0F, 0x00, 0xF0, 0x00, 0x1F, 0x00, 0xF0, 0x00, 0x1E, 0x00, 0xF0, 0x00, // row 19 - 21 138 | 0x3C, 0x00, 0xF0, 0x00, 0x78, 0x00, 0xF0, 0x00, 0x7F, 0xFF, 0xFF, 0x80, // row 22 - 24 139 | 0x7F, 0xFF, 0xFF, 0x80, 0x7F, 0xFF, 0xFF, 0x80, 0x7F, 0xFF, 0xFF, 0x80, // row 25 - 27 140 | 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 28 - 30 141 | 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 31 - 33 142 | 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, // row 34 - 36 143 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 144 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 146 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 147 | }; 148 | const unsigned char chr_f64_35[192] = // 4 bytes per row 149 | { 150 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF, 0xFE, 0x00, // row 1 - 3 151 | 0x07, 0xFF, 0xFE, 0x00, 0x07, 0xFF, 0xFE, 0x00, 0x07, 0xFF, 0xFE, 0x00, // row 4 - 6 152 | 0x07, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, // row 7 - 9 153 | 0x0F, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, // row 10 - 12 154 | 0x0E, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0xC0, 0x00, 0x1E, 0xFF, 0xF0, 0x00, // row 13 - 15 155 | 0x1F, 0xFF, 0xF8, 0x00, 0x1F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 16 - 18 156 | 0x1F, 0x00, 0x3F, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x0F, 0x00, // row 19 - 21 157 | 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, // row 22 - 24 158 | 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x07, 0x80, // row 25 - 27 159 | 0x3C, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 28 - 30 160 | 0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33 161 | 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 34 - 36 162 | 0x00, 0x7F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 163 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 164 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 165 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 166 | }; 167 | const unsigned char chr_f64_36[192] = // 4 bytes per row 168 | { 169 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0xFF, 0xF0, 0x00, // row 1 - 3 170 | 0x03, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xFC, 0x00, 0x0F, 0xE0, 0x7E, 0x00, // row 4 - 6 171 | 0x1F, 0x80, 0x1F, 0x00, 0x1F, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x80, // row 7 - 9 172 | 0x3E, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x00, 0x00, // row 10 - 12 173 | 0x3C, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x3F, 0x80, 0x00, // row 13 - 15 174 | 0x78, 0xFF, 0xF0, 0x00, 0x7B, 0xFF, 0xF8, 0x00, 0x7F, 0xFF, 0xFC, 0x00, // row 16 - 18 175 | 0x7F, 0xC0, 0xFE, 0x00, 0x7F, 0x00, 0x3E, 0x00, 0x7E, 0x00, 0x1F, 0x00, // row 19 - 21 176 | 0x7C, 0x00, 0x0F, 0x00, 0x7C, 0x00, 0x0F, 0x80, 0x78, 0x00, 0x07, 0x80, // row 22 - 24 177 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27 178 | 0x78, 0x00, 0x07, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x00, // row 28 - 30 179 | 0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x3F, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 31 - 33 180 | 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x01, 0xFF, 0xF0, 0x00, // row 34 - 36 181 | 0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 182 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 183 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 184 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 185 | }; 186 | const unsigned char chr_f64_37[192] = // 4 bytes per row 187 | { 188 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFF, 0x80, // row 1 - 3 189 | 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, 0x3F, 0xFF, 0xFF, 0x80, // row 4 - 6 190 | 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1E, 0x00, // row 7 - 9 191 | 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0xF8, 0x00, // row 10 - 12 192 | 0x00, 0x01, 0xF0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, // row 13 - 15 193 | 0x00, 0x07, 0xC0, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x0F, 0x80, 0x00, // row 16 - 18 194 | 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, // row 19 - 21 195 | 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, // row 22 - 24 196 | 0x00, 0x7C, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, // row 25 - 27 197 | 0x00, 0xF8, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, // row 28 - 30 198 | 0x00, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x01, 0xF0, 0x00, 0x00, // row 31 - 33 199 | 0x01, 0xE0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, // row 34 - 36 200 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 201 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 203 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 204 | }; 205 | const unsigned char chr_f64_38[192] = // 4 bytes per row 206 | { 207 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x01, 0xFF, 0xE0, 0x00, // row 1 - 3 208 | 0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6 209 | 0x1F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x1F, 0x00, // row 7 - 9 210 | 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 10 - 12 211 | 0x3E, 0x00, 0x1F, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1F, 0x00, 0x3E, 0x00, // row 13 - 15 212 | 0x0F, 0xC0, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, 0x03, 0xFF, 0xF0, 0x00, // row 16 - 18 213 | 0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0x80, 0x7E, 0x00, // row 19 - 21 214 | 0x3E, 0x00, 0x1F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x7C, 0x00, 0x0F, 0x80, // row 22 - 24 215 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 25 - 27 216 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x7C, 0x00, 0x0F, 0x80, // row 28 - 30 217 | 0x7C, 0x00, 0x0F, 0x80, 0x3E, 0x00, 0x1F, 0x00, 0x3F, 0x80, 0x7F, 0x00, // row 31 - 33 218 | 0x1F, 0xFF, 0xFE, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x07, 0xFF, 0xF8, 0x00, // row 34 - 36 219 | 0x00, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 220 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 221 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 222 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 223 | }; 224 | const unsigned char chr_f64_39[192] = // 4 bytes per row 225 | { 226 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x03, 0xFF, 0xE0, 0x00, // row 1 - 3 227 | 0x07, 0xFF, 0xF8, 0x00, 0x0F, 0xFF, 0xFC, 0x00, 0x1F, 0xC0, 0xFE, 0x00, // row 4 - 6 228 | 0x3F, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x1F, 0x00, 0x3C, 0x00, 0x0F, 0x00, // row 7 - 9 229 | 0x7C, 0x00, 0x0F, 0x00, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 10 - 12 230 | 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, 0x78, 0x00, 0x07, 0x80, // row 13 - 15 231 | 0x7C, 0x00, 0x0F, 0x80, 0x3C, 0x00, 0x0F, 0x80, 0x3E, 0x00, 0x1F, 0x80, // row 16 - 18 232 | 0x1F, 0x00, 0x3F, 0x80, 0x1F, 0xC0, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0x80, // row 19 - 21 233 | 0x07, 0xFF, 0xF7, 0x80, 0x03, 0xFF, 0xC7, 0x80, 0x00, 0x7F, 0x07, 0x80, // row 22 - 24 234 | 0x00, 0x00, 0x07, 0x80, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x0F, 0x00, // row 25 - 27 235 | 0x78, 0x00, 0x0F, 0x00, 0x78, 0x00, 0x1F, 0x00, 0x7C, 0x00, 0x1E, 0x00, // row 28 - 30 236 | 0x3C, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x7E, 0x00, 0x1F, 0x81, 0xFC, 0x00, // row 31 - 33 237 | 0x0F, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xF0, 0x00, 0x03, 0xFF, 0xC0, 0x00, // row 34 - 36 238 | 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 239 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 242 | }; 243 | const unsigned char chr_f64_3A[144] = // 3 bytes per row 244 | { 245 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 4 246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 8 247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 9 - 12 248 | 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00, 0x00, // row 13 - 16 249 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 17 - 20 250 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 21 - 24 251 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, // row 25 - 28 252 | 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xC0, 0x00, // row 29 - 32 253 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 33 - 36 254 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 40 255 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 44 256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 45 - 48 257 | }; 258 | const unsigned char chr_f64_61[192] = // 4 bytes per row 259 | { 260 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3 261 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 4 - 6 262 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 9 263 | 0x00, 0x7F, 0xC0, 0x00, 0x01, 0xFF, 0xF8, 0x00, 0x07, 0xFF, 0xFC, 0x00, // row 10 - 12 264 | 0x07, 0xFF, 0xFE, 0x00, 0x0F, 0xC0, 0x7E, 0x00, 0x1F, 0x00, 0x1F, 0x00, // row 13 - 15 265 | 0x1E, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x00, 0x1E, 0x00, 0x0F, 0x00, // row 16 - 18 266 | 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x0F, 0xFF, 0x00, // row 19 - 21 267 | 0x01, 0xFF, 0xFF, 0x00, 0x07, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xCF, 0x00, // row 22 - 24 268 | 0x1F, 0xF0, 0x0F, 0x00, 0x1F, 0x00, 0x0F, 0x00, 0x3E, 0x00, 0x0F, 0x00, // row 25 - 27 269 | 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x3C, 0x00, 0x1F, 0x00, // row 28 - 30 270 | 0x3C, 0x00, 0x3F, 0x00, 0x3E, 0x00, 0x7F, 0x00, 0x1F, 0x01, 0xFF, 0xC0, // row 31 - 33 271 | 0x1F, 0xFF, 0xE7, 0xC0, 0x0F, 0xFF, 0xC7, 0xC0, 0x07, 0xFF, 0x03, 0xC0, // row 34 - 36 272 | 0x01, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 39 273 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 40 - 42 274 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 275 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 276 | }; 277 | const unsigned char chr_f64_6D[288] = // 6 bytes per row 278 | { 279 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 2 280 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 3 - 4 281 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 5 - 6 282 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 8 283 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x1F, 0xC0, 0x00, // row 9 - 10 284 | 0x1E, 0x3F, 0xF0, 0x7F, 0xF0, 0x00, 0x1E, 0xFF, 0xF8, 0xFF, 0xF8, 0x00, // row 11 - 12 285 | 0x1E, 0xFF, 0xFD, 0xFF, 0xFC, 0x00, 0x1F, 0xE0, 0x7F, 0xE0, 0x7C, 0x00, // row 13 - 14 286 | 0x1F, 0x80, 0x3F, 0x80, 0x3E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1E, 0x00, // row 15 - 16 287 | 0x1F, 0x00, 0x1F, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 17 - 18 288 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 19 - 20 289 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 21 - 22 290 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 23 - 24 291 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 25 - 26 292 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 27 - 28 293 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 29 - 30 294 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 31 - 32 295 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 33 - 34 296 | 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, 0x1E, 0x00, // row 35 - 36 297 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 38 298 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 39 - 40 299 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 41 - 42 300 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 44 301 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 45 - 46 302 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 47 - 48 303 | }; 304 | const unsigned char chr_f64_70[192] = // 4 bytes per row 305 | { 306 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3 307 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 4 - 6 308 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 9 309 | 0x00, 0x0F, 0xE0, 0x00, 0x1E, 0x3F, 0xFC, 0x00, 0x1E, 0x7F, 0xFE, 0x00, // row 10 - 12 310 | 0x1E, 0xFF, 0xFF, 0x00, 0x1F, 0xF0, 0x3F, 0x80, 0x1F, 0xC0, 0x0F, 0x80, // row 13 - 15 311 | 0x1F, 0x80, 0x07, 0xC0, 0x1F, 0x00, 0x03, 0xC0, 0x1F, 0x00, 0x03, 0xC0, // row 16 - 18 312 | 0x1F, 0x00, 0x03, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 19 - 21 313 | 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 22 - 24 314 | 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, 0x1E, 0x00, 0x01, 0xE0, // row 25 - 27 315 | 0x1E, 0x00, 0x03, 0xE0, 0x1F, 0x00, 0x03, 0xC0, 0x1F, 0x00, 0x07, 0xC0, // row 28 - 30 316 | 0x1F, 0x80, 0x07, 0xC0, 0x1F, 0xC0, 0x0F, 0x80, 0x1F, 0xF0, 0x3F, 0x80, // row 31 - 33 317 | 0x1E, 0xFF, 0xFF, 0x00, 0x1E, 0x7F, 0xFE, 0x00, 0x1E, 0x3F, 0xFC, 0x00, // row 34 - 36 318 | 0x1E, 0x0F, 0xE0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 37 - 39 319 | 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 40 - 42 320 | 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 43 - 45 321 | 0x1E, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 322 | }; 323 | 324 | const unsigned char * chrtbl_f64[96] = // character pointer table 325 | { 326 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 327 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_2E, chr_f64_20, 328 | chr_f64_30, chr_f64_31, chr_f64_32, chr_f64_33, chr_f64_34, chr_f64_35, chr_f64_36, chr_f64_37, 329 | chr_f64_38, chr_f64_39, chr_f64_3A, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 330 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 331 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 332 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 333 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 334 | chr_f64_20, chr_f64_61, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 335 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_6D, chr_f64_20, chr_f64_20, 336 | chr_f64_70, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, 337 | chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20, chr_f64_20 338 | }; 339 | -------------------------------------------------------------------------------- /driver/Font7s.c: -------------------------------------------------------------------------------- 1 | // Font size 7 is a 7 segment font intended to display numbers and time 2 | // This font only contains characters [space] 0 1 2 3 4 5 6 7 8 9 : . 3 | // All other characters print as a space 4 | 5 | #include "Font7s.h" 6 | 7 | 8 | const unsigned char widtbl_f7s[96] = // character width table 9 | { 10 | 12, 12, 12, 12, 12, 12, 12, 12, // char 32 - 39 11 | 12, 12, 12, 12, 12, 12, 12, 12, // char 40 - 47 12 | 32, 32, 32, 32, 32, 32, 32, 32, // char 48 - 55 13 | 32, 32, 12, 12, 12, 12, 12, 12, // char 56 - 63 14 | 12, 12, 12, 12, 12, 12, 12, 12, // char 64 - 71 15 | 12, 12, 12, 12, 12, 12, 12, 12, // char 72 - 79 16 | 12, 12, 12, 12, 12, 12, 12, 12, // char 80 - 87 17 | 12, 12, 12, 12, 12, 12, 12, 12, // char 88 - 95 18 | 12, 12, 12, 12, 12, 12, 12, 12, // char 96 - 103 19 | 12, 12, 12, 12, 12, 12, 12, 12, // char 104 - 111 20 | 12, 12, 12, 12, 12, 12, 12, 12, // char 112 - 119 21 | 12, 12, 12, 12, 12, 12, 12, 12 // char 120 - 127 22 | }; 23 | 24 | // Row format, MSB left 25 | 26 | const unsigned char chr_f7s_20[96] = // 2 bytes per row 27 | { 28 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6 29 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12 30 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18 31 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24 32 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30 33 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36 34 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42 35 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48 36 | }; 37 | const unsigned char chr_f7s_2E[96] = // 2 bytes per row 38 | { 39 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 13 - 18 42 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24 43 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 31 - 36 45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42 46 | 0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x00, 0x00 // row 43 - 48 47 | }; 48 | const unsigned char chr_f7s_30[192] = // 4 bytes per row 49 | { 50 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 51 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6 52 | 0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9 53 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12 54 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15 55 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18 56 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21 57 | 0x38, 0x00, 0x00, 0x38, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24 58 | 0x20, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27 59 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30 60 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33 61 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36 62 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39 63 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42 64 | 0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 65 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 66 | }; 67 | const unsigned char chr_f7s_31[192] = // 4 bytes per row 68 | { 69 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3 70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x70, // row 4 - 6 71 | 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9 72 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12 73 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15 74 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18 75 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0x78, // row 19 - 21 76 | 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24 77 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 78 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 79 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 80 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 81 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 82 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 83 | 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 84 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 85 | }; 86 | const unsigned char chr_f7s_32[192] = // 4 bytes per row 87 | { 88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 89 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6 90 | 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9 91 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12 92 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15 93 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18 94 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21 95 | 0x00, 0xFF, 0xFE, 0x38, 0x03, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 96 | 0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 25 - 27 97 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 28 - 30 98 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 31 - 33 99 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 34 - 36 100 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 37 - 39 101 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, // row 40 - 42 102 | 0x0C, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 103 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 104 | }; 105 | const unsigned char chr_f7s_33[192] = // 4 bytes per row 106 | { 107 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 108 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6 109 | 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9 110 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12 111 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15 112 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18 113 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21 114 | 0x00, 0xFF, 0xFE, 0x38, 0x03, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 115 | 0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 116 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 117 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 118 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 119 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 120 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 121 | 0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 122 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 123 | }; 124 | const unsigned char chr_f7s_34[192] = // 4 bytes per row 125 | { 126 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 3 127 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0C, 0x00, 0x00, 0x70, // row 4 - 6 128 | 0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9 129 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12 130 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15 131 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18 132 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21 133 | 0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 134 | 0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 135 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 136 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 137 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 138 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 139 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 140 | 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 141 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 142 | }; 143 | const unsigned char chr_f7s_35[192] = // 4 bytes per row 144 | { 145 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 146 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x00, 0x0C, 0xFF, 0xFE, 0x00, // row 4 - 6 147 | 0x1E, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 7 - 9 148 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 10 - 12 149 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 13 - 15 150 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 16 - 18 151 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 19 - 21 152 | 0x38, 0xFF, 0xFE, 0x00, 0x23, 0xFF, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 153 | 0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 154 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 155 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 156 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 157 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 158 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 159 | 0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 160 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 161 | }; 162 | const unsigned char chr_f7s_36[192] = // 4 bytes per row 163 | { 164 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 165 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x00, 0x0C, 0xFF, 0xFE, 0x00, // row 4 - 6 166 | 0x1E, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 7 - 9 167 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 10 - 12 168 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 13 - 15 169 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, // row 16 - 18 170 | 0x3F, 0x00, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, // row 19 - 21 171 | 0x38, 0xFF, 0xFE, 0x00, 0x23, 0xFF, 0xFF, 0x80, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 172 | 0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27 173 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30 174 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33 175 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36 176 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39 177 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42 178 | 0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 179 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 180 | }; 181 | const unsigned char chr_f7s_37[192] = // 4 bytes per row 182 | { 183 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 184 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x00, 0xFF, 0xFE, 0x70, // row 4 - 6 185 | 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 7 - 9 186 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 10 - 12 187 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 13 - 15 188 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 16 - 18 189 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF8, // row 19 - 21 190 | 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, // row 22 - 24 191 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 192 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 193 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 194 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 195 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 196 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 197 | 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 43 - 45 198 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 199 | }; 200 | const unsigned char chr_f7s_38[192] = // 4 bytes per row 201 | { 202 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 203 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6 204 | 0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9 205 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12 206 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15 207 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18 208 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21 209 | 0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 210 | 0x27, 0xFF, 0xFF, 0xC0, 0x39, 0xFF, 0xFF, 0x18, 0x3E, 0x00, 0x00, 0x78, // row 25 - 27 211 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 28 - 30 212 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 31 - 33 213 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 34 - 36 214 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 37 - 39 215 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x1E, 0x00, 0x00, 0xF0, // row 40 - 42 216 | 0x0C, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 217 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 218 | }; 219 | const unsigned char chr_f7s_39[192] = // 4 bytes per row 220 | { 221 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x01, 0xFF, 0xFF, 0x00, // row 1 - 3 222 | 0x03, 0xFF, 0xFF, 0x80, 0x01, 0xFF, 0xFF, 0x20, 0x0C, 0xFF, 0xFE, 0x70, // row 4 - 6 223 | 0x1E, 0x00, 0x00, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 7 - 9 224 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 10 - 12 225 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 13 - 15 226 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, // row 16 - 18 227 | 0x3F, 0x00, 0x01, 0xF8, 0x3F, 0x00, 0x01, 0xF8, 0x3E, 0x00, 0x00, 0xF8, // row 19 - 21 228 | 0x38, 0xFF, 0xFE, 0x38, 0x23, 0xFF, 0xFF, 0x88, 0x0F, 0xFF, 0xFF, 0xE0, // row 22 - 24 229 | 0x07, 0xFF, 0xFF, 0xC0, 0x01, 0xFF, 0xFF, 0x18, 0x00, 0x00, 0x00, 0x78, // row 25 - 27 230 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 28 - 30 231 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 31 - 33 232 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 34 - 36 233 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, // row 37 - 39 234 | 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x00, 0xF0, // row 40 - 42 235 | 0x00, 0xFF, 0xFE, 0x60, 0x01, 0xFF, 0xFF, 0x00, 0x03, 0xFF, 0xFF, 0x80, // row 43 - 45 236 | 0x01, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00 // row 46 - 48 237 | }; 238 | const unsigned char chr_f7s_3A[96] = // 2 bytes per row 239 | { 240 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 1 - 6 241 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 7 - 12 242 | 0x00, 0x00, 0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, // row 13 - 18 243 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 19 - 24 244 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 25 - 30 245 | 0x0E, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x0E, 0x00, 0x00, 0x00, // row 31 - 36 246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // row 37 - 42 247 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // row 43 - 48 248 | }; 249 | 250 | const unsigned char * chrtbl_f7s[96] = // character pointer table 251 | { 252 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 253 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_2E, chr_f7s_20, 254 | chr_f7s_30, chr_f7s_31, chr_f7s_32, chr_f7s_33, chr_f7s_34, chr_f7s_35, chr_f7s_36, chr_f7s_37, 255 | chr_f7s_38, chr_f7s_39, chr_f7s_3A, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 256 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 257 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 258 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 259 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 260 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 261 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 262 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, 263 | chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20, chr_f7s_20 264 | }; 265 | -------------------------------------------------------------------------------- /driver/hspi.c: -------------------------------------------------------------------------------- 1 | #include "hspi.h" 2 | 3 | /* 4 | Pinout: 5 | MISO GPIO12 6 | MOSI GPIO13 7 | CLK GPIO14 8 | CS GPIO15 9 | DC GPIO2 10 | */ 11 | 12 | #define HSPI_PRESCALER 4// target hspi clock speed is 40MHz/HSPI_PRESCALER, so that with prescaler 2 the hspi clock is 30MHz 13 | 14 | #define __min(a,b) ((a > b) ? (b):(a)) 15 | uint32_t *spi_fifo; 16 | 17 | void hspi_init(void) 18 | { 19 | spi_fifo = (uint32_t*)SPI_FLASH_C0(HSPI); 20 | 21 | WRITE_PERI_REG(PERIPHS_IO_MUX, 0x105); //clear bit9 22 | 23 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDI_U, 2); // HSPIQ MISO GPIO12 24 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, 2); // HSPID MOSI GPIO13 25 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTMS_U, 2); // CLK GPIO14 26 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, 2); // CS GPIO15 27 | 28 | 29 | // SPI clock = CPU clock / 10 / 4 30 | // time length HIGHT level = (CPU clock / 10 / 2) ^ -1, 31 | // time length LOW level = (CPU clock / 10 / 2) ^ -1 32 | WRITE_PERI_REG(SPI_FLASH_CLOCK(HSPI), 33 | (((HSPI_PRESCALER - 1) & SPI_CLKDIV_PRE) << SPI_CLKDIV_PRE_S) | 34 | ((1 & SPI_CLKCNT_N) << SPI_CLKCNT_N_S) | 35 | ((0 & SPI_CLKCNT_H) << SPI_CLKCNT_H_S) | 36 | ((1 & SPI_CLKCNT_L) << SPI_CLKCNT_L_S)); 37 | 38 | WRITE_PERI_REG(SPI_FLASH_CTRL1(HSPI), 0); 39 | 40 | uint32_t regvalue = SPI_FLASH_DOUT; 41 | regvalue &= ~(BIT2 | SPI_FLASH_USR_ADDR | SPI_FLASH_USR_DUMMY | SPI_FLASH_USR_DIN | SPI_USR_COMMAND | SPI_DOUTDIN); //clear bit 2 see example IoT_Demo 42 | WRITE_PERI_REG(SPI_FLASH_USER(HSPI), regvalue); 43 | } 44 | 45 | void hspi_send_uint16_r(uint16_t data, int32_t repeats) 46 | { 47 | uint32_t i; 48 | uint32_t word = data << 16 | data; 49 | 50 | while(repeats > 0) 51 | { 52 | uint16_t bytes_to_transfer = __min(repeats * sizeof(uint16_t) , SPIFIFOSIZE * sizeof(uint32_t)); 53 | hspi_wait_ready(); 54 | hspi_prepare_tx(bytes_to_transfer); 55 | for(i = 0; i < (bytes_to_transfer + 3) / 4;i++) 56 | spi_fifo[i] = word; 57 | hspi_start_tx(); 58 | repeats -= bytes_to_transfer / 2; 59 | } 60 | } 61 | 62 | void hspi_send_data(const uint8_t * data, uint8_t datasize) 63 | { 64 | uint32_t *_data = (uint32_t*)data; 65 | uint8_t i; 66 | 67 | uint8_t words_to_send = __min((datasize + 3) / 4, SPIFIFOSIZE); 68 | hspi_prepare_tx(datasize); 69 | for(i = 0; i < words_to_send;i++) 70 | spi_fifo[i] = _data[i]; 71 | hspi_start_tx(); 72 | } 73 | -------------------------------------------------------------------------------- /driver/mini-printf.c: -------------------------------------------------------------------------------- 1 | /* 2 | * The Minimal snprintf() implementation 3 | * 4 | * Copyright (c) 2013,2014 Michal Ludvig 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of the auhor nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * ---- 30 | * 31 | * This is a minimal snprintf() implementation optimised 32 | * for embedded systems with a very limited program memory. 33 | * mini_snprintf() doesn't support _all_ the formatting 34 | * the glibc does but on the other hand is a lot smaller. 35 | * Here are some numbers from my STM32 project (.bin file size): 36 | * no snprintf(): 10768 bytes 37 | * mini snprintf(): 11420 bytes (+ 652 bytes) 38 | * glibc snprintf(): 34860 bytes (+24092 bytes) 39 | * Wasting nearly 24kB of memory just for snprintf() on 40 | * a chip with 32kB flash is crazy. Use mini_snprintf() instead. 41 | * 42 | */ 43 | 44 | #include 45 | #include 46 | #include "mini-printf.h" 47 | 48 | static unsigned int 49 | mini_strlen(const char *s) 50 | { 51 | unsigned int len = 0; 52 | while (s[len] != '\0') len++; 53 | return len; 54 | } 55 | 56 | static unsigned int 57 | mini_itoa(int value, unsigned int radix, unsigned int uppercase, 58 | char *buffer, unsigned int zero_pad) 59 | { 60 | char *pbuffer = buffer; 61 | int negative = 0; 62 | unsigned int i, len; 63 | 64 | /* No support for unusual radixes. */ 65 | if (radix > 16) 66 | return 0; 67 | 68 | if (value < 0) { 69 | negative = 1; 70 | value = -value; 71 | } 72 | 73 | /* This builds the string back to front ... */ 74 | do { 75 | int digit = value % radix; 76 | *(pbuffer++) = (digit < 10 ? '0' + digit : (uppercase ? 'A' : 'a') + digit - 10); 77 | value /= radix; 78 | } while (value > 0); 79 | 80 | for (i = (pbuffer - buffer); i < zero_pad; i++) 81 | *(pbuffer++) = '0'; 82 | 83 | if (negative) 84 | *(pbuffer++) = '-'; 85 | 86 | *(pbuffer) = '\0'; 87 | 88 | /* ... now we reverse it (could do it recursively but will 89 | * conserve the stack space) */ 90 | len = (pbuffer - buffer); 91 | for (i = 0; i < len / 2; i++) { 92 | char j = buffer[i]; 93 | buffer[i] = buffer[len-i-1]; 94 | buffer[len-i-1] = j; 95 | } 96 | 97 | return len; 98 | } 99 | 100 | int 101 | mini_vsnprintf(char *buffer, unsigned int buffer_len, const char *fmt, va_list va) 102 | { 103 | char *pbuffer = buffer; 104 | char bf[24]; 105 | char ch; 106 | 107 | int _putc(char ch) 108 | { 109 | if ((unsigned int)((pbuffer - buffer) + 1) >= buffer_len) 110 | return 0; 111 | *(pbuffer++) = ch; 112 | *(pbuffer) = '\0'; 113 | return 1; 114 | } 115 | 116 | int _puts(char *s, unsigned int len) 117 | { 118 | unsigned int i; 119 | 120 | if (buffer_len - (pbuffer - buffer) - 1 < len) 121 | len = buffer_len - (pbuffer - buffer) - 1; 122 | 123 | /* Copy to buffer */ 124 | for (i = 0; i < len; i++) 125 | *(pbuffer++) = s[i]; 126 | *(pbuffer) = '\0'; 127 | 128 | return len; 129 | } 130 | 131 | while ((ch=*(fmt++))) { 132 | if ((unsigned int)((pbuffer - buffer) + 1) >= buffer_len) 133 | break; 134 | if (ch!='%') 135 | _putc(ch); 136 | else { 137 | char zero_pad = 0; 138 | char *ptr; 139 | unsigned int len; 140 | 141 | ch=*(fmt++); 142 | 143 | /* Zero padding requested */ 144 | if (ch=='0') { 145 | ch=*(fmt++); 146 | if (ch == '\0') 147 | goto end; 148 | if (ch >= '0' && ch <= '9') 149 | zero_pad = ch - '0'; 150 | ch=*(fmt++); 151 | } 152 | 153 | switch (ch) { 154 | case 0: 155 | goto end; 156 | 157 | case 'u': 158 | case 'd': 159 | len = mini_itoa(va_arg(va, unsigned int), 10, 0, bf, zero_pad); 160 | _puts(bf, len); 161 | break; 162 | 163 | case 'x': 164 | case 'X': 165 | len = mini_itoa(va_arg(va, unsigned int), 16, (ch=='X'), bf, zero_pad); 166 | _puts(bf, len); 167 | break; 168 | 169 | case 'c' : 170 | _putc((char)(va_arg(va, int))); 171 | break; 172 | 173 | case 's' : 174 | ptr = va_arg(va, char*); 175 | _puts(ptr, mini_strlen(ptr)); 176 | break; 177 | 178 | default: 179 | _putc(ch); 180 | break; 181 | } 182 | } 183 | } 184 | end: 185 | return pbuffer - buffer; 186 | } 187 | 188 | 189 | int 190 | mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...) 191 | { 192 | int ret; 193 | va_list va; 194 | va_start(va, fmt); 195 | ret = mini_vsnprintf(buffer, buffer_len, fmt, va); 196 | va_end(va); 197 | 198 | return ret; 199 | } 200 | -------------------------------------------------------------------------------- /driver/uart.c: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright 2013-2014 Espressif Systems (Wuxi) 3 | * 4 | * FileName: uart.c 5 | * 6 | * Description: Two UART mode configration and interrupt handler. 7 | * Check your hardware connection while use this mode. 8 | * 9 | * Modification history: 10 | * 2014/3/12, v1.0 create this file. 11 | *******************************************************************************/ 12 | #include "ets_sys.h" 13 | #include "osapi.h" 14 | #include "driver/uart.h" 15 | 16 | #define UART0 0 17 | #define UART1 1 18 | 19 | // UartDev is defined and initialized in rom code. 20 | extern UartDevice UartDev; 21 | 22 | LOCAL void uart0_rx_intr_handler(void *para); 23 | 24 | /****************************************************************************** 25 | * FunctionName : uart_config 26 | * Description : Internal used function 27 | * UART0 used for data TX/RX, RX buffer size is 0x100, interrupt enabled 28 | * UART1 just used for debug output 29 | * Parameters : uart_no, use UART0 or UART1 defined ahead 30 | * Returns : NONE 31 | *******************************************************************************/ 32 | LOCAL void ICACHE_FLASH_ATTR 33 | uart_config(uint8 uart_no) 34 | { 35 | if (uart_no == UART1) { 36 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK); 37 | } else { 38 | /* rcv_buff size if 0x100 */ 39 | ETS_UART_INTR_ATTACH(uart0_rx_intr_handler, &(UartDev.rcv_buff)); 40 | PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U); 41 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD); 42 | } 43 | 44 | uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate)); 45 | 46 | WRITE_PERI_REG(UART_CONF0(uart_no), UartDev.exist_parity 47 | | UartDev.parity 48 | | (UartDev.stop_bits << UART_STOP_BIT_NUM_S) 49 | | (UartDev.data_bits << UART_BIT_NUM_S)); 50 | 51 | 52 | //clear rx and tx fifo,not ready 53 | SET_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST); 54 | CLEAR_PERI_REG_MASK(UART_CONF0(uart_no), UART_RXFIFO_RST | UART_TXFIFO_RST); 55 | 56 | //set rx fifo trigger 57 | WRITE_PERI_REG(UART_CONF1(uart_no), (UartDev.rcv_buff.TrigLvl & UART_RXFIFO_FULL_THRHD) << UART_RXFIFO_FULL_THRHD_S); 58 | 59 | //clear all interrupt 60 | WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff); 61 | //enable rx_interrupt 62 | SET_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA); 63 | } 64 | 65 | /****************************************************************************** 66 | * FunctionName : uart1_tx_one_char 67 | * Description : Internal used function 68 | * Use uart1 interface to transfer one char 69 | * Parameters : uint8 TxChar - character to tx 70 | * Returns : OK 71 | *******************************************************************************/ 72 | LOCAL STATUS ICACHE_FLASH_ATTR 73 | uart1_tx_one_char(uint8 TxChar) 74 | { 75 | while (true) 76 | { 77 | uint32 fifo_cnt = READ_PERI_REG(UART_STATUS(UART1)) & (UART_TXFIFO_CNT<> UART_TXFIFO_CNT_S & UART_TXFIFO_CNT) < 126) { 79 | break; 80 | } 81 | } 82 | 83 | WRITE_PERI_REG(UART_FIFO(UART1) , TxChar); 84 | return OK; 85 | } 86 | 87 | /****************************************************************************** 88 | * FunctionName : uart1_write_char 89 | * Description : Internal used function 90 | * Do some special deal while tx char is '\r' or '\n' 91 | * Parameters : char c - character to tx 92 | * Returns : NONE 93 | *******************************************************************************/ 94 | LOCAL void ICACHE_FLASH_ATTR 95 | uart1_write_char(char c) 96 | { 97 | if (c == '\n') { 98 | uart1_tx_one_char('\r'); 99 | uart1_tx_one_char('\n'); 100 | } else if (c == '\r') { 101 | } else { 102 | uart1_tx_one_char(c); 103 | } 104 | } 105 | 106 | /****************************************************************************** 107 | * FunctionName : uart0_rx_intr_handler 108 | * Description : Internal used function 109 | * UART0 interrupt handler, add self handle code inside 110 | * Parameters : void *para - point to ETS_UART_INTR_ATTACH's arg 111 | * Returns : NONE 112 | *******************************************************************************/ 113 | LOCAL void 114 | uart0_rx_intr_handler(void *para) 115 | { 116 | /* uart0 and uart1 intr combine togther, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents 117 | * uart1 and uart0 respectively 118 | */ 119 | RcvMsgBuff *pRxBuff = (RcvMsgBuff *)para; 120 | uint8 RcvChar; 121 | 122 | if (UART_RXFIFO_FULL_INT_ST != (READ_PERI_REG(UART_INT_ST(UART0)) & UART_RXFIFO_FULL_INT_ST)) { 123 | return; 124 | } 125 | 126 | WRITE_PERI_REG(UART_INT_CLR(UART0), UART_RXFIFO_FULL_INT_CLR); 127 | 128 | while (READ_PERI_REG(UART_STATUS(UART0)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) { 129 | RcvChar = READ_PERI_REG(UART_FIFO(UART0)) & 0xFF; 130 | 131 | /* you can add your handle code below.*/ 132 | 133 | *(pRxBuff->pWritePos) = RcvChar; 134 | 135 | // insert here for get one command line from uart 136 | if (RcvChar == '\r') { 137 | pRxBuff->BuffState = WRITE_OVER; 138 | } 139 | 140 | pRxBuff->pWritePos++; 141 | 142 | if (pRxBuff->pWritePos == (pRxBuff->pRcvMsgBuff + RX_BUFF_SIZE)) { 143 | // overflow ...we may need more error handle here. 144 | pRxBuff->pWritePos = pRxBuff->pRcvMsgBuff ; 145 | } 146 | } 147 | } 148 | 149 | 150 | /****************************************************************************** 151 | * FunctionName : uart0_tx_buffer 152 | * Description : use uart0 to transfer buffer 153 | * Parameters : uint8 *buf - point to send buffer 154 | * uint16 len - buffer len 155 | * Returns : 156 | *******************************************************************************/ 157 | void ICACHE_FLASH_ATTR 158 | uart0_tx_buffer(uint8 *buf, uint16 len) 159 | { 160 | uint16 i; 161 | 162 | for (i = 0; i < len; i++) { 163 | uart_tx_one_char(buf[i]); 164 | } 165 | } 166 | 167 | /****************************************************************************** 168 | * FunctionName : uart_init 169 | * Description : user interface for init uart 170 | * Parameters : UartBautRate uart0_br - uart0 bautrate 171 | * UartBautRate uart1_br - uart1 bautrate 172 | * Returns : NONE 173 | *******************************************************************************/ 174 | void ICACHE_FLASH_ATTR 175 | uart_init(UartBautRate uart0_br, UartBautRate uart1_br) 176 | { 177 | // rom use 74880 baut_rate, here reinitialize 178 | UartDev.baut_rate = uart0_br; 179 | uart_config(UART0); 180 | UartDev.baut_rate = uart1_br; 181 | uart_config(UART1); 182 | ETS_UART_INTR_ENABLE(); 183 | 184 | // install uart1 putc callback 185 | os_install_putc1((void *)uart1_write_char); 186 | } 187 | 188 | -------------------------------------------------------------------------------- /include/cpp_routines/routines.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_ROUTINES_H_ 2 | #define INCLUDE_ROUTINES_H_ 3 | 4 | #define os_malloc pvPortMalloc 5 | #define os_free vPortFree 6 | #define os_zalloc pvPortZalloc 7 | 8 | void do_global_ctors(void); 9 | 10 | #endif /* INCLUDE_ROUTINES_H_ */ 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /include/cube.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CUBE_H_ 2 | #define INCLUDE_CUBE_H_ 3 | 4 | #define VERTEX_COUNT 8 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | void cube_calculate(int16_t _pix[VERTEX_COUNT][3], double degreeX, double degreeY, double degreeZ, double scale, int16_t shiftX, int16_t shiftY, int16_t shiftZ); 14 | void cube_draw(int16_t _pix[VERTEX_COUNT][3], uint16_t color); 15 | 16 | #ifdef __cplusplus 17 | }; 18 | #endif 19 | 20 | #endif /* INCLUDE_CUBE_H_ */ 21 | -------------------------------------------------------------------------------- /include/driver/Adafruit_GFX_AS.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_GFX_AS_H 2 | #define _ADAFRUIT_GFX_AS_H 3 | 4 | #include "Load_fonts.h" 5 | #include 6 | 7 | 8 | class Adafruit_GFX_AS { 9 | public: 10 | Adafruit_GFX_AS(int16_t w, int16_t h); // Constructor 11 | 12 | // This MUST be defined by the subclass: 13 | virtual void drawPixel(int16_t x, int16_t y, uint16_t color) = 0; 14 | 15 | // These MAY be overridden by the subclass to provide device-specific 16 | // optimized code. Otherwise 'generic' versions are used. 17 | virtual void 18 | drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color), 19 | drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), 20 | drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), 21 | drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), 22 | fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color), 23 | fillScreen(uint16_t color), 24 | invertDisplay(bool i); 25 | 26 | // These exist only with Adafruit_GFX_AS (no subclass overrides) 27 | void 28 | drawCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), 29 | drawCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, 30 | uint16_t color), 31 | fillCircle(int16_t x0, int16_t y0, int16_t r, uint16_t color), 32 | fillCircleHelper(int16_t x0, int16_t y0, int16_t r, uint8_t cornername, 33 | int16_t delta, uint16_t color), 34 | drawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, 35 | int16_t x2, int16_t y2, uint16_t color), 36 | fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, 37 | int16_t x2, int16_t y2, uint16_t color), 38 | drawRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, 39 | int16_t radius, uint16_t color), 40 | fillRoundRect(int16_t x0, int16_t y0, int16_t w, int16_t h, 41 | int16_t radius, uint16_t color), 42 | drawBitmap(int16_t x, int16_t y, const uint16_t *bitmap, 43 | int16_t w, int16_t h), 44 | setTextColor(uint16_t c), 45 | setTextColor(uint16_t c, uint16_t bg), 46 | setTextWrap(bool w), 47 | setRotation(uint8_t r); 48 | 49 | int drawUnicode(uint16_t uniCode, uint16_t x, uint16_t y, uint8_t size); 50 | int drawNumber(long long_num,uint16_t poX, uint16_t poY, uint8_t size); 51 | int drawChar(char c, uint16_t x, uint16_t y, uint8_t size); 52 | int drawString(const char *string, uint16_t poX, uint16_t poY, uint8_t size); 53 | int drawCentreString(const char *string, uint16_t dX, uint16_t poY, uint8_t size); 54 | int drawRightString(const char *string, uint16_t dX, uint16_t poY, uint8_t size); 55 | int drawFloat(float floatNumber,uint8_t decimal,uint16_t poX, uint16_t poY, uint8_t size); 56 | 57 | int16_t 58 | height(void), 59 | width(void); 60 | 61 | uint8_t getRotation(void); 62 | 63 | protected: 64 | const int16_t 65 | WIDTH, HEIGHT; // This is the 'raw' display w/h - never changes 66 | int16_t 67 | _width, _height; // Display w/h as modified by current rotation 68 | uint16_t 69 | textcolor, textbgcolor; 70 | uint8_t 71 | rotation; 72 | bool 73 | wrap; // If set, 'wrap' text at right edge of display 74 | }; 75 | 76 | #endif // _ADAFRUIT_GFX_AS_H 77 | -------------------------------------------------------------------------------- /include/driver/Adafruit_ILI9341_fast_as.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_ILI9341H_ 2 | #define _ADAFRUIT_ILI9341H_ 3 | 4 | #include "Adafruit_GFX_AS.h" 5 | 6 | extern "C" 7 | { 8 | #include 9 | #include 10 | #include "hspi.h" 11 | } 12 | 13 | #define ILI9341_TFTWIDTH 240 14 | #define ILI9341_TFTHEIGHT 320 15 | 16 | #define ILI9341_NOP 0x00 17 | #define ILI9341_SWRESET 0x01 18 | #define ILI9341_RDDID 0x04 19 | #define ILI9341_RDDST 0x09 20 | 21 | #define ILI9341_SLPIN 0x10 22 | #define ILI9341_SLPOUT 0x11 23 | #define ILI9341_PTLON 0x12 24 | #define ILI9341_NORON 0x13 25 | 26 | #define ILI9341_RDMODE 0x0A 27 | #define ILI9341_RDMADCTL 0x0B 28 | #define ILI9341_RDPIXFMT 0x0C 29 | #define ILI9341_RDIMGFMT 0x0A 30 | #define ILI9341_RDSELFDIAG 0x0F 31 | 32 | #define ILI9341_INVOFF 0x20 33 | #define ILI9341_INVON 0x21 34 | #define ILI9341_GAMMASET 0x26 35 | #define ILI9341_DISPOFF 0x28 36 | #define ILI9341_DISPON 0x29 37 | 38 | #define ILI9341_CASET 0x2A 39 | #define ILI9341_PASET 0x2B 40 | #define ILI9341_RAMWR 0x2C 41 | #define ILI9341_RAMRD 0x2E 42 | 43 | #define ILI9341_PTLAR 0x30 44 | #define ILI9341_MADCTL 0x36 45 | #define ILI9341_PIXFMT 0x3A 46 | 47 | #define ILI9341_FRMCTR1 0xB1 48 | #define ILI9341_FRMCTR2 0xB2 49 | #define ILI9341_FRMCTR3 0xB3 50 | #define ILI9341_INVCTR 0xB4 51 | #define ILI9341_DFUNCTR 0xB6 52 | 53 | #define ILI9341_PWCTR1 0xC0 54 | #define ILI9341_PWCTR2 0xC1 55 | #define ILI9341_PWCTR3 0xC2 56 | #define ILI9341_PWCTR4 0xC3 57 | #define ILI9341_PWCTR5 0xC4 58 | #define ILI9341_VMCTR1 0xC5 59 | #define ILI9341_VMCTR2 0xC7 60 | 61 | #define ILI9341_RDID1 0xDA 62 | #define ILI9341_RDID2 0xDB 63 | #define ILI9341_RDID3 0xDC 64 | #define ILI9341_RDID4 0xDD 65 | 66 | #define ILI9341_GMCTRP1 0xE0 67 | #define ILI9341_GMCTRN1 0xE1 68 | /* 69 | #define ILI9341_PWCTR6 0xFC 70 | 71 | */ 72 | 73 | // Color definitions 74 | #define ILI9341_BLACK 0x0000 75 | #define ILI9341_BLUE 0x001F 76 | #define ILI9341_RED 0xF800 77 | #define ILI9341_GREEN 0x07E0 78 | #define ILI9341_CYAN 0x07FF 79 | #define ILI9341_MAGENTA 0xF81F 80 | #define ILI9341_YELLOW 0xFFE0 81 | #define ILI9341_WHITE 0xFFFF 82 | 83 | #define TFT_DC_DATA GPIO_OUTPUT_SET(2, 1) 84 | #define TFT_DC_COMMAND GPIO_OUTPUT_SET(2, 0) 85 | #define TFT_DC_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_GPIO2); TFT_DC_DATA 86 | 87 | #define TFT_RST_ACTIVE GPIO_OUTPUT_SET(4, 0) 88 | #define TFT_RST_DEACTIVE GPIO_OUTPUT_SET(4, 1) 89 | #define TFT_RST_INIT PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO4_U, FUNC_GPIO4); TFT_RST_DEACTIVE 90 | 91 | #define MAKEWORD(b1, b2, b3, b4) (uint32_t(b1) | ((b2) << 8) | ((b3) << 16) | ((b4) << 24)) 92 | 93 | class Adafruit_ILI9341 : public Adafruit_GFX_AS { 94 | 95 | private: 96 | uint8_t tabcolor; 97 | void transmitCmdData(uint8_t cmd, const uint8_t *data, uint8_t numDataByte); 98 | inline void transmitData(uint16_t data) {hspi_wait_ready(); hspi_send_uint16(data);} 99 | inline void transmitCmdData(uint8_t cmd, uint32_t data) {hspi_wait_ready(); TFT_DC_COMMAND; hspi_send_uint8(cmd); hspi_wait_ready(); TFT_DC_DATA; hspi_send_uint32(data);} 100 | inline void transmitData(uint16_t data, int32_t repeats){hspi_wait_ready(); hspi_send_uint16_r(data, repeats);} 101 | inline void transmitCmd(uint8_t cmd){hspi_wait_ready(); TFT_DC_COMMAND; hspi_send_uint8(cmd);hspi_wait_ready(); TFT_DC_DATA;} 102 | 103 | public: 104 | Adafruit_ILI9341(); 105 | 106 | void begin(void), 107 | fillScreen(uint16_t color), 108 | drawPixel(int16_t x, int16_t y, uint16_t color), 109 | drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color), 110 | drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color), 111 | fillRect(int16_t x, int16_t y, int16_t w, int16_t h, 112 | uint16_t color), 113 | setRotation(uint8_t r), 114 | invertDisplay(bool i); 115 | inline void setAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) 116 | { transmitCmdData(ILI9341_CASET, MAKEWORD(x0 >> 8, x0 & 0xFF, x1 >> 8, x1 & 0xFF)); 117 | transmitCmdData(ILI9341_PASET, MAKEWORD(y0 >> 8, y0 & 0xFF, y1 >> 8, y1 & 0xFF)); 118 | transmitCmd(ILI9341_RAMWR); // write to RAM 119 | } 120 | uint16_t color565(uint8_t r, uint8_t g, uint8_t b); 121 | }; 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /include/driver/Font16.h: -------------------------------------------------------------------------------- 1 | #define nr_chrs_f16 96 2 | #define chr_hgt_f16 16 3 | #define data_size_f16 8 4 | #define firstchr_f16 32 5 | 6 | extern const unsigned char widtbl_f16[96]; 7 | extern const unsigned char* chrtbl_f16[96]; 8 | -------------------------------------------------------------------------------- /include/driver/Font32.h: -------------------------------------------------------------------------------- 1 | #define nr_chrs_f32 96 2 | #define chr_hgt_f32 26 3 | #define data_size_f32 8 4 | #define firstchr_f32 32 5 | 6 | extern const unsigned char widtbl_f32[96]; 7 | extern const unsigned char* chrtbl_f32[96]; 8 | -------------------------------------------------------------------------------- /include/driver/Font64.h: -------------------------------------------------------------------------------- 1 | #define nr_chrs_f64 96 2 | #define chr_hgt_f64 48 3 | #define data_size_f64 8 4 | #define firstchr_f64 32 5 | 6 | extern const unsigned char widtbl_f64[96]; 7 | extern const unsigned char* chrtbl_f64[96]; 8 | -------------------------------------------------------------------------------- /include/driver/Font7s.h: -------------------------------------------------------------------------------- 1 | #define nr_chrs_f7s 96 2 | #define chr_hgt_f7s 48 3 | #define data_size_f7s 8 4 | #define firstchr_f7s 32 5 | 6 | extern const unsigned char widtbl_f7s[96]; 7 | extern const unsigned char * chrtbl_f7s[96]; 8 | -------------------------------------------------------------------------------- /include/driver/Load_fonts.h: -------------------------------------------------------------------------------- 1 | // Comment out the #defines below with // to stop that font being loaded 2 | // If all fonts are loaded the total space required is ablout 17890 bytes 3 | 4 | #define LOAD_GLCD // Standard Adafruit font needs ~1792 bytes in FLASH 5 | #define LOAD_FONT2 // Small font, needs ~3092 bytes in FLASH 6 | #define LOAD_FONT4 // Medium font, needs ~8126 bytes in FLASH 7 | #define LOAD_FONT6 // Large font, needs ~4404 bytes in FLASH 8 | #define LOAD_FONT7 // 7 segment font, needs ~3652 bytes in FLASH 9 | -------------------------------------------------------------------------------- /include/driver/hspi.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_HSPI_H_ 2 | #define INCLUDE_HSPI_H_ 3 | 4 | #include "driver/spi_register.h" // from 0.9.4 IoT_Demo 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define SPI 0 11 | #define HSPI 1 12 | #define SPIFIFOSIZE 16 //16 words length 13 | 14 | extern uint32_t *spi_fifo; 15 | 16 | extern void hspi_init(void); 17 | extern void hspi_send_data(const uint8_t * data, uint8_t datasize); 18 | extern void hspi_send_uint16_r(const uint16_t data, int32_t repeats); 19 | inline void hspi_wait_ready(void){while (READ_PERI_REG(SPI_FLASH_CMD(HSPI))&SPI_FLASH_USR);} 20 | 21 | inline void hspi_prepare_tx(uint32_t bytecount) 22 | { 23 | uint32_t bitcount = bytecount * 8 - 1; 24 | 25 | WRITE_PERI_REG(SPI_FLASH_USER1(HSPI), (bitcount & SPI_USR_OUT_BITLEN) << SPI_USR_OUT_BITLEN_S); 26 | } 27 | 28 | 29 | inline void hspi_start_tx() 30 | { 31 | SET_PERI_REG_MASK(SPI_FLASH_CMD(HSPI), SPI_FLASH_USR); // send 32 | } 33 | 34 | inline void hspi_send_uint8(uint8_t data) 35 | { 36 | hspi_prepare_tx(1); 37 | *spi_fifo = data; 38 | hspi_start_tx(); 39 | } 40 | 41 | inline void hspi_send_uint16(uint16_t data) 42 | { 43 | hspi_prepare_tx(2); 44 | *spi_fifo = data; 45 | hspi_start_tx(); 46 | } 47 | 48 | inline void hspi_send_uint32(uint32_t data) 49 | { 50 | hspi_prepare_tx(4); 51 | *spi_fifo = data; 52 | hspi_start_tx(); 53 | } 54 | 55 | #endif /* INCLUDE_HSPI_H_ */ 56 | -------------------------------------------------------------------------------- /include/driver/mini-printf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The Minimal snprintf() implementation 3 | * 4 | * Copyright (c) 2013 Michal Ludvig 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions are met: 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * * Neither the name of the auhor nor the names of its contributors 15 | * may be used to endorse or promote products derived from this software 16 | * without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | 31 | #ifndef __MINI_PRINTF__ 32 | #define __MINI_PRINTF__ 33 | #include 34 | 35 | int mini_vsnprintf(char* buffer, unsigned int buffer_len, const char *fmt, va_list va); 36 | int mini_snprintf(char* buffer, unsigned int buffer_len, const char *fmt, ...); 37 | 38 | #define vsnprintf mini_vsnprintf 39 | #define snprintf mini_snprintf 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/driver/spi_register.h: -------------------------------------------------------------------------------- 1 | //Generated at 2014-07-29 11:03:29 2 | /* 3 | * Copyright (c) 2010 - 2011 Espressif System 4 | * 5 | */ 6 | 7 | #ifndef SPI_REGISTER_H_INCLUDED 8 | #define SPI_REGISTER_H_INCLUDED 9 | 10 | #define REG_SPI_BASE(i) (0x60000200-i*0x100) 11 | 12 | #define SPI_FLASH_CMD(i) (REG_SPI_BASE(i) + 0x0) 13 | #define SPI_FLASH_READ (BIT(31)) 14 | #define SPI_FLASH_WREN (BIT(30)) 15 | #define SPI_FLASH_WRDI (BIT(29)) 16 | #define SPI_FLASH_RDID (BIT(28)) 17 | #define SPI_FLASH_RDSR (BIT(27)) 18 | #define SPI_FLASH_WRSR (BIT(26)) 19 | #define SPI_FLASH_PP (BIT(25)) 20 | #define SPI_FLASH_SE (BIT(24)) 21 | #define SPI_FLASH_BE (BIT(23)) 22 | #define SPI_FLASH_CE (BIT(22)) 23 | #define SPI_FLASH_DP (BIT(21)) 24 | #define SPI_FLASH_RES (BIT(20)) 25 | #define SPI_FLASH_HPM (BIT(19)) 26 | #define SPI_FLASH_USR (BIT(18)) 27 | 28 | #define SPI_FLASH_ADDR(i) (REG_SPI_BASE(i) + 0x4) 29 | 30 | #define SPI_FLASH_CTRL(i) (REG_SPI_BASE(i) + 0x8) 31 | #define SPI_WR_BIT_ODER (BIT(26)) 32 | #define SPI_RD_BIT_ODER (BIT(25)) 33 | #define SPI_QIO_MODE (BIT(24)) 34 | #define SPI_DIO_MODE (BIT(23)) 35 | #define SPI_TWO_BYTE_STATUS_EN (BIT(22)) 36 | #define SPI_WP_REG (BIT(21)) 37 | #define SPI_QOUT_MODE (BIT(20)) 38 | #define SPI_SHARE_BUS (BIT(19)) 39 | #define SPI_HOLD_MODE (BIT(18)) 40 | #define SPI_ENABLE_AHB (BIT(17)) 41 | #define SPI_SST_AAI (BIT(16)) 42 | #define SPI_RESANDRES (BIT(15)) 43 | #define SPI_DOUT_MODE (BIT(14)) 44 | #define SPI_FASTRD_MODE (BIT(13)) 45 | 46 | #define SPI_FLASH_CTRL1(i) (REG_SPI_BASE (i) + 0xC) 47 | #define SPI_T_CSH 0x0000000F 48 | #define SPI_T_CSH_S 28 49 | #define SPI_T_RES 0x00000FFF 50 | #define SPI_T_RES_S 16 51 | #define SPI_BUS_TIMER_LIMIT 0x0000FFFF 52 | #define SPI_BUS_TIMER_LIMIT_S 0 53 | 54 | #define SPI_FLASH_STATUS(i) (REG_SPI_BASE(i) + 0x10) 55 | #define SPI_STATUS_EXT 0x000000FF 56 | #define SPI_STATUS_EXT_S 24 57 | #define SPI_WB_MODE 0x000000FF 58 | #define SPI_WB_MODE_S 16 59 | #define SPI_FLASH_STATUS_PRO_FLAG (BIT(7)) 60 | #define SPI_FLASH_TOP_BOT_PRO_FLAG (BIT(5)) 61 | #define SPI_FLASH_BP2 (BIT(4)) 62 | #define SPI_FLASH_BP1 (BIT(3)) 63 | #define SPI_FLASH_BP0 (BIT(2)) 64 | #define SPI_FLASH_WRENABLE_FLAG (BIT(1)) 65 | #define SPI_FLASH_BUSY_FLAG (BIT(0)) 66 | 67 | #define SPI_FLASH_CTRL2(i) (REG_SPI_BASE(i) + 0x14) 68 | #define SPI_CS_DELAY_NUM 0x0000000F 69 | #define SPI_CS_DELAY_NUM_S 28 70 | #define SPI_CS_DELAY_MODE 0x00000003 71 | #define SPI_CS_DELAY_MODE_S 26 72 | #define SPI_MOSI_DELAY_NUM 0x00000007 73 | #define SPI_MOSI_DELAY_NUM_S 23 74 | #define SPI_MOSI_DELAY_MODE 0x00000003 75 | #define SPI_MOSI_DELAY_MODE_S 21 76 | #define SPI_MISO_DELAY_NUM 0x00000007 77 | #define SPI_MISO_DELAY_NUM_S 18 78 | #define SPI_MISO_DELAY_MODE 0x00000003 79 | #define SPI_MISO_DELAY_MODE_S 16 80 | #define SPI_CK_OUT_HIGH_MODE 0x0000000F 81 | #define SPI_CK_OUT_HIGH_MODE_S 12 82 | #define SPI_CK_OUT_LOW_MODE 0x0000000F 83 | #define SPI_CK_OUT_LOW_MODE_S 8 84 | #define SPI_HOLD_TIME 0x0000000F 85 | #define SPI_HOLD_TIME_S 4 86 | #define SPI_SETUP_TIME 0x0000000F 87 | #define SPI_SETUP_TIME_S 0 88 | 89 | #define SPI_FLASH_CLOCK(i) (REG_SPI_BASE(i) + 0x18) 90 | #define SPI_CLK_EQU_SYSCLK (BIT(31)) 91 | #define SPI_CLKDIV_PRE 0x00001FFF 92 | #define SPI_CLKDIV_PRE_S 18 93 | #define SPI_CLKCNT_N 0x0000003F 94 | #define SPI_CLKCNT_N_S 12 95 | #define SPI_CLKCNT_H 0x0000003F 96 | #define SPI_CLKCNT_H_S 6 97 | #define SPI_CLKCNT_L 0x0000003F 98 | #define SPI_CLKCNT_L_S 0 99 | 100 | #define SPI_FLASH_USER(i) (REG_SPI_BASE(i) + 0x1C) 101 | #define SPI_USR_COMMAND (BIT(31)) 102 | #define SPI_FLASH_USR_ADDR (BIT(30)) 103 | #define SPI_FLASH_USR_DUMMY (BIT(29)) 104 | #define SPI_FLASH_USR_DIN (BIT(28)) 105 | #define SPI_FLASH_DOUT (BIT(27)) 106 | #define SPI_USR_DUMMY_IDLE (BIT(26)) 107 | #define SPI_USR_DOUT_HIGHPART (BIT(25)) 108 | #define SPI_USR_DIN_HIGHPART (BIT(24)) 109 | #define SPI_USR_PREP_HOLD (BIT(23)) 110 | #define SPI_USR_CMD_HOLD (BIT(22)) 111 | #define SPI_USR_ADDR_HOLD (BIT(21)) 112 | #define SPI_USR_DUMMY_HOLD (BIT(20)) 113 | #define SPI_USR_DIN_HOLD (BIT(19)) 114 | #define SPI_USR_DOUT_HOLD (BIT(18)) 115 | #define SPI_USR_HOLD_POL (BIT(17)) 116 | #define SPI_SIO (BIT(16)) 117 | #define SPI_FWRITE_QIO (BIT(15)) 118 | #define SPI_FWRITE_DIO (BIT(14)) 119 | #define SPI_FWRITE_QUAD (BIT(13)) 120 | #define SPI_FWRITE_DUAL (BIT(12)) 121 | #define SPI_WR_BYTE_ORDER (BIT(11)) 122 | #define SPI_RD_BYTE_ORDER (BIT(10)) 123 | #define SPI_AHB_ENDIAN_MODE 0x00000003 124 | #define SPI_AHB_ENDIAN_MODE_S 8 125 | #define SPI_CK_OUT_EDGE (BIT(7)) 126 | #define SPI_CK_I_EDGE (BIT(6)) 127 | #define SPI_CS_SETUP (BIT(5)) 128 | #define SPI_CS_HOLD (BIT(4)) 129 | #define SPI_AHB_USR_COMMAND (BIT(3)) 130 | #define SPI_AHB_USR_COMMAND_4BYTE (BIT(1)) 131 | #define SPI_DOUTDIN (BIT(0)) 132 | 133 | #define SPI_FLASH_USER1(i) (REG_SPI_BASE(i) + 0x20) 134 | #define SPI_USR_ADDR_BITLEN 0x0000003F 135 | #define SPI_USR_ADDR_BITLEN_S 26 136 | #define SPI_USR_OUT_BITLEN 0x000001FF 137 | #define SPI_USR_OUT_BITLEN_S 17 138 | #define SPI_USR_DIN_BITLEN 0x000001FF 139 | #define SPI_USR_DIN_BITLEN_S 8 140 | #define SPI_USR_DUMMY_CYCLELEN 0x000000FF 141 | #define SPI_USR_DUMMY_CYCLELEN_S 0 142 | 143 | #define SPI_FLASH_USER2(i) (REG_SPI_BASE(i) + 0x24) 144 | #define SPI_USR_COMMAND_BITLEN 0x0000000F 145 | #define SPI_USR_COMMAND_BITLEN_S 28 146 | #define SPI_USR_COMMAND_VALUE 0x0000FFFF 147 | #define SPI_USR_COMMAND_VALUE_S 0 148 | 149 | #define SPI_FLASH_USER3(i) (REG_SPI_BASE(i) + 0x28) 150 | #define SPI_FLASH_PIN(i) (REG_SPI_BASE(i) + 0x2C) 151 | #define SPI_FLASH_SLAVE(i) (REG_SPI_BASE(i) + 0x30) 152 | #define SPI_SYNC_RESET (BIT(31)) 153 | #define SPI_SLAVE_MODE (BIT(30)) 154 | #define SPI_SLV_WR_RD_BUF_EN (BIT(29)) 155 | #define SPI_SLV_WR_RD_STA_EN (BIT(28)) 156 | #define SPI_SLV_CMD_DEFINE (BIT(27)) 157 | #define SPI_TRANS_CNT 0x0000000F 158 | #define SPI_TRANS_CNT_S 23 159 | #define SPI_SLV_LAST_STATE 0x00000007 160 | #define SPI_SLV_LAST_STATE_S 20 161 | #define SPI_SLV_LAST_COMMAND 0x00000007 162 | #define SPI_SLV_LAST_COMMAND_S 17 163 | #define SPI_CS_I_MODE 0x00000003 164 | #define SPI_CS_I_MODE_S 10 165 | #define SPI_INT_EN 0x0000001F 166 | #define SPI_INT_EN_S 5 167 | #define SPI_TRANS_DONE (BIT(4)) 168 | #define SPI_SLV_WR_STA_DONE (BIT(3)) 169 | #define SPI_SLV_RD_STA_DONE (BIT(2)) 170 | #define SPI_SLV_WR_BUF_DONE (BIT(1)) 171 | #define SPI_SLV_RD_BUF_DONE (BIT(0)) 172 | 173 | #define SPI_FLASH_SLAVE1(i) (REG_SPI_BASE(i) + 0x34) 174 | #define SPI_SLV_STATUS_BITLEN 0x0000001F 175 | #define SPI_SLV_STATUS_BITLEN_S 27 176 | #define SPI_SLV_STATUS_FAST_EN (BIT(26)) 177 | #define SPI_SLV_STATUS_READBACK (BIT(25)) 178 | #define SPI_SLV_BUF_BITLEN 0x000001FF 179 | #define SPI_SLV_BUF_BITLEN_S 16 180 | #define SPI_SLV_RD_ADDR_BITLEN 0x0000003F 181 | #define SPI_SLV_RD_ADDR_BITLEN_S 10 182 | #define SPI_SLV_WR_ADDR_BITLEN 0x0000003F 183 | #define SPI_SLV_WR_ADDR_BITLEN_S 4 184 | #define SPI_SLV_WRSTA_DUMMY_EN (BIT(3)) 185 | #define SPI_SLV_RDSTA_DUMMY_EN (BIT(2)) 186 | #define SPI_SLV_WRBUF_DUMMY_EN (BIT(1)) 187 | #define SPI_SLV_RDBUF_DUMMY_EN (BIT(0)) 188 | 189 | #define SPI_FLASH_SLAVE2(i) (REG_SPI_BASE(i) + 0x38) 190 | #define SPI_SLV_WRBUF_DUMMY_CYCLELEN 0x000000FF 191 | #define SPI_SLV_WRBUF_DUMMY_CYCLELEN_S 24 192 | #define SPI_SLV_RDBUF_DUMMY_CYCLELEN 0x000000FF 193 | #define SPI_SLV_RDBUF_DUMMY_CYCLELEN_S 16 194 | #define SPI_SLV_WRSTA_DUMMY_CYCLELEN 0x000000FF 195 | #define SPI_SLV_WRSTA_DUMMY_CYCLELEN_S 8 196 | #define SPI_SLV_RDSTA_DUMMY_CYCLELEN 0x000000FF 197 | #define SPI_SLV_RDSTA_DUMMY_CYCLELEN_S 0 198 | 199 | #define SPI_FLASH_SLAVE3(i) (REG_SPI_BASE(i) + 0x3C) 200 | #define SPI_SLV_WRSTA_CMD_VALUE 0x000000FF 201 | #define SPI_SLV_WRSTA_CMD_VALUE_S 24 202 | #define SPI_SLV_RDSTA_CMD_VALUE 0x000000FF 203 | #define SPI_SLV_RDSTA_CMD_VALUE_S 16 204 | #define SPI_SLV_WRBUF_CMD_VALUE 0x000000FF 205 | #define SPI_SLV_WRBUF_CMD_VALUE_S 8 206 | #define SPI_SLV_RDBUF_CMD_VALUE 0x000000FF 207 | #define SPI_SLV_RDBUF_CMD_VALUE_S 0 208 | 209 | #define SPI_FLASH_C0(i) (REG_SPI_BASE(i) +0x40) 210 | #define SPI_FLASH_C1(i) (REG_SPI_BASE(i) +0x44) 211 | #define SPI_FLASH_C2(i) (REG_SPI_BASE(i) +0x48) 212 | #define SPI_FLASH_C3(i) (REG_SPI_BASE(i) +0x4C) 213 | #define SPI_FLASH_C4(i) (REG_SPI_BASE(i) +0x50) 214 | #define SPI_FLASH_C5(i) (REG_SPI_BASE(i) +0x54) 215 | #define SPI_FLASH_C6(i) (REG_SPI_BASE(i) +0x58) 216 | #define SPI_FLASH_C7(i) (REG_SPI_BASE(i) +0x5C) 217 | 218 | #define SPI_FLASH_EXT0(i) (REG_SPI_BASE(i) + 0xF0) 219 | #define SPI_T_PP_ENA (BIT(31)) 220 | #define SPI_T_PP_SHIFT 0x0000000F 221 | #define SPI_T_PP_SHIFT_S 16 222 | #define SPI_T_PP_TIME 0x00000FFF 223 | #define SPI_T_PP_TIME_S 0 224 | 225 | #define SPI_FLASH_EXT1(i) (REG_SPI_BASE(i) + 0xF4) 226 | #define SPI_T_ERASE_ENA (BIT(31)) 227 | #define SPI_T_ERASE_SHIFT 0x0000000F 228 | #define SPI_T_ERASE_SHIFT_S 16 229 | #define SPI_T_ERASE_TIME 0x00000FFF 230 | #define SPI_T_ERASE_TIME_S 0 231 | 232 | #define SPI_FLASH_EXT2(i) (REG_SPI_BASE(i) + 0xF8) 233 | #define SPI_ST 0x00000007 234 | #define SPI_ST_S 0 235 | 236 | #define SPI_FLASH_EXT3(i) (REG_SPI_BASE(i) + 0xFC) 237 | #define SPI_INT_HOLD_ENA 0x00000003 238 | #define SPI_INT_HOLD_ENA_S 0 239 | #endif // SPI_REGISTER_H_INCLUDED 240 | -------------------------------------------------------------------------------- /include/driver/uart.h: -------------------------------------------------------------------------------- 1 | #ifndef UART_APP_H 2 | #define UART_APP_H 3 | 4 | #include "uart_register.h" 5 | 6 | #define RX_BUFF_SIZE 0x100 7 | #define TX_BUFF_SIZE 100 8 | 9 | typedef enum { 10 | FIVE_BITS = 0x0, 11 | SIX_BITS = 0x1, 12 | SEVEN_BITS = 0x2, 13 | EIGHT_BITS = 0x3 14 | } UartBitsNum4Char; 15 | 16 | typedef enum { 17 | ONE_STOP_BIT = 0, 18 | ONE_HALF_STOP_BIT = BIT2, 19 | TWO_STOP_BIT = BIT2 20 | } UartStopBitsNum; 21 | 22 | typedef enum { 23 | NONE_BITS = 0, 24 | ODD_BITS = 0, 25 | EVEN_BITS = BIT4 26 | } UartParityMode; 27 | 28 | typedef enum { 29 | STICK_PARITY_DIS = 0, 30 | STICK_PARITY_EN = BIT3 | BIT5 31 | } UartExistParity; 32 | 33 | typedef enum { 34 | BIT_RATE_9600 = 9600, 35 | BIT_RATE_19200 = 19200, 36 | BIT_RATE_38400 = 38400, 37 | BIT_RATE_57600 = 57600, 38 | BIT_RATE_74880 = 74880, 39 | BIT_RATE_115200 = 115200, 40 | BIT_RATE_230400 = 230400, 41 | BIT_RATE_460800 = 460800, 42 | BIT_RATE_921600 = 921600 43 | } UartBautRate; 44 | 45 | typedef enum { 46 | NONE_CTRL, 47 | HARDWARE_CTRL, 48 | XON_XOFF_CTRL 49 | } UartFlowCtrl; 50 | 51 | typedef enum { 52 | EMPTY, 53 | UNDER_WRITE, 54 | WRITE_OVER 55 | } RcvMsgBuffState; 56 | 57 | typedef struct { 58 | uint32 RcvBuffSize; 59 | uint8 *pRcvMsgBuff; 60 | uint8 *pWritePos; 61 | uint8 *pReadPos; 62 | uint8 TrigLvl; //JLU: may need to pad 63 | RcvMsgBuffState BuffState; 64 | } RcvMsgBuff; 65 | 66 | typedef struct { 67 | uint32 TrxBuffSize; 68 | uint8 *pTrxBuff; 69 | } TrxMsgBuff; 70 | 71 | typedef enum { 72 | BAUD_RATE_DET, 73 | WAIT_SYNC_FRM, 74 | SRCH_MSG_HEAD, 75 | RCV_MSG_BODY, 76 | RCV_ESC_CHAR, 77 | } RcvMsgState; 78 | 79 | typedef struct { 80 | UartBautRate baut_rate; 81 | UartBitsNum4Char data_bits; 82 | UartExistParity exist_parity; 83 | UartParityMode parity; // chip size in byte 84 | UartStopBitsNum stop_bits; 85 | UartFlowCtrl flow_ctrl; 86 | RcvMsgBuff rcv_buff; 87 | TrxMsgBuff trx_buff; 88 | RcvMsgState rcv_state; 89 | int received; 90 | int buff_uart_no; //indicate which uart use tx/rx buffer 91 | } UartDevice; 92 | 93 | void uart_init(UartBautRate uart0_br, UartBautRate uart1_br); 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /include/driver/uart_register.h: -------------------------------------------------------------------------------- 1 | //Generated at 2012-07-03 18:44:06 2 | /* 3 | * Copyright (c) 2010 - 2011 Espressif System 4 | * 5 | */ 6 | 7 | #ifndef UART_REGISTER_H_INCLUDED 8 | #define UART_REGISTER_H_INCLUDED 9 | #define REG_UART_BASE( i ) (0x60000000+(i)*0xf00) 10 | //version value:32'h062000 11 | 12 | #define UART_FIFO( i ) (REG_UART_BASE( i ) + 0x0) 13 | #define UART_RXFIFO_RD_BYTE 0x000000FF 14 | #define UART_RXFIFO_RD_BYTE_S 0 15 | 16 | #define UART_INT_RAW( i ) (REG_UART_BASE( i ) + 0x4) 17 | #define UART_RXFIFO_TOUT_INT_RAW (BIT(8)) 18 | #define UART_BRK_DET_INT_RAW (BIT(7)) 19 | #define UART_CTS_CHG_INT_RAW (BIT(6)) 20 | #define UART_DSR_CHG_INT_RAW (BIT(5)) 21 | #define UART_RXFIFO_OVF_INT_RAW (BIT(4)) 22 | #define UART_FRM_ERR_INT_RAW (BIT(3)) 23 | #define UART_PARITY_ERR_INT_RAW (BIT(2)) 24 | #define UART_TXFIFO_EMPTY_INT_RAW (BIT(1)) 25 | #define UART_RXFIFO_FULL_INT_RAW (BIT(0)) 26 | 27 | #define UART_INT_ST( i ) (REG_UART_BASE( i ) + 0x8) 28 | #define UART_RXFIFO_TOUT_INT_ST (BIT(8)) 29 | #define UART_BRK_DET_INT_ST (BIT(7)) 30 | #define UART_CTS_CHG_INT_ST (BIT(6)) 31 | #define UART_DSR_CHG_INT_ST (BIT(5)) 32 | #define UART_RXFIFO_OVF_INT_ST (BIT(4)) 33 | #define UART_FRM_ERR_INT_ST (BIT(3)) 34 | #define UART_PARITY_ERR_INT_ST (BIT(2)) 35 | #define UART_TXFIFO_EMPTY_INT_ST (BIT(1)) 36 | #define UART_RXFIFO_FULL_INT_ST (BIT(0)) 37 | 38 | #define UART_INT_ENA( i ) (REG_UART_BASE( i ) + 0xC) 39 | #define UART_RXFIFO_TOUT_INT_ENA (BIT(8)) 40 | #define UART_BRK_DET_INT_ENA (BIT(7)) 41 | #define UART_CTS_CHG_INT_ENA (BIT(6)) 42 | #define UART_DSR_CHG_INT_ENA (BIT(5)) 43 | #define UART_RXFIFO_OVF_INT_ENA (BIT(4)) 44 | #define UART_FRM_ERR_INT_ENA (BIT(3)) 45 | #define UART_PARITY_ERR_INT_ENA (BIT(2)) 46 | #define UART_TXFIFO_EMPTY_INT_ENA (BIT(1)) 47 | #define UART_RXFIFO_FULL_INT_ENA (BIT(0)) 48 | 49 | #define UART_INT_CLR( i ) (REG_UART_BASE( i ) + 0x10) 50 | #define UART_RXFIFO_TOUT_INT_CLR (BIT(8)) 51 | #define UART_BRK_DET_INT_CLR (BIT(7)) 52 | #define UART_CTS_CHG_INT_CLR (BIT(6)) 53 | #define UART_DSR_CHG_INT_CLR (BIT(5)) 54 | #define UART_RXFIFO_OVF_INT_CLR (BIT(4)) 55 | #define UART_FRM_ERR_INT_CLR (BIT(3)) 56 | #define UART_PARITY_ERR_INT_CLR (BIT(2)) 57 | #define UART_TXFIFO_EMPTY_INT_CLR (BIT(1)) 58 | #define UART_RXFIFO_FULL_INT_CLR (BIT(0)) 59 | 60 | #define UART_CLKDIV( i ) (REG_UART_BASE( i ) + 0x14) 61 | #define UART_CLKDIV_CNT 0x000FFFFF 62 | #define UART_CLKDIV_S 0 63 | 64 | #define UART_AUTOBAUD( i ) (REG_UART_BASE( i ) + 0x18) 65 | #define UART_GLITCH_FILT 0x000000FF 66 | #define UART_GLITCH_FILT_S 8 67 | #define UART_AUTOBAUD_EN (BIT(0)) 68 | 69 | #define UART_STATUS( i ) (REG_UART_BASE( i ) + 0x1C) 70 | #define UART_TXD (BIT(31)) 71 | #define UART_RTSN (BIT(30)) 72 | #define UART_DTRN (BIT(29)) 73 | #define UART_TXFIFO_CNT 0x000000FF 74 | #define UART_TXFIFO_CNT_S 16 75 | #define UART_RXD (BIT(15)) 76 | #define UART_CTSN (BIT(14)) 77 | #define UART_DSRN (BIT(13)) 78 | #define UART_RXFIFO_CNT 0x000000FF 79 | #define UART_RXFIFO_CNT_S 0 80 | 81 | #define UART_CONF0( i ) (REG_UART_BASE( i ) + 0x20) 82 | #define UART_TXFIFO_RST (BIT(18)) 83 | #define UART_RXFIFO_RST (BIT(17)) 84 | #define UART_IRDA_EN (BIT(16)) 85 | #define UART_TX_FLOW_EN (BIT(15)) 86 | #define UART_LOOPBACK (BIT(14)) 87 | #define UART_IRDA_RX_INV (BIT(13)) 88 | #define UART_IRDA_TX_INV (BIT(12)) 89 | #define UART_IRDA_WCTL (BIT(11)) 90 | #define UART_IRDA_TX_EN (BIT(10)) 91 | #define UART_IRDA_DPLX (BIT(9)) 92 | #define UART_TXD_BRK (BIT(8)) 93 | #define UART_SW_DTR (BIT(7)) 94 | #define UART_SW_RTS (BIT(6)) 95 | #define UART_STOP_BIT_NUM 0x00000003 96 | #define UART_STOP_BIT_NUM_S 4 97 | #define UART_BIT_NUM 0x00000003 98 | #define UART_BIT_NUM_S 2 99 | #define UART_PARITY_EN (BIT(1)) 100 | #define UART_PARITY (BIT(0)) 101 | 102 | #define UART_CONF1( i ) (REG_UART_BASE( i ) + 0x24) 103 | #define UART_RX_TOUT_EN (BIT(31)) 104 | #define UART_RX_TOUT_THRHD 0x0000007F 105 | #define UART_RX_TOUT_THRHD_S 24 106 | #define UART_RX_FLOW_EN (BIT(23)) 107 | #define UART_RX_FLOW_THRHD 0x0000007F 108 | #define UART_RX_FLOW_THRHD_S 16 109 | #define UART_TXFIFO_EMPTY_THRHD 0x0000007F 110 | #define UART_TXFIFO_EMPTY_THRHD_S 8 111 | #define UART_RXFIFO_FULL_THRHD 0x0000007F 112 | #define UART_RXFIFO_FULL_THRHD_S 0 113 | 114 | #define UART_LOWPULSE( i ) (REG_UART_BASE( i ) + 0x28) 115 | #define UART_LOWPULSE_MIN_CNT 0x000FFFFF 116 | #define UART_LOWPULSE_MIN_CNT_S 0 117 | 118 | #define UART_HIGHPULSE( i ) (REG_UART_BASE( i ) + 0x2C) 119 | #define UART_HIGHPULSE_MIN_CNT 0x000FFFFF 120 | #define UART_HIGHPULSE_MIN_CNT_S 0 121 | 122 | #define UART_PULSE_NUM( i ) (REG_UART_BASE( i ) + 0x30) 123 | #define UART_PULSE_NUM_CNT 0x0003FF 124 | #define UART_PULSE_NUM_CNT_S 0 125 | 126 | #define UART_DATE( i ) (REG_UART_BASE( i ) + 0x78) 127 | #define UART_ID( i ) (REG_UART_BASE( i ) + 0x7C) 128 | #endif // UART_REGISTER_H_INCLUDED 129 | -------------------------------------------------------------------------------- /include/espmissingincludes.h: -------------------------------------------------------------------------------- 1 | #ifndef ESPMISSINGINCLUDES_H 2 | #define ESPMISSINGINCLUDES_H 3 | 4 | #include 5 | 6 | //Missing function prototypes in include folders. Gcc will warn on these if we don't define 'em anywhere. 7 | //MOST OF THESE ARE GUESSED! but they seem to swork and shut up the compiler. 8 | typedef struct espconn espconn; 9 | 10 | int atoi(const char *nptr); 11 | void ets_install_putc1(void *routine); 12 | void ets_isr_attach(int intr, void *handler, void *arg); 13 | void ets_isr_mask(unsigned intr); 14 | void ets_isr_unmask(unsigned intr); 15 | int ets_memcmp(const void *s1, const void *s2, size_t n); 16 | void *ets_memcpy(void *dest, const void *src, size_t n); 17 | void *ets_memset(void *s, int c, size_t n); 18 | int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3))); 19 | int ets_str2macaddr(void *, void *); 20 | int ets_strcmp(const char *s1, const char *s2); 21 | char *ets_strcpy(char *dest, const char *src); 22 | size_t ets_strlen(const char *s); 23 | int ets_strncmp(const char *s1, const char *s2, int len); 24 | char *ets_strncpy(char *dest, const char *src, size_t n); 25 | char *ets_strstr(const char *haystack, const char *needle); 26 | void ets_timer_arm_new(ETSTimer *a, int b, int c, int isMstimer); 27 | void ets_timer_disarm(ETSTimer *a); 28 | void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *fn, void *parg); 29 | void ets_update_cpu_frequency(int freqmhz); 30 | int os_printf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); 31 | int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4))); 32 | int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2))); 33 | void pvPortFree(void *ptr); 34 | void *pvPortMalloc(size_t xWantedSize); 35 | void *pvPortZalloc(size_t); 36 | void uart_div_modify(int no, unsigned int freq); 37 | void vPortFree(void *ptr); 38 | void *vPortMalloc(size_t xWantedSize); 39 | uint8 wifi_get_opmode(void); 40 | uint32 system_get_time(); 41 | int os_random(); 42 | int rand(void); 43 | void ets_bzero(void *s, size_t n); 44 | void ets_delay_us(int ms); 45 | #endif 46 | -------------------------------------------------------------------------------- /include/math/cordic.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDE_CORDIC_H_ 2 | #define INCLUDE_CORDIC_H_ 3 | 4 | //Cordic in 32 bit signed fixed point math 5 | //Function is valid for arguments in range -pi/2 -- pi/2 6 | //for values pi/2--pi: value = half_pi-(theta-half_pi) and similarly for values -pi---pi/2 7 | // 8 | // 1.0 = 1073741824 9 | // 1/k = 0.6072529350088812561694 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | //Constants 16 | #define M_PI 3.14159265358979323846 17 | #define cordic_1K 0x26DD3B6A 18 | #define half_pi 0x6487ED51 19 | #define MUL 1073741824.000000 20 | #define CORDIC_NTAB 32 21 | 22 | void cordic(double degree, double *s, double *c); 23 | 24 | #ifdef __cplusplus 25 | }; 26 | #endif 27 | 28 | #endif /* INCLUDE_CORDIC_H_ */ 29 | -------------------------------------------------------------------------------- /include/user_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __USER_CONFIG_H__ 2 | #define __USER_CONFIG_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "driver/uart.h" 11 | 12 | #define DELAY_TIMER 40 // Delay timer in milliseconds 13 | #define UPDATE_SCREEN 0 14 | #define TEST_QUEUE_LEN 4 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /math/cordic.c: -------------------------------------------------------------------------------- 1 | #include "cordic.h" 2 | 3 | static int cordic_ctab [CORDIC_NTAB] = { 0x3243F6A8, 0x1DAC6705, 0x0FADBAFC, 0x07F56EA6, 0x03FEAB76, 0x01FFD55B, 4 | 0x00FFFAAA, 0x007FFF55, 0x003FFFEA, 0x001FFFFD, 0x000FFFFF, 0x0007FFFF, 0x0003FFFF, 5 | 0x0001FFFF, 0x0000FFFF, 0x00007FFF, 0x00003FFF, 0x00001FFF, 0x00000FFF, 0x000007FF, 6 | 0x000003FF, 0x000001FF, 0x000000FF, 0x0000007F, 0x0000003F, 0x0000001F, 0x0000000F, 7 | 0x00000008, 0x00000004, 0x00000002, 0x00000001, 0x00000000}; 8 | 9 | //#define SIN_COS_FROM_MATH_H 10 | 11 | #ifdef SIN_COS_FROM_MATH_H 12 | #include 13 | #endif 14 | 15 | void cordic(double degree, double *s, double *c) 16 | { 17 | 18 | #ifdef SIN_COS_FROM_MATH_H 19 | 20 | *s = sin(degree / 180.0 * M_PI); 21 | *c = cos(degree / 180.0 * M_PI); 22 | 23 | #else 24 | 25 | int k, d, tx, ty; 26 | int x = cordic_1K; 27 | int y = 0; 28 | int z = 0; 29 | 30 | if (degree < -90.0) degree += 180.0; 31 | if (degree > 90.0) degree -= 180.0; 32 | 33 | z = degree * M_PI / 180.0 * MUL; 34 | 35 | for (k=0; k < CORDIC_NTAB; ++k) 36 | { 37 | d = z>>31; 38 | //get sign. for other architectures, you might want to use the more portable version 39 | //d = z>=0 ? 0 : -1; 40 | tx = x - (((y>>k) ^ d) - d); 41 | ty = y + (((x>>k) ^ d) - d); 42 | z = z - ((cordic_ctab[k] ^ d) - d); 43 | x = tx; y = ty; 44 | } 45 | *c = x / MUL; 46 | *s = y / MUL; 47 | 48 | #endif 49 | } 50 | -------------------------------------------------------------------------------- /user/cube.cpp: -------------------------------------------------------------------------------- 1 | #include "cube.h" 2 | #include "cordic.h" 3 | #include "Adafruit_ILI9341_fast_as.h" 4 | 5 | extern "C" 6 | { 7 | #include 8 | } 9 | 10 | static const int16_t pix[VERTEX_COUNT][3] = {{-25,-25,-25},{25,-25,-25},{25,25,-25},{-25,25,-25}, 11 | {-25,-25,25}, {25,-25,25}, {25,25,25}, {-25,25,25} 12 | }; 13 | 14 | extern Adafruit_ILI9341 tft; 15 | 16 | ICACHE_FLASH_ATTR static void calcPerspectiveProjection(const int16_t * coordinate, int16_t * x, int16_t * y) 17 | { 18 | *x = coordinate[0] + coordinate[2] / 2; 19 | *y = coordinate[1] - coordinate[2] / 2; 20 | } 21 | 22 | static void drawLine( int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t color) 23 | { 24 | tft.drawLine(x0 + 120, y0 + 160, x1 + 120, y1 + 160, color); 25 | } 26 | 27 | ICACHE_FLASH_ATTR void cube_calculate(int16_t _pix[VERTEX_COUNT][3], double degreeX, double degreeY, double degreeZ, double scale, int16_t shiftX, int16_t shiftY, int16_t shiftZ) 28 | { 29 | 30 | uint8_t i; 31 | double sinx, siny, sinz, cosx, cosy, cosz; 32 | double x,y,z,x1,y1,z1; 33 | 34 | cordic(degreeX, &sinx, &cosx); 35 | cordic(degreeY, &siny, &cosy); 36 | cordic(degreeZ, &sinz, &cosz); 37 | 38 | for (i = 0; i < VERTEX_COUNT; i++) { 39 | 40 | x = pix[i][0]; // Base coordinate 41 | y = pix[i][1]; 42 | z = pix[i][2]; 43 | 44 | x1 = x*cosz + y*sinz; // Rotation around axis Z 45 | y1 = -x*sinz + y*cosz; 46 | z1 = z; 47 | 48 | x = x1; // Rotation around axis X 49 | y = y1*cosx + z1*sinx; 50 | z = -y1*sinx + z1*cosx; 51 | 52 | x1 = x*cosy - z*siny; // Rotation around axis Y 53 | y1 = y; 54 | z1 = x*siny + z*cosy; 55 | 56 | _pix[i][0] = (int16_t)(x1 * scale); // Scaling 57 | _pix[i][1] = (int16_t)(y1 * scale); 58 | _pix[i][2] = (int16_t)(z1 * scale); 59 | 60 | _pix[i][0] += shiftX; // Shift center coordinates 61 | _pix[i][1] += shiftY; 62 | _pix[i][2] += shiftZ; 63 | } 64 | } 65 | 66 | ICACHE_FLASH_ATTR void cube_draw(int16_t _pix[VERTEX_COUNT][3], uint16_t color) 67 | { 68 | uint8_t i, j; 69 | int16_t x0, y0, x1, y1; 70 | 71 | for (j = 0; j < VERTEX_COUNT; j++) { 72 | i = j; 73 | calcPerspectiveProjection(_pix[i], &x0, &y0); 74 | if (i < VERTEX_COUNT/2) { // Draw sealing ribs 75 | calcPerspectiveProjection(_pix[i+4], &x1, &y1); 76 | drawLine(x0, y0, x1, y1, color); 77 | } 78 | i ++; 79 | i = (i == VERTEX_COUNT/2) ? 0 : i; // Draws front face 80 | i = (i == VERTEX_COUNT) ? 4 : i; // Draws back face 81 | 82 | calcPerspectiveProjection(_pix[i], &x1, &y1); 83 | drawLine(x0, y0, x1, y1, color); 84 | } 85 | } 86 | 87 | ICACHE_FLASH_ATTR void cube_draw_init() 88 | { 89 | } 90 | -------------------------------------------------------------------------------- /user/routines.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "cpp_routines/routines.h" 4 | 5 | extern "C" 6 | { 7 | #include 8 | void *pvPortMalloc( size_t xWantedSize ); 9 | void vPortFree( void *pv ); 10 | void *pvPortZalloc(size_t size); 11 | } 12 | 13 | 14 | void *operator new(size_t size) 15 | { 16 | return os_malloc(size); 17 | } 18 | 19 | void *operator new[](size_t size) 20 | { 21 | return os_malloc(size); 22 | } 23 | 24 | void operator delete(void * ptr) 25 | { 26 | os_free(ptr); 27 | } 28 | 29 | void operator delete[](void * ptr) 30 | { 31 | os_free(ptr); 32 | } 33 | 34 | extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); 35 | extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); 36 | extern "C" void abort() 37 | { 38 | while(true); // enter an infinite loop and get reset by the WDT 39 | } 40 | 41 | void __cxa_pure_virtual(void) { 42 | abort(); 43 | } 44 | 45 | void __cxa_deleted_virtual(void) { 46 | abort(); 47 | } 48 | 49 | extern void (*__init_array_start)(void); 50 | extern void (*__init_array_end)(void); 51 | 52 | void do_global_ctors(void) 53 | { 54 | void (**p)(void); 55 | for (p = &__init_array_start; p != &__init_array_end; ++p) 56 | { 57 | (*p)(); 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /user/ui.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | extern "C" { 7 | #include "mini-printf.h" 8 | } 9 | 10 | #define TARGETTEMPSCREEN 11 | 12 | #define VGA_BLACK 0x0000 13 | #define VGA_WHITE 0xFFFF 14 | #define VGA_RED 0xF800 15 | #define VGA_GREEN 0x0400 16 | #define VGA_BLUE 0x001F 17 | #define VGA_SILVER 0xC618 18 | #define VGA_GRAY 0x8410 19 | #define VGA_MAROON 0x8000 20 | #define VGA_YELLOW 0xFFE0 21 | #define VGA_OLIVE 0x8400 22 | #define VGA_LIME 0x07E0 23 | #define VGA_AQUA 0x07FF 24 | #define VGA_TEAL 0x0410 25 | #define VGA_NAVY 0x0010 26 | #define VGA_FUCHSIA 0xF81F 27 | #define VGA_PURPLE 0x8010 28 | 29 | 30 | extern Adafruit_ILI9341 tft; 31 | 32 | extern float target_room_temperature; 33 | extern float RW_temperature; 34 | extern float target_RW_temperature; 35 | extern float room1_temperature; 36 | extern float room2_temperature; 37 | extern float outside_temperature; 38 | extern float min_target_temp; 39 | extern float max_target_temp; 40 | extern bool heater_enabled; 41 | extern time_t room1_updated; 42 | extern time_t room2_updated; 43 | extern time_t outside_updated; 44 | extern time_t heater_state_changed_time; 45 | extern time_t total_on_time; 46 | extern time_t total_off_time; 47 | extern time_t last24h_on_time; 48 | extern time_t last24h_off_time; 49 | 50 | time_t start_time; 51 | 52 | #define HEADERTEXT 2 53 | #define LINETEXT 2 54 | 55 | int color(uint8_t r, uint8_t g, uint8_t b) 56 | { 57 | return ((r&248)|g>>5) << 8 | ((g&28)<<3|b>>3); 58 | } 59 | 60 | ICACHE_FLASH_ATTR int drawPlaceholder(int x, int y, int width, int height, int bordercolor, const char* headertext) 61 | { 62 | int headersize = 18; 63 | tft.drawRoundRect(x, y, width, height, 3, bordercolor); 64 | tft.drawCentreString(headertext, x + width / 2, y + 1, HEADERTEXT); 65 | tft.drawFastHLine(x, y + headersize, width, bordercolor); 66 | 67 | return y + headersize; 68 | } 69 | 70 | const char* kidroom = "Kidroom"; 71 | const char* bedroom = "Bedroom"; 72 | const char* outside = "Outside"; 73 | ICACHE_FLASH_ATTR void drawWireFrame() 74 | { 75 | tft.setTextColor(VGA_SILVER, VGA_BLACK); 76 | //Target placeholder 77 | drawPlaceholder(0, 0, 133, 78, VGA_RED, "TARGET"); 78 | 79 | //Temperatures placeholder 80 | int placeholderbody = drawPlaceholder(135, 0, 184, 78, VGA_GREEN, "AIR"); 81 | tft.drawString(kidroom, 140, placeholderbody + 2, LINETEXT); 82 | tft.drawString(bedroom, 140, placeholderbody + 22, LINETEXT); 83 | tft.drawString(outside, 140, placeholderbody + 42, LINETEXT); 84 | 85 | //Water temperatures placeholder 86 | placeholderbody = drawPlaceholder(135, 80, 184, 60, VGA_PURPLE, "WATER"); 87 | tft.drawString("Current", 140, placeholderbody + 2, LINETEXT); 88 | tft.drawString("Target", 140, placeholderbody + 22, LINETEXT); 89 | 90 | //Fire icon placeholder 91 | drawPlaceholder(0, 80, 133, 60, VGA_RED, "FIRE"); 92 | 93 | //Status placeholder 94 | placeholderbody = drawPlaceholder(0, 142, 319, 97, VGA_WHITE, "UPDATED (secs ago)"); 95 | tft.drawString(kidroom, 6, placeholderbody + 2, LINETEXT); 96 | tft.drawString(bedroom, 6, placeholderbody + 22, LINETEXT); 97 | tft.drawString(outside, 6, placeholderbody + 42, LINETEXT); 98 | tft.drawString("Heater state", 160, placeholderbody + 2, LINETEXT); 99 | tft.drawString("Uptime", 160, placeholderbody + 22, LINETEXT); 100 | tft.drawString("OnPercentage", 160, placeholderbody + 42, LINETEXT); 101 | tft.drawString("24hOn", 160, placeholderbody + 62, LINETEXT); 102 | } 103 | 104 | ICACHE_FLASH_ATTR void drawTemperatures() 105 | { 106 | tft.setTextColor(VGA_AQUA, VGA_BLACK); 107 | tft.fillRect(255, 20, 48, 16, VGA_BLACK); 108 | tft.drawFloat(room1_temperature, 1, 255, 20, LINETEXT); 109 | 110 | tft.fillRect(255, 40, 48, 16, VGA_BLACK); 111 | tft.drawFloat(room2_temperature, 1, 255, 40, LINETEXT); 112 | 113 | tft.fillRect(255, 60, 48, 16, VGA_BLACK); 114 | tft.drawFloat(outside_temperature, 1, 255, 60, LINETEXT); 115 | } 116 | 117 | ICACHE_FLASH_ATTR void drawWaterTemperatures() 118 | { 119 | tft.setTextColor(VGA_AQUA, VGA_BLACK); 120 | tft.fillRect(255, 100, 48, 16, VGA_BLACK); 121 | tft.drawFloat(RW_temperature, 2, 255, 100, LINETEXT); 122 | 123 | tft.fillRect(255, 120, 48, 16, VGA_BLACK); 124 | tft.drawFloat(target_RW_temperature, 2, 255, 120, LINETEXT); 125 | } 126 | 127 | ICACHE_FLASH_ATTR time_t now() 128 | { 129 | return system_get_rtc_time() / 100000 - start_time; 130 | } 131 | 132 | ICACHE_FLASH_ATTR void drawUpdated() 133 | { 134 | tft.setTextColor(VGA_SILVER, VGA_BLACK); 135 | time_t cursecs = now(); 136 | tft.fillRect(100, 162, 48, 16, VGA_BLACK); 137 | tft.drawNumber(cursecs - room1_updated, 100, 162, LINETEXT); 138 | 139 | tft.fillRect(100, 182, 48, 16, VGA_BLACK); 140 | tft.drawNumber(cursecs - room2_updated, 100, 182, LINETEXT); 141 | 142 | tft.fillRect(100, 202, 48, 16, VGA_BLACK); 143 | tft.drawNumber(cursecs - outside_updated, 100, 202, LINETEXT); 144 | 145 | tft.fillRect(260, 162, 48, 16, VGA_BLACK); 146 | tft.drawNumber(cursecs - heater_state_changed_time, 260, 162, LINETEXT); 147 | 148 | char buf[20]; 149 | unsigned int days = cursecs / 86400ul; 150 | unsigned int hours = (cursecs - days * 86400ul) / 3600; 151 | unsigned int mins = (cursecs - days * 86400ul - hours * 3600ul) / 60ul; 152 | snprintf(buf, sizeof(buf), "%ud %02uh %02um", days, hours, mins); 153 | tft.drawString(buf, 210, 182, LINETEXT); 154 | 155 | tft.drawFloat(float(total_on_time) / (total_on_time + total_off_time) * 100, 1, 260, 202, LINETEXT); 156 | tft.drawFloat(float(last24h_on_time) / (last24h_on_time + last24h_off_time) * 100, 1, 260, 222, LINETEXT); 157 | } 158 | 159 | ICACHE_FLASH_ATTR void drawTargetTemp() 160 | { 161 | uint8_t colorvalue = (target_room_temperature - min_target_temp) / (max_target_temp - min_target_temp) * 255; 162 | int _color = color(colorvalue, 0, 255 - colorvalue); 163 | tft.setTextColor(_color, VGA_BLACK); 164 | tft.drawFloat(target_room_temperature, 1, 7, 24, 7); 165 | } 166 | 167 | ICACHE_FLASH_ATTR void updateFireIcon() 168 | { 169 | if (heater_enabled) 170 | { 171 | tft.setTextColor(VGA_RED, VGA_BLACK); 172 | tft.drawString(" ON ", 52, 110, 2); 173 | } 174 | else 175 | { 176 | tft.setTextColor(VGA_GRAY, VGA_BLACK); 177 | tft.drawString("OFF", 52, 110, 2); 178 | } 179 | } 180 | 181 | ICACHE_FLASH_ATTR void drawTargetTempScreen() 182 | { 183 | uint8_t barHeight = 8; 184 | uint8_t barSpace = 4; 185 | uint8_t initialBarWidth = 8; 186 | int numBars = tft.height() / (barHeight + barSpace); 187 | for (int i = 0; i < numBars; i++) 188 | { 189 | float barTemp = min_target_temp + i * ((max_target_temp - min_target_temp) / numBars); 190 | int y = i * (barHeight + barSpace); 191 | int width = initialBarWidth + 1.0f / 1404 * y * y + 0.1624 * y; 192 | uint8_t colorvalue = float(i) / numBars * 255; 193 | int _color = color(colorvalue, 0, 255 - colorvalue); 194 | if (barTemp <= target_room_temperature) 195 | { 196 | tft.fillRoundRect(0, tft.height() - y - barHeight, width, barHeight, 3, _color); 197 | } 198 | else 199 | { 200 | tft.fillRoundRect(1, tft.height() - y - barHeight + 1, width - 2, barHeight - 2, 3, VGA_BLACK); 201 | tft.drawRoundRect(0, tft.height() - y - barHeight, width, barHeight, 3, _color); 202 | } 203 | } 204 | uint8_t colorvalue = (target_room_temperature - min_target_temp) / (max_target_temp - min_target_temp) * 255; 205 | int _color = color(colorvalue, 0, 255 - colorvalue); 206 | tft.setTextColor(_color, VGA_BLACK); 207 | tft.drawFloat(target_room_temperature, 1, tft.width() / 2 - 64, tft.height() / 2 - 32, 7); 208 | } 209 | 210 | bool currentChangeTempMode = false; 211 | ICACHE_FLASH_ATTR void updateScreen(bool changeTempMode) 212 | { 213 | #ifdef TARGETTEMPSCREEN 214 | if (currentChangeTempMode != changeTempMode) 215 | { 216 | tft.fillScreen(VGA_BLACK); 217 | if (!changeTempMode) 218 | { 219 | drawWireFrame(); 220 | drawTargetTemp(); 221 | } 222 | } 223 | if (changeTempMode) 224 | { 225 | drawTargetTempScreen(); 226 | } 227 | else 228 | { 229 | #endif 230 | drawTargetTemp(); 231 | drawTemperatures(); 232 | drawWaterTemperatures(); 233 | updateFireIcon(); 234 | drawUpdated(); 235 | #ifdef TARGETTEMPSCREEN 236 | } 237 | 238 | currentChangeTempMode = changeTempMode; 239 | #endif 240 | } 241 | 242 | ICACHE_FLASH_ATTR void setupUI() 243 | { 244 | start_time = system_get_rtc_time() / 100000; 245 | tft.setRotation(3); 246 | tft.setTextColor(VGA_GREEN, VGA_BLACK); 247 | tft.fillScreen(ILI9341_BLACK); 248 | drawWireFrame(); 249 | drawTargetTemp(); 250 | } 251 | -------------------------------------------------------------------------------- /user/user_main.cpp: -------------------------------------------------------------------------------- 1 | //#define UIDEMO 2 | 3 | 4 | #include "Adafruit_ILI9341_fast_as.h" 5 | #include "cube.h" 6 | // ============================================================================================= 7 | // C includes and declarations 8 | // ============================================================================================= 9 | #include "cpp_routines/routines.h" 10 | #include 11 | 12 | extern "C" 13 | { 14 | #include "espmissingincludes.h" 15 | // declare lib methods 16 | extern int ets_uart_printf(const char *fmt, ...); 17 | void ets_timer_disarm(ETSTimer *ptimer); 18 | void ets_timer_setfn(ETSTimer *ptimer, ETSTimerFunc *pfunction, void *parg); 19 | } 20 | 21 | LOCAL os_timer_t timerHandler; 22 | Adafruit_ILI9341 tft; 23 | 24 | #ifdef UIDEMO 25 | extern void updateScreen(bool mode); 26 | extern void setupUI(); 27 | 28 | float target_room_temperature = 23.5; 29 | float RW_temperature = 65; 30 | float target_RW_temperature = 70; 31 | float room1_temperature = 23.4; 32 | float room2_temperature = 23.3; 33 | float outside_temperature = 2.4; 34 | float min_target_temp = 18; 35 | float max_target_temp = 26; 36 | bool heater_enabled = false; 37 | unsigned long room1_updated = -1; 38 | unsigned long room2_updated = -1; 39 | unsigned long outside_updated = -1; 40 | unsigned long heater_state_changed_time = 0; 41 | time_t total_on_time = 1; 42 | time_t total_off_time = 1; 43 | time_t last24h_on_time = 1; 44 | time_t last24h_off_time = 1; 45 | 46 | ICACHE_FLASH_ATTR static void updateScreen(void) 47 | { 48 | REG_SET_BIT(0x3ff00014, BIT(0)); 49 | os_update_cpu_frequency(160); 50 | 51 | target_room_temperature += 0.1; 52 | if (target_room_temperature > max_target_temp) 53 | target_room_temperature = min_target_temp; 54 | updateScreen((system_get_rtc_time() / 1000000) % 2); 55 | } 56 | #else 57 | LOCAL double degree = -180.0; 58 | LOCAL double scale = 1.5; 59 | int16_t current[VERTEX_COUNT][3]; 60 | int16_t previous[VERTEX_COUNT][3]; 61 | 62 | ICACHE_FLASH_ATTR static void updateScreen(void) 63 | { 64 | REG_SET_BIT(0x3ff00014, BIT(0)); 65 | os_update_cpu_frequency(160); 66 | cube_calculate(current, degree, 0, 0, scale, 0, 0, 0); 67 | degree += 4; 68 | if (degree > 180.0) degree -= 360.0; 69 | cube_draw(previous, 0); 70 | cube_draw(current, 0XFFFF); 71 | memcpy(previous, current, sizeof (previous)); 72 | } 73 | #endif 74 | 75 | ICACHE_FLASH_ATTR void sendMsgToHandler(void *arg) 76 | { 77 | system_os_post(USER_TASK_PRIO_0, UPDATE_SCREEN, 'a'); 78 | } 79 | 80 | ICACHE_FLASH_ATTR void handler_task (os_event_t *e) 81 | { 82 | switch (e->sig) 83 | { 84 | case UPDATE_SCREEN: updateScreen(); break; 85 | default: break; 86 | } 87 | } 88 | 89 | extern "C" ICACHE_FLASH_ATTR void user_init(void) 90 | { 91 | // Configure the UART 92 | uart_init(BIT_RATE_115200,BIT_RATE_115200); 93 | ets_uart_printf("\r\nSystem init...\r\n"); 94 | do_global_ctors(); 95 | ets_uart_printf("\r\nGlobal constructors invoked\r\n"); 96 | os_event_t *handlerQueue; 97 | 98 | // Initialize TFT 99 | tft.begin(); 100 | 101 | tft.fillScreen(0); 102 | #ifdef UIDEMO 103 | setupUI(); 104 | target_room_temperature = min_target_temp; 105 | #endif 106 | 107 | // Set up a timer to send the message to handler 108 | os_timer_disarm(&timerHandler); 109 | os_timer_setfn(&timerHandler, (os_timer_func_t *)sendMsgToHandler, (void *)0); 110 | os_timer_arm(&timerHandler, 1, 1); 111 | 112 | // Set up a timerHandler to send the message to handler 113 | handlerQueue = (os_event_t *)os_malloc(sizeof(os_event_t)*TEST_QUEUE_LEN); 114 | system_os_task(handler_task, USER_TASK_PRIO_0, handlerQueue, TEST_QUEUE_LEN); 115 | 116 | ets_uart_printf("System init done \r\n"); 117 | } 118 | --------------------------------------------------------------------------------