├── .clang_complete ├── .gcc-flags.json ├── .gitignore ├── README.md ├── examples ├── BigDemoNTSC │ ├── BigDemoNTSC.ino │ ├── TVOlogo.cpp │ ├── TVOlogo.h │ ├── schematic.cpp │ └── schematic.h ├── BigDemoPAL │ ├── BigDemoPAL.ino │ ├── TVOlogo.cpp │ ├── TVOlogo.h │ ├── schematic.cpp │ └── schematic.h ├── DemoNTSC │ └── DemoNTSC.ino ├── DemoPAL │ └── DemoPAL.ino └── NTSCserialTerm │ ├── NTSCserialTerm.ino │ ├── pollserial.cpp │ └── pollserial.h ├── keywords.txt ├── library.properties ├── platformio.ini ├── src ├── TVout.cpp ├── TVout.h ├── TVoutPrint.cpp ├── TVoutfonts │ ├── README.md │ ├── font4x6.cpp │ ├── font4x6.h │ ├── font6x8.cpp │ ├── font6x8.h │ ├── font8x8.cpp │ ├── font8x8.h │ ├── font8x8ext.cpp │ ├── font8x8ext.h │ └── fontALL.h ├── spec │ ├── asm_macros.h │ ├── hardware_setup.h │ └── video_properties.h ├── video_gen.cpp └── video_gen.h └── version history.txt /.clang_complete: -------------------------------------------------------------------------------- 1 | -I/Users/paul/.platformio/packages/framework-arduinoavr/cores/arduino 2 | -I/Users/paul/.platformio/packages/framework-arduinoavr/variants/eightanaloginputs 3 | -I/Users/paul/Projects/Arduino/arduino-tvout/src 4 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Bridge/src 5 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/EEPROM/src 6 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Esplora/src 7 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Ethernet/src 8 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Firmata 9 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Firmata/utility 10 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/GSM/src 11 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/HID/src 12 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Keyboard/src 13 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/LiquidCrystal/src 14 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Mouse/src 15 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/RobotIRremote/src 16 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Robot_Control/src 17 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Robot_Motor/src 18 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SD/src 19 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SPI/src 20 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Scheduler/src 21 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Servo/src 22 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SoftwareSerial/src 23 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SpacebrewYun/src 24 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Stepper/src 25 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/TFT/src 26 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Temboo/src 27 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/USBHost/src 28 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/WiFi/src 29 | -I/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Wire/src 30 | -I/Users/paul/.platformio/packages/toolchain-atmelavr/avr/include 31 | -I/Users/paul/.platformio/packages/toolchain-atmelavr/bfd/include 32 | -I/Users/paul/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include 33 | -I/Users/paul/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include-fixed 34 | -DF_CPU=16000000L 35 | -DPLATFORMIO=030100 36 | -DARDUINO_ARCH_AVR 37 | -DARDUINO_AVR_PRO 38 | -DARDUINO=10608 39 | -D__AVR_ATmega328P__ 40 | -------------------------------------------------------------------------------- /.gcc-flags.json: -------------------------------------------------------------------------------- 1 | { 2 | "execPath": "/Users/paul/.platformio/packages/toolchain-atmelavr/bin/avr-g++", 3 | "gccDefaultCFlags": "-fsyntax-only -std=gnu11 -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DPLATFORMIO=030100 -DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO -DARDUINO=10608", 4 | "gccDefaultCppFlags": "-fsyntax-only -fno-exceptions -fno-threadsafe-statics -std=gnu++11 -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DPLATFORMIO=030100 -DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO -DARDUINO=10608", 5 | "gccErrorLimit": 15, 6 | "gccIncludePaths": "/Users/paul/.platformio/packages/framework-arduinoavr/cores/arduino,/Users/paul/.platformio/packages/framework-arduinoavr/variants/eightanaloginputs,/Users/paul/Projects/Arduino/arduino-tvout/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Bridge/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/EEPROM/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Esplora/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Ethernet/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Firmata,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Firmata/utility,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/GSM/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/HID/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Keyboard/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/LiquidCrystal/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Mouse/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/RobotIRremote/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Robot_Control/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Robot_Motor/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SD/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SPI/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Scheduler/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Servo/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SoftwareSerial/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/SpacebrewYun/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Stepper/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/TFT/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Temboo/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/USBHost/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/WiFi/src,/Users/paul/.platformio/packages/framework-arduinoavr/libraries/Wire/src,/Users/paul/.platformio/packages/toolchain-atmelavr/avr/include,/Users/paul/.platformio/packages/toolchain-atmelavr/bfd/include,/Users/paul/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include,/Users/paul/.platformio/packages/toolchain-atmelavr/lib/gcc/avr/4.8.1/include-fixed", 7 | "gccSuppressWarnings": false 8 | } 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .clang_complete 3 | .gcc-flags.json 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino-TVout 2 | 3 | This is a library for generating composite video on an ATmega microcontroller. Hosted here to keep it available from Arduino IDE (and for simple download as the original Google Code has been archived). 4 | 5 | This branch of the TVout library has been patched to allow use with the Arduino Leonardo. The goal of this project is to create a simple interupt driven library for generating composite video on a single AVR chip. 6 | 7 | Currently the output is NTSC or PAL at a resolution of 128x96 by default. The library currently works on ATmega168,328,1280,2560,644p,1284p,32U4,AT90USB1286 and more can be added by editing spec/hardware_setup.h. 8 | 9 | There are some timing issues with the m1284p, may be related to sanguino core. 10 | 11 | ## Connections 12 | 13 | MCU | SYNCOUT | AUDIOOUT | VIDEO | VSYNCIN | CSYNCIN 14 | ---|---|---|---|---|--- 15 | m168,m328 | PB1 | PB3 | PD7 | INT0 | ICP1 16 | m1280,m2560 | PB5 | PB4 | PA7 | INT0 | ICP1 17 | m644,m1284p | PD5 | PD7 | PA7 | | 18 | m32u4 | PB5 | PB7 | PB4 | | 19 | AT90USB1286 | PB5 | PB4 | PF7 | | 20 | 21 | Arduino | SYNCOUT | AUDIOOUT | VIDEO | VSYNCIN | CSYNCIN 22 | ---|---|---|---|---|--- 23 | NG,Decimila,UNO | 9 | 11 | 7 | 2 | 8 24 | Mega | 11 | 10 | A7(D29) | 21 25 | sanguino | 13 | 8 | A7(D24) 26 | Leonardo | 9 | 11 | 8 27 | Nano | D9 | D11 | D7 | D2 | D8 28 | 29 | SYNCOUT is on OCR1A and AUDIOOUT is on OCR2A (except on the Arduino Leonardo, where AUDIOOUT is on OCR0A) 30 | 31 | There are some timing issues with the m1284p, may be related to sanguino core. 32 | 33 | On NG, Decimila, UNO and Nano the SYNCOUT is pin 9, video on 7 and AUDIOOUT on 11. 34 | On Mega2560 SYNCOUT is pin 11, video is on A7(D29) and AUDIOOUT is on pin 10. 35 | 36 | 37 | ## Examples 38 | 39 | https://youtu.be/MEg_V4YZDh0 40 | 41 | https://youtu.be/bHpFv_x_8Kk 42 | -------------------------------------------------------------------------------- /examples/BigDemoNTSC/BigDemoNTSC.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "schematic.h" 4 | #include "TVOlogo.h" 5 | 6 | TVout TV; 7 | 8 | int zOff = 150; 9 | int xOff = 0; 10 | int yOff = 0; 11 | int cSize = 50; 12 | int view_plane = 64; 13 | float angle = PI/60; 14 | 15 | float cube3d[8][3] = { 16 | {xOff - cSize,yOff + cSize,zOff - cSize}, 17 | {xOff + cSize,yOff + cSize,zOff - cSize}, 18 | {xOff - cSize,yOff - cSize,zOff - cSize}, 19 | {xOff + cSize,yOff - cSize,zOff - cSize}, 20 | {xOff - cSize,yOff + cSize,zOff + cSize}, 21 | {xOff + cSize,yOff + cSize,zOff + cSize}, 22 | {xOff - cSize,yOff - cSize,zOff + cSize}, 23 | {xOff + cSize,yOff - cSize,zOff + cSize} 24 | }; 25 | unsigned char cube2d[8][2]; 26 | 27 | 28 | void setup() { 29 | TV.begin(NTSC|OVERLAY,120,96); 30 | TV.select_font(font6x8); 31 | intro(); 32 | TV.println(F("I am the TVout\nlibrary running on a freeduino\n")); 33 | TV.delay(2500); 34 | TV.println(F("I generate a PAL\nor NTSC composite video using\ninterrupts\n")); 35 | TV.delay(2500); 36 | TV.println(F("My schematic:")); 37 | TV.delay(1500); 38 | TV.bitmap(0,0,schematic); 39 | TV.delay(10000); 40 | TV.clear_screen(); 41 | TV.println(F("Lets see what\nwhat I can do")); 42 | TV.delay(2000); 43 | 44 | //fonts 45 | TV.clear_screen(); 46 | TV.println(0,0,F("Multiple fonts:")); 47 | TV.select_font(font4x6); 48 | TV.println(F("4x6 font FONT")); 49 | TV.select_font(font6x8); 50 | TV.println(F("6x8 font FONT")); 51 | TV.select_font(font8x8); 52 | TV.println(F("8x8 font FONT")); 53 | TV.select_font(font6x8); 54 | TV.delay(2000); 55 | 56 | TV.clear_screen(); 57 | TV.print(9,44,F("Draw Basic Shapes")); 58 | TV.delay(2000); 59 | 60 | //circles 61 | TV.clear_screen(); 62 | TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); 63 | TV.delay(500); 64 | TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); 65 | TV.delay(2000); 66 | 67 | //rectangles and lines 68 | TV.clear_screen(); 69 | TV.draw_rect(20,20,80,56,WHITE); 70 | TV.delay(500); 71 | TV.draw_rect(10,10,100,76,WHITE,INVERT); 72 | TV.delay(500); 73 | TV.draw_line(60,20,60,76,INVERT); 74 | TV.draw_line(20,48,100,48,INVERT); 75 | TV.delay(500); 76 | TV.draw_line(10,10,110,86,INVERT); 77 | TV.draw_line(10,86,110,10,INVERT); 78 | TV.delay(2000); 79 | 80 | //random cube forever. 81 | TV.clear_screen(); 82 | TV.print(16,40,F("Random Cube")); 83 | TV.print(28,48,F("Rotation")); 84 | TV.delay(2000); 85 | 86 | randomSeed(analogRead(0)); 87 | } 88 | 89 | void loop() { 90 | int rsteps = random(10,60); 91 | switch(random(6)) { 92 | case 0: 93 | for (int i = 0; i < rsteps; i++) { 94 | zrotate(angle); 95 | printcube(); 96 | } 97 | break; 98 | case 1: 99 | for (int i = 0; i < rsteps; i++) { 100 | zrotate(2*PI - angle); 101 | printcube(); 102 | } 103 | break; 104 | case 2: 105 | for (int i = 0; i < rsteps; i++) { 106 | xrotate(angle); 107 | printcube(); 108 | } 109 | break; 110 | case 3: 111 | for (int i = 0; i < rsteps; i++) { 112 | xrotate(2*PI - angle); 113 | printcube(); 114 | } 115 | break; 116 | case 4: 117 | for (int i = 0; i < rsteps; i++) { 118 | yrotate(angle); 119 | printcube(); 120 | } 121 | break; 122 | case 5: 123 | for (int i = 0; i < rsteps; i++) { 124 | yrotate(2*PI - angle); 125 | printcube(); 126 | } 127 | break; 128 | } 129 | } 130 | 131 | void intro() { 132 | unsigned char w,l,wb; 133 | int index; 134 | w = pgm_read_byte(TVOlogo); 135 | l = pgm_read_byte(TVOlogo+1); 136 | if (w&7) 137 | wb = w/8 + 1; 138 | else 139 | wb = w/8; 140 | index = wb*(l-1) + 2; 141 | for ( unsigned char i = 1; i < l; i++ ) { 142 | TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); 143 | index-= wb; 144 | TV.delay(50); 145 | } 146 | for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { 147 | TV.bitmap((TV.hres() - w)/2,i,TVOlogo); 148 | TV.delay(50); 149 | } 150 | TV.delay(3000); 151 | TV.clear_screen(); 152 | } 153 | 154 | void printcube() { 155 | //calculate 2d points 156 | for(byte i = 0; i < 8; i++) { 157 | cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); 158 | cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); 159 | } 160 | TV.delay_frame(1); 161 | TV.clear_screen(); 162 | draw_cube(); 163 | } 164 | 165 | void zrotate(float q) { 166 | float tx,ty,temp; 167 | for(byte i = 0; i < 8; i++) { 168 | tx = cube3d[i][0] - xOff; 169 | ty = cube3d[i][1] - yOff; 170 | temp = tx * cos(q) - ty * sin(q); 171 | ty = tx * sin(q) + ty * cos(q); 172 | tx = temp; 173 | cube3d[i][0] = tx + xOff; 174 | cube3d[i][1] = ty + yOff; 175 | } 176 | } 177 | 178 | void yrotate(float q) { 179 | float tx,tz,temp; 180 | for(byte i = 0; i < 8; i++) { 181 | tx = cube3d[i][0] - xOff; 182 | tz = cube3d[i][2] - zOff; 183 | temp = tz * cos(q) - tx * sin(q); 184 | tx = tz * sin(q) + tx * cos(q); 185 | tz = temp; 186 | cube3d[i][0] = tx + xOff; 187 | cube3d[i][2] = tz + zOff; 188 | } 189 | } 190 | 191 | void xrotate(float q) { 192 | float ty,tz,temp; 193 | for(byte i = 0; i < 8; i++) { 194 | ty = cube3d[i][1] - yOff; 195 | tz = cube3d[i][2] - zOff; 196 | temp = ty * cos(q) - tz * sin(q); 197 | tz = ty * sin(q) + tz * cos(q); 198 | ty = temp; 199 | cube3d[i][1] = ty + yOff; 200 | cube3d[i][2] = tz + zOff; 201 | } 202 | } 203 | 204 | void draw_cube() { 205 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); 206 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); 207 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); 208 | TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); 209 | TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); 210 | TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); 211 | TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); 212 | TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); 213 | TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); 214 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); 215 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); 216 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); 217 | } 218 | -------------------------------------------------------------------------------- /examples/BigDemoNTSC/TVOlogo.cpp: -------------------------------------------------------------------------------- 1 | #include "TVOlogo.h" 2 | PROGMEM const unsigned char TVOlogo[] = { 3 | 96,32, 4 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5 | 0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, 6 | 0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, 7 | 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, 8 | 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, 9 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, 10 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, 11 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, 12 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, 13 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, 14 | 0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, 15 | 0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, 16 | 0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, 17 | 0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, 18 | 0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, 19 | 0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, 20 | 0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, 21 | 0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, 22 | 0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, 23 | 0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, 24 | 0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, 25 | 0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, 26 | 0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, 27 | 0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, 28 | 0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, 29 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, 30 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, 31 | 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, 32 | 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, 33 | 0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, 34 | 0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, 35 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /examples/BigDemoNTSC/TVOlogo.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef TVOLOGO_H 3 | #define TVOLOGO_H 4 | 5 | extern const unsigned char TVOlogo[]; 6 | #endif -------------------------------------------------------------------------------- /examples/BigDemoNTSC/schematic.cpp: -------------------------------------------------------------------------------- 1 | #include "schematic.h" 2 | 3 | PROGMEM const unsigned char schematic[] = { 4 | 120,96, 5 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 7 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 8 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 9 | 0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, 10 | 0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, 11 | 0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, 12 | 0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, 13 | 0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, 14 | 0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, 15 | 0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, 16 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 17 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 18 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 19 | 0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, 20 | 0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, 21 | 0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, 22 | 0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, 23 | 0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, 24 | 0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, 25 | 0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, 26 | 0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, 27 | 0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, 28 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, 29 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, 30 | 0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, 31 | 0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, 32 | 0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, 33 | 0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, 34 | 0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, 35 | 0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, 36 | 0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, 37 | 0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, 38 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, 39 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 40 | 0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, 41 | 0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, 42 | 0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, 43 | 0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, 44 | 0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, 45 | 0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, 46 | 0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, 47 | 0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, 48 | 0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, 49 | 0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, 50 | 0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, 51 | 0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, 52 | 0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, 53 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 54 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 55 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 56 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 58 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 59 | 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 60 | 0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, 61 | 0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, 62 | 0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, 63 | 0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, 64 | 0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, 65 | 0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, 66 | 0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, 67 | 0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, 68 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 69 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 70 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 71 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 72 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 73 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 74 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 75 | 0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 76 | 0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 77 | 0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, 78 | 0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, 79 | 0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, 80 | 0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, 81 | 0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, 82 | 0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, 83 | 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, 84 | 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, 85 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 86 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 87 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 88 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 89 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 90 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 91 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 92 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 93 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 94 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 95 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 96 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 97 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 98 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 99 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 100 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 101 | }; 102 | -------------------------------------------------------------------------------- /examples/BigDemoNTSC/schematic.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef SHEMATIC_H 3 | #define SHEMATIC_H 4 | 5 | extern const unsigned char schematic[]; 6 | #endif 7 | -------------------------------------------------------------------------------- /examples/BigDemoPAL/BigDemoPAL.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "schematic.h" 4 | #include "TVOlogo.h" 5 | 6 | TVout TV; 7 | 8 | int zOff = 150; 9 | int xOff = 0; 10 | int yOff = 0; 11 | int cSize = 50; 12 | int view_plane = 64; 13 | float angle = PI/60; 14 | 15 | float cube3d[8][3] = { 16 | {xOff - cSize,yOff + cSize,zOff - cSize}, 17 | {xOff + cSize,yOff + cSize,zOff - cSize}, 18 | {xOff - cSize,yOff - cSize,zOff - cSize}, 19 | {xOff + cSize,yOff - cSize,zOff - cSize}, 20 | {xOff - cSize,yOff + cSize,zOff + cSize}, 21 | {xOff + cSize,yOff + cSize,zOff + cSize}, 22 | {xOff - cSize,yOff - cSize,zOff + cSize}, 23 | {xOff + cSize,yOff - cSize,zOff + cSize} 24 | }; 25 | unsigned char cube2d[8][2]; 26 | 27 | 28 | void setup() { 29 | TV.begin(PAL|OVERLAY,120,96); 30 | TV.select_font(font6x8); 31 | intro(); 32 | TV.println(F("I am the TVout\nlibrary running on a freeduino\n")); 33 | TV.delay(2500); 34 | TV.println(F("I generate a PAL\nor NTSC composite video using\ninterrupts\n")); 35 | TV.delay(2500); 36 | TV.println(F("My schematic:")); 37 | TV.delay(1500); 38 | TV.bitmap(0,0,schematic); 39 | TV.delay(10000); 40 | TV.clear_screen(); 41 | TV.println(F("Lets see what\nwhat I can do")); 42 | TV.delay(2000); 43 | 44 | //fonts 45 | TV.clear_screen(); 46 | TV.println(0,0,F("Multiple fonts:")); 47 | TV.select_font(font4x6); 48 | TV.println(F("4x6 font FONT")); 49 | TV.select_font(font6x8); 50 | TV.println(F("6x8 font FONT")); 51 | TV.select_font(font8x8); 52 | TV.println(F("8x8 font FONT")); 53 | TV.select_font(font6x8); 54 | TV.delay(2000); 55 | 56 | TV.clear_screen(); 57 | TV.print(9,44,F("Draw Basic Shapes")); 58 | TV.delay(2000); 59 | 60 | //circles 61 | TV.clear_screen(); 62 | TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/3,WHITE); 63 | TV.delay(500); 64 | TV.draw_circle(TV.hres()/2,TV.vres()/2,TV.vres()/2,WHITE,INVERT); 65 | TV.delay(2000); 66 | 67 | //rectangles and lines 68 | TV.clear_screen(); 69 | TV.draw_rect(20,20,80,56,WHITE); 70 | TV.delay(500); 71 | TV.draw_rect(10,10,100,76,WHITE,INVERT); 72 | TV.delay(500); 73 | TV.draw_line(60,20,60,76,INVERT); 74 | TV.draw_line(20,48,100,48,INVERT); 75 | TV.delay(500); 76 | TV.draw_line(10,10,110,86,INVERT); 77 | TV.draw_line(10,86,110,10,INVERT); 78 | TV.delay(2000); 79 | 80 | //random cube forever. 81 | TV.clear_screen(); 82 | TV.print(16,40,F("Random Cube")); 83 | TV.print(28,48,F("Rotation")); 84 | TV.delay(2000); 85 | 86 | randomSeed(analogRead(0)); 87 | } 88 | 89 | void loop() { 90 | int rsteps = random(10,60); 91 | switch(random(6)) { 92 | case 0: 93 | for (int i = 0; i < rsteps; i++) { 94 | zrotate(angle); 95 | printcube(); 96 | } 97 | break; 98 | case 1: 99 | for (int i = 0; i < rsteps; i++) { 100 | zrotate(2*PI - angle); 101 | printcube(); 102 | } 103 | break; 104 | case 2: 105 | for (int i = 0; i < rsteps; i++) { 106 | xrotate(angle); 107 | printcube(); 108 | } 109 | break; 110 | case 3: 111 | for (int i = 0; i < rsteps; i++) { 112 | xrotate(2*PI - angle); 113 | printcube(); 114 | } 115 | break; 116 | case 4: 117 | for (int i = 0; i < rsteps; i++) { 118 | yrotate(angle); 119 | printcube(); 120 | } 121 | break; 122 | case 5: 123 | for (int i = 0; i < rsteps; i++) { 124 | yrotate(2*PI - angle); 125 | printcube(); 126 | } 127 | break; 128 | } 129 | } 130 | 131 | void intro() { 132 | unsigned char w,l,wb; 133 | int index; 134 | w = pgm_read_byte(TVOlogo); 135 | l = pgm_read_byte(TVOlogo+1); 136 | if (w&7) 137 | wb = w/8 + 1; 138 | else 139 | wb = w/8; 140 | index = wb*(l-1) + 2; 141 | for ( unsigned char i = 1; i < l; i++ ) { 142 | TV.bitmap((TV.hres() - w)/2,0,TVOlogo,index,w,i); 143 | index-= wb; 144 | TV.delay(50); 145 | } 146 | for (unsigned char i = 0; i < (TV.vres() - l)/2; i++) { 147 | TV.bitmap((TV.hres() - w)/2,i,TVOlogo); 148 | TV.delay(50); 149 | } 150 | TV.delay(3000); 151 | TV.clear_screen(); 152 | } 153 | 154 | void printcube() { 155 | //calculate 2d points 156 | for(byte i = 0; i < 8; i++) { 157 | cube2d[i][0] = (unsigned char)((cube3d[i][0] * view_plane / cube3d[i][2]) + (TV.hres()/2)); 158 | cube2d[i][1] = (unsigned char)((cube3d[i][1] * view_plane / cube3d[i][2]) + (TV.vres()/2)); 159 | } 160 | TV.delay_frame(1); 161 | TV.clear_screen(); 162 | draw_cube(); 163 | } 164 | 165 | void zrotate(float q) { 166 | float tx,ty,temp; 167 | for(byte i = 0; i < 8; i++) { 168 | tx = cube3d[i][0] - xOff; 169 | ty = cube3d[i][1] - yOff; 170 | temp = tx * cos(q) - ty * sin(q); 171 | ty = tx * sin(q) + ty * cos(q); 172 | tx = temp; 173 | cube3d[i][0] = tx + xOff; 174 | cube3d[i][1] = ty + yOff; 175 | } 176 | } 177 | 178 | void yrotate(float q) { 179 | float tx,tz,temp; 180 | for(byte i = 0; i < 8; i++) { 181 | tx = cube3d[i][0] - xOff; 182 | tz = cube3d[i][2] - zOff; 183 | temp = tz * cos(q) - tx * sin(q); 184 | tx = tz * sin(q) + tx * cos(q); 185 | tz = temp; 186 | cube3d[i][0] = tx + xOff; 187 | cube3d[i][2] = tz + zOff; 188 | } 189 | } 190 | 191 | void xrotate(float q) { 192 | float ty,tz,temp; 193 | for(byte i = 0; i < 8; i++) { 194 | ty = cube3d[i][1] - yOff; 195 | tz = cube3d[i][2] - zOff; 196 | temp = ty * cos(q) - tz * sin(q); 197 | tz = ty * sin(q) + tz * cos(q); 198 | ty = temp; 199 | cube3d[i][1] = ty + yOff; 200 | cube3d[i][2] = tz + zOff; 201 | } 202 | } 203 | 204 | void draw_cube() { 205 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[1][0],cube2d[1][1],WHITE); 206 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[2][0],cube2d[2][1],WHITE); 207 | TV.draw_line(cube2d[0][0],cube2d[0][1],cube2d[4][0],cube2d[4][1],WHITE); 208 | TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[5][0],cube2d[5][1],WHITE); 209 | TV.draw_line(cube2d[1][0],cube2d[1][1],cube2d[3][0],cube2d[3][1],WHITE); 210 | TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[6][0],cube2d[6][1],WHITE); 211 | TV.draw_line(cube2d[2][0],cube2d[2][1],cube2d[3][0],cube2d[3][1],WHITE); 212 | TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[6][0],cube2d[6][1],WHITE); 213 | TV.draw_line(cube2d[4][0],cube2d[4][1],cube2d[5][0],cube2d[5][1],WHITE); 214 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[6][0],cube2d[6][1],WHITE); 215 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[3][0],cube2d[3][1],WHITE); 216 | TV.draw_line(cube2d[7][0],cube2d[7][1],cube2d[5][0],cube2d[5][1],WHITE); 217 | } 218 | -------------------------------------------------------------------------------- /examples/BigDemoPAL/TVOlogo.cpp: -------------------------------------------------------------------------------- 1 | #include "TVOlogo.h" 2 | PROGMEM const unsigned char TVOlogo[] = { 3 | 96,32, 4 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5 | 0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, 6 | 0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, 7 | 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x10,0x38, 8 | 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x04, 9 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40,0x02, 10 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x80,0x02, 11 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x02, 12 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, 13 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, 14 | 0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x00,0x17,0xFF,0xFF,0x42, 15 | 0x4F,0xFF,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x00,0x01,0x42, 16 | 0x40,0x60,0x60,0x18,0x00,0x00,0x00,0x30,0x14,0x70,0x71,0x42, 17 | 0x40,0x60,0x30,0x30,0x00,0x00,0x00,0x30,0x14,0x88,0x89,0x42, 18 | 0x40,0x60,0x30,0x30,0x3E,0x06,0x0C,0xFE,0x15,0x05,0x25,0x42, 19 | 0x40,0x60,0x30,0x60,0xFF,0x86,0x0C,0xFE,0x15,0x72,0x75,0x42, 20 | 0x40,0x60,0x18,0x60,0xC1,0x86,0x0C,0x30,0x15,0x05,0x25,0x42, 21 | 0x40,0x60,0x18,0x61,0x80,0xC6,0x0C,0x30,0x14,0x88,0x89,0x42, 22 | 0x40,0x60,0x18,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x70,0x71,0x42, 23 | 0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x14,0x00,0x01,0x42, 24 | 0x40,0x60,0x0C,0xC1,0x80,0xC6,0x0C,0x30,0x17,0xFF,0xFF,0x42, 25 | 0x40,0x60,0x0F,0x81,0x80,0xC6,0x0C,0x30,0x10,0x00,0x00,0x42, 26 | 0x40,0x60,0x07,0x80,0xC1,0x87,0x1C,0x30,0x15,0x40,0x15,0x42, 27 | 0x40,0x60,0x07,0x80,0xFF,0x83,0xFC,0x3E,0x12,0x8A,0x8A,0x42, 28 | 0x40,0x60,0x03,0x00,0x3E,0x01,0xEC,0x1E,0x15,0x40,0x15,0x42, 29 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x42, 30 | 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xC2, 31 | 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, 32 | 0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38, 33 | 0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0, 34 | 0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x00, 35 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /examples/BigDemoPAL/TVOlogo.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef TVOLOGO_H 3 | #define TVOLOGO_H 4 | 5 | extern const unsigned char TVOlogo[]; 6 | #endif -------------------------------------------------------------------------------- /examples/BigDemoPAL/schematic.cpp: -------------------------------------------------------------------------------- 1 | #include "schematic.h" 2 | 3 | PROGMEM const unsigned char schematic[] = { 4 | 120,96, 5 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 6 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 7 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 8 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 9 | 0x0B,0x0C,0xE4,0x41,0x00,0x00,0x03,0x12,0x0E,0x22,0x61,0x80,0xB8,0x71,0x82, 10 | 0x0B,0x0D,0x94,0x41,0x00,0x00,0x05,0x14,0x11,0x22,0x61,0x80,0xA4,0xC9,0x82, 11 | 0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x52,0x80,0xA4,0x81,0x42, 12 | 0x0A,0x95,0x04,0x41,0x00,0x00,0x01,0x18,0x11,0x3E,0x52,0x80,0xB8,0x82,0x42, 13 | 0x0A,0x65,0x04,0x41,0x00,0x00,0x01,0x14,0x11,0x22,0x4C,0x80,0xA4,0x83,0xC2, 14 | 0x0A,0x65,0x94,0x41,0x00,0x00,0x01,0x12,0x11,0x22,0x4C,0x80,0xA4,0xCA,0x22, 15 | 0x0A,0x64,0xE3,0x81,0x00,0x00,0x07,0x92,0x0E,0x22,0x4C,0x80,0xA4,0x74,0x22, 16 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 17 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 18 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 19 | 0x08,0x70,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x80,0x00,0x02, 20 | 0x08,0x90,0x00,0x01,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x80,0x00,0x02, 21 | 0x08,0x84,0x5E,0x39,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x40,0x80,0x00,0x02, 22 | 0x08,0x64,0x92,0x41,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x20,0x80,0x00,0x02, 23 | 0x08,0x12,0x92,0x41,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, 24 | 0x08,0x92,0x92,0x41,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x04,0x80,0x00,0x02, 25 | 0x08,0xE1,0x12,0x39,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0xA1,0x4F,0x02, 26 | 0x08,0x01,0x00,0x01,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x04,0xB3,0x49,0x82, 27 | 0x08,0x02,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x04,0x92,0x48,0x82, 28 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x92,0x48,0x82, 29 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x9C,0x48,0x82, 30 | 0x08,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x04,0x8C,0x49,0x82, 31 | 0x08,0x02,0x14,0xF1,0x00,0x00,0x02,0x80,0x02,0x80,0x02,0x84,0x8C,0x4F,0x02, 32 | 0x08,0x03,0x34,0x99,0x00,0x00,0x04,0x40,0x04,0x40,0x04,0x44,0x80,0x00,0x02, 33 | 0x08,0x01,0x24,0x89,0x00,0x00,0x08,0x20,0x08,0x20,0x08,0x24,0x80,0x00,0x02, 34 | 0x08,0x01,0x24,0x89,0xFF,0xFF,0xF0,0x10,0x10,0x10,0x10,0x1C,0x80,0x00,0x02, 35 | 0x08,0x01,0xC4,0x89,0x00,0x00,0x00,0x08,0x20,0x08,0x20,0x00,0x80,0x00,0x02, 36 | 0x08,0x00,0xC4,0x99,0x00,0x00,0x00,0x04,0x40,0x04,0x40,0x00,0x80,0x00,0x02, 37 | 0x08,0x00,0xC4,0xF1,0x00,0x00,0x00,0x02,0x80,0x02,0x80,0x00,0x80,0x00,0x02, 38 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x80,0x00,0x02, 39 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 40 | 0x08,0x00,0x00,0x01,0x00,0x00,0x0C,0xF9,0xC1,0xC4,0x4C,0x30,0x80,0x00,0x02, 41 | 0x08,0x00,0x00,0x01,0x00,0x00,0x14,0x1A,0x42,0x24,0x4C,0x30,0x80,0x00,0x02, 42 | 0x08,0x00,0x00,0x01,0x00,0x00,0x34,0x12,0x42,0x24,0x4A,0x50,0x80,0x00,0x02, 43 | 0x08,0x00,0x00,0x01,0x00,0x00,0x24,0x32,0x42,0x27,0xCA,0x50,0x80,0x00,0x02, 44 | 0x08,0x00,0x00,0x01,0x00,0x00,0x3E,0x22,0x42,0x24,0x49,0x90,0x80,0x00,0x02, 45 | 0x08,0x00,0x00,0x01,0x00,0x00,0x04,0x62,0x42,0x24,0x49,0x90,0x80,0x00,0x02, 46 | 0x08,0x1E,0x64,0xF1,0x00,0x00,0x04,0x43,0x81,0xC4,0x49,0x90,0x9E,0x64,0xF2, 47 | 0x08,0x32,0x64,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x64,0x9A, 48 | 0x08,0x20,0x54,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA0,0x54,0x8A, 49 | 0x08,0x26,0x54,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xA6,0x54,0x8A, 50 | 0x08,0x22,0x4C,0x89,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA2,0x4C,0x8A, 51 | 0x08,0x32,0x4C,0x99,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB2,0x4C,0x9A, 52 | 0x08,0x1E,0x4C,0xF1,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9E,0x4C,0xF2, 53 | 0x08,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x02, 54 | 0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFE, 55 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 56 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 58 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 59 | 0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 60 | 0x30,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x81,0xC6,0x04,0x00, 61 | 0x48,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x42,0x2A,0x04,0x00, 62 | 0x42,0x25,0x87,0x04,0x38,0x3C,0x48,0x8B,0xC8,0x8E,0x08,0x24,0x02,0x0A,0x00, 63 | 0x22,0x26,0x48,0x04,0x40,0x02,0x48,0x88,0x28,0x90,0x08,0x24,0x02,0x0A,0x00, 64 | 0x11,0x44,0x48,0x04,0x60,0x1E,0x45,0x51,0xE5,0x18,0x08,0x24,0x02,0x11,0x00, 65 | 0x09,0x44,0x48,0x04,0x18,0x22,0x45,0x52,0x25,0x06,0x08,0x24,0x02,0x1F,0x00, 66 | 0x48,0x84,0x48,0x04,0x08,0x22,0x42,0x22,0x22,0x02,0x04,0x42,0x22,0x20,0x80, 67 | 0x30,0x84,0x47,0x04,0x70,0x1E,0x42,0x21,0xE2,0x1C,0x03,0x81,0xCF,0xA0,0x80, 68 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 69 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00, 70 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 71 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 72 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 73 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 74 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 75 | 0x82,0x8F,0x01,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 76 | 0x82,0x88,0x80,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, 77 | 0x44,0x88,0x41,0x0E,0x0F,0x02,0x03,0x8B,0x03,0xC5,0x91,0x07,0x87,0x17,0xE0, 78 | 0x44,0x88,0x41,0x10,0x08,0x82,0x04,0x4C,0x80,0x26,0x51,0x04,0x48,0x98,0x80, 79 | 0x28,0x88,0x41,0x18,0x08,0x84,0x04,0x48,0x81,0xE4,0x4A,0x04,0x48,0x90,0x80, 80 | 0x28,0x88,0x41,0x06,0x08,0x84,0x04,0x48,0x82,0x24,0x4A,0x04,0x48,0x90,0x80, 81 | 0x10,0x88,0x81,0x02,0x08,0x88,0x04,0x48,0x82,0x24,0x44,0x04,0x48,0x90,0x80, 82 | 0x10,0x8F,0x01,0x1C,0x0F,0x08,0x03,0x88,0x81,0xE4,0x44,0x07,0x87,0x10,0x60, 83 | 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, 84 | 0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x00,0x00,0x00, 85 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 86 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 87 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 88 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 89 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 90 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 91 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 92 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 93 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 94 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 95 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 96 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 97 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 98 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 99 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 100 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 101 | }; 102 | -------------------------------------------------------------------------------- /examples/BigDemoPAL/schematic.h: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef SHEMATIC_H 3 | #define SHEMATIC_H 4 | 5 | extern const unsigned char schematic[]; 6 | #endif 7 | -------------------------------------------------------------------------------- /examples/DemoNTSC/DemoNTSC.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | TVout TV; 5 | unsigned char x,y; 6 | 7 | void setup() { 8 | x=0; 9 | y=0; 10 | TV.begin(NTSC|OVERLAY); //for devices with only 1k sram(m168) use TV.begin(_NTSC,128,56) 11 | TV.select_font(font6x8); 12 | } 13 | 14 | void loop() { 15 | TV.clear_screen(); 16 | x=0; 17 | y=0; 18 | for (char i = 32; i < 127; i++) { 19 | TV.print_char(x*6,y*8,i); 20 | x++; 21 | if (x >= TV.char_line()) { 22 | y++; 23 | x=0; 24 | } 25 | } 26 | TV.delay(1000); 27 | TV.clear_screen(); 28 | TV.println(F("Fill the Screen\nPixel by Pixel")); 29 | TV.delay(1000); 30 | TV.clear_screen(); 31 | for(x=0;x 2 | #include 3 | 4 | TVout TV; 5 | unsigned char x,y; 6 | 7 | void setup() { 8 | x=0; 9 | y=0; 10 | TV.begin(PAL|OVERLAY); //for devices with only 1k sram(m168) use TV.begin(_NTSC,128,56) 11 | TV.select_font(font6x8); 12 | } 13 | 14 | void loop() { 15 | TV.clear_screen(); 16 | x=0; 17 | y=0; 18 | for (char i = 32; i < 127; i++) { 19 | TV.print_char(x*6,y*8,i); 20 | x++; 21 | if (x >= TV.char_line()) { 22 | y++; 23 | x=0; 24 | } 25 | } 26 | TV.delay(1000); 27 | TV.clear_screen(); 28 | TV.println(F("Fill the Screen\nPixel by Pixel")); 29 | TV.delay(1000); 30 | TV.clear_screen(); 31 | for(x=0;x 2 | #include 3 | #include "pollserial.h" 4 | 5 | TVout TV; 6 | pollserial pserial; 7 | 8 | void setup() { 9 | TV.begin(NTSC,184,72); 10 | TV.select_font(font6x8); 11 | TV.println("Serial Terminal"); 12 | TV.println("-- Version 0.1 --"); 13 | TV.set_hbi_hook(pserial.begin(57600)); 14 | } 15 | 16 | void loop() { 17 | if (pserial.available()) { 18 | TV.print((char)pserial.read()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/NTSCserialTerm/pollserial.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | pollserial.cpp Heavily modified version of: 3 | 4 | HardwareSerial.cpp - Hardware serial library for Wiring 5 | Copyright (c) 2006 Nicholas Zambetti. All right reserved. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | Modified 23 November 2006 by David A. Mellis 22 | 23 | Modified July 2010 by Myles D. Metzler 24 | */ 25 | 26 | #include 27 | #include 28 | #include "pollserial.h" 29 | 30 | #define BUFFER_SIZE 64 31 | 32 | rbuffer rxbuffer = {0,0,0}; 33 | 34 | void USART_recieve() { 35 | #if defined ( UDR0 ) 36 | if( UCSR0A & _BV(RXC0)) { 37 | uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); 38 | if ( i != rxbuffer.tail) { 39 | rxbuffer.buffer[rxbuffer.head] = UDR0; 40 | rxbuffer.head = i; 41 | } 42 | } 43 | #else 44 | if( UCSRA & _BV(RXC)) { 45 | uint8_t i = (rxbuffer.head + 1) & (BUFFER_SIZE - 1); 46 | if ( i != rxbuffer.tail) { 47 | rxbuffer.buffer[rxbuffer.head] = UDR; 48 | rxbuffer.head = i; 49 | } 50 | } 51 | #endif 52 | } 53 | 54 | pt2Funct pollserial::begin(long baud) { 55 | uint16_t baud_setting; 56 | bool use_u2x; 57 | 58 | rxbuffer.buffer = (unsigned char*)malloc(BUFFER_SIZE*sizeof(unsigned char)); 59 | 60 | // U2X mode is needed for baud rates higher than (CPU Hz / 16) 61 | if (baud > F_CPU / 16) { 62 | use_u2x = true; 63 | } 64 | else { 65 | // figure out if U2X mode would allow for a better connection 66 | 67 | // calculate the percent difference between the baud-rate specified and 68 | // the real baud rate for both U2X and non-U2X mode (0-255 error percent) 69 | uint8_t nonu2x_baud_error = abs((int)(255-((F_CPU/(16*(((F_CPU/8/baud-1)/2)+1))*255)/baud))); 70 | uint8_t u2x_baud_error = abs((int)(255-((F_CPU/(8*(((F_CPU/4/baud-1)/2)+1))*255)/baud))); 71 | 72 | // prefer non-U2X mode because it handles clock skew better 73 | use_u2x = (nonu2x_baud_error > u2x_baud_error); 74 | } 75 | if (use_u2x) { 76 | #if defined ( UDR0 ) 77 | UCSR0A = _BV(U2X0); 78 | #else 79 | UCSRA = _BV(U2X); 80 | #endif 81 | baud_setting = (F_CPU / 4 / baud - 1) / 2; 82 | } 83 | else { 84 | #if defined ( UDR0 ) 85 | UCSR0A = 0; 86 | #else 87 | UCSRA = 0; 88 | #endif 89 | baud_setting = (F_CPU / 8 / baud - 1) / 2; 90 | } 91 | 92 | // assign the baud_setting, a.k.a. (USART Baud Rate Register) 93 | #if defined ( UDR0 ) 94 | UBRR0 = baud_setting; 95 | UCSR0B = _BV(RXEN0) | _BV(TXEN0); 96 | #else 97 | UBRR = baud_setting; 98 | UCSRB = _BV(RXEN) | _BV(TXEN); 99 | #endif 100 | 101 | return &USART_recieve; 102 | } 103 | 104 | void pollserial::end() { 105 | UCSR0B &= ~(_BV(RXEN0) | _BV(TXEN0)); 106 | free(rxbuffer.buffer); 107 | } 108 | 109 | uint8_t pollserial::available() { 110 | return (BUFFER_SIZE + rxbuffer.head - rxbuffer.tail) & (BUFFER_SIZE-1); 111 | } 112 | 113 | int pollserial::read() { 114 | if (rxbuffer.head == rxbuffer.tail) 115 | return -1; 116 | else { 117 | uint8_t c = rxbuffer.buffer[rxbuffer.tail]; 118 | //tail = (tail + 1) & 63; 119 | if (rxbuffer.tail == BUFFER_SIZE) 120 | rxbuffer.tail = 0; 121 | else 122 | rxbuffer.tail++; 123 | return c; 124 | } 125 | } 126 | 127 | void pollserial::flush() { 128 | rxbuffer.head = rxbuffer.tail; 129 | } 130 | 131 | void pollserial::write(uint8_t c) { 132 | #if defined ( UDR0 ) 133 | while (!((UCSR0A) & _BV(UDRE0))); 134 | UDR0 = c; 135 | #else 136 | while (!((UCSRA) & _BV(UDRE))); 137 | UDR = c; 138 | #endif 139 | } -------------------------------------------------------------------------------- /examples/NTSCserialTerm/pollserial.h: -------------------------------------------------------------------------------- 1 | /* 2 | pollserial.h Heavily modified version of: 3 | 4 | HardwareSerial.h - Hardware serial library for Wiring 5 | Copyright (c) 2006 Nicholas Zambetti. All right reserved. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | Modified July 2010 by Myles D. Metzler 22 | */ 23 | 24 | #ifndef PSERIAL_H 25 | #define PSERIAL_H 26 | 27 | #include 28 | #include "Print.h" 29 | 30 | typedef struct { 31 | uint8_t head; 32 | uint8_t tail; 33 | unsigned char * buffer; 34 | } rbuffer; 35 | 36 | //define a void function() return type. 37 | typedef void (*pt2Funct)(); 38 | 39 | class pollserial : public Print { 40 | public: 41 | pt2Funct begin(long); 42 | void end(); 43 | uint8_t available(void); 44 | int read(void); 45 | void flush(void); 46 | virtual void write(uint8_t); 47 | using Print::write; // pull in write(str) and write(buf, size) from Print 48 | }; 49 | 50 | void USART_recieve(); 51 | #endif -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | NTSC LITERAL1 2 | PAL LITERAL1 3 | OVERLAY LITERAL1 4 | _NTSC LITERAL1 5 | _PAL LITERAL1 6 | _OVERLAY LITERAL1 7 | WHITE LITERAL1 8 | BLACK LITERAL1 9 | INVERT LITERAL1 10 | UP LITERAL1 11 | DOWN LITERAL1 12 | LEFT LITERAL1 13 | RIGHT LITERAL1 14 | DEC LITERAL1 15 | HEX LITERAL1 16 | BIN LITERAL1 17 | OCT LITERAL1 18 | BYTE LITERAL1 19 | 20 | TVout KEYWORD1 21 | 22 | clear_screen KEYWORD2 23 | invert KEYWORD2 24 | 25 | begin KEYWORD2 26 | hres KEYWORD2 27 | vres KEYWORD2 28 | char_line KEYWORD2 29 | force_vscale KEYWORD2 30 | force_outstart KEYWORD2 31 | force_linestart KEYWORD2 32 | draw_row KEYWORD2 33 | draw_column KEYWORD2 34 | delay KEYWORD2 35 | delay_frame KEYWORD2 36 | millis KEYWORD2 37 | set_pixel KEYWORD2 38 | get_pixel KEYWORD2 39 | fill KEYWORD2 40 | shift KEYWORD2 41 | draw_line KEYWORD2 42 | fill_line KEYWORD2 43 | draw_rect KEYWORD2 44 | draw_circle KEYWORD2 45 | bitmap KEYWORD2 46 | set_vbi_hook KEYWORD2 47 | set_hbi_hook KEYWORD2 48 | tone KEYWORD2 49 | noTone KEYWORD2 50 | print_char KEYWORD2 51 | set_cursor KEYWORD2 52 | select_font KEYWORD2 53 | write KEYWORD2 54 | print KEYWORD2 55 | println KEYWORD2 56 | printPGM KEYWORD2 57 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=TVout 2 | version=1.1.0 3 | author=mdmetzle@gmail.com,pkendall64@gmail.com 4 | maintainer=Avamander , Paul Kendall 5 | sentence=A library for generating PAL or NTSC video output with an AVR. 6 | paragraph=Supports PAL and NTSC with the max resolution of 128 times 96 pixels. 7 | category=Display 8 | url=https://github.com/Avamander/arduino-tvout/ 9 | architectures=avr 10 | includes=TVout.h 11 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter, extra scripting 4 | ; Upload options: custom port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; 7 | ; Please visit documentation for the other options and examples 8 | ; http://docs.platformio.org/en/stable/projectconf.html 9 | 10 | [platformio] 11 | 12 | [env:pro16MHzatmega328] 13 | platform = atmelavr 14 | framework = arduino 15 | board = pro16MHzatmega328 16 | upload_speed = 115200 17 | -------------------------------------------------------------------------------- /src/TVout.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | /* A note about how Color is defined for this version of TVout 27 | * 28 | * Where ever choosing a color is mentioned the following are true: 29 | * BLACK =0 30 | * WHITE =1 31 | * INVERT =2 32 | * All others will be ignored. 33 | */ 34 | 35 | #include "TVout.h" 36 | #include 37 | 38 | // forward declaration 39 | static void inline sp(unsigned char x, unsigned char y, char c); 40 | 41 | 42 | /* Call this to start video output with the default resolution (128x96). 43 | * 44 | * Arguments: 45 | * mode: 46 | * The video standard to follow and whether to use overlay (bitset): 47 | * NTSC =0 =_NTSC 48 | * PAL =1 =_PAL 49 | * OVERLAY =2 =_OVERLAY 50 | * 51 | * Returns: 52 | * 0 if no error. 53 | * 1 if x is not divisable by 8. 54 | * 4 if there is not enough memory. 55 | */ 56 | char TVout::begin(uint8_t mode) { 57 | return begin(mode,128,96); 58 | } // end of begin 59 | 60 | 61 | /* call this to start video output with a specified resolution. 62 | * 63 | * Arguments: 64 | * mode: 65 | * The video standard to follow and whether to use overlay (bitset): 66 | * NTSC =0 =_NTSC 67 | * PAL =1 =_PAL 68 | * OVERLAY =2 =_OVERLAY 69 | * x: 70 | * Horizonal resolution must be divisable by 8. 71 | * y: 72 | * Vertical resolution. 73 | * 74 | * Returns: 75 | * 0 if no error. 76 | * 1 if x is not divisable by 8. 77 | * 4 if there is not enough memory for the frame buffer. 78 | */ 79 | char TVout::begin(uint8_t mode, uint8_t x, uint8_t y) { 80 | // check if x is divisable by 8 81 | if ( !(x & 0xF8)) 82 | return 1; 83 | 84 | uint8_t *framebuffer = (uint8_t *)malloc((x/8) * y * sizeof(uint8_t)); 85 | if (framebuffer == NULL) 86 | return 4; 87 | 88 | return begin(mode, x, y, framebuffer); 89 | } // end of begin 90 | 91 | 92 | /* call this to start video output with a specified resolution. 93 | * 94 | * Arguments: 95 | * mode: 96 | * The video standard to follow and whether to use overlay (bitset): 97 | * NTSC =0 =_NTSC 98 | * PAL =1 =_PAL 99 | * OVERLAY =2 =_OVERLAY 100 | * x: 101 | * Horizonal resolution must be divisable by 8. 102 | * y: 103 | * Vertical resolution. 104 | * framebuffer: 105 | * Pre-allocated buffer of at least (x/8 * y) bytes in size. 106 | * 107 | * Returns: 108 | * 0 if no error. 109 | * 1 if x is not divisable by 8. 110 | */ 111 | char TVout::begin(uint8_t mode, uint8_t x, uint8_t y, uint8_t *framebuffer) { 112 | // check if x is divisable by 8 113 | if ( !(x & 0xF8)) 114 | return 1; 115 | x = x/8; 116 | 117 | screen = framebuffer; 118 | 119 | cursor_x = 0; 120 | cursor_y = 0; 121 | 122 | render_setup(mode,x,y,screen); 123 | clear_screen(); 124 | return 0; 125 | } // end of begin 126 | 127 | 128 | /* Stop video render and free the used memory. 129 | */ 130 | void TVout::end() { 131 | TIMSK1 = 0; 132 | free(screen); 133 | } 134 | 135 | 136 | /* Fill the screen with some color. 137 | * 138 | * Arguments: 139 | * color: 140 | * The color to fill the screen with. 141 | * (see color note at the top of this file) 142 | */ 143 | void TVout::fill(uint8_t color) { 144 | switch(color) { 145 | case BLACK: 146 | cursor_x = 0; 147 | cursor_y = 0; 148 | memset(display.screen, 0, display.size); 149 | break; 150 | case WHITE: 151 | cursor_x = 0; 152 | cursor_y = 0; 153 | memset(display.screen, 0xFF, display.size); 154 | break; 155 | case INVERT: 156 | unsigned char *p = display.screen; 157 | uint16_t i = display.size; 158 | while (i--) { 159 | *p++ ^= 0xFF; 160 | } 161 | break; 162 | } 163 | } // end of fill 164 | 165 | 166 | /* Gets the Horizontal resolution of the screen 167 | * 168 | * Returns: 169 | * The horizonal resolution. 170 | */ 171 | unsigned char TVout::hres() { 172 | return display.hres*8; 173 | } // end of hres 174 | 175 | 176 | /* Gets the Vertical resolution of the screen 177 | * 178 | * Returns: 179 | * The vertical resolution 180 | */ 181 | unsigned char TVout::vres() { 182 | return display.vres; 183 | } // end of vres 184 | 185 | 186 | /* Return the number of characters that will fit on a line 187 | * 188 | * Returns: 189 | * The number of characters that will fit on a text line starting from x=0. 190 | * Will return -1 for dynamic width fonts as this cannot be determined. 191 | */ 192 | char TVout::char_line() { 193 | return ((display.hres*8)/pgm_read_byte(font)); 194 | } // end of char_line 195 | 196 | 197 | /* delay for x ms 198 | * The resolution is 16ms for NTSC and 20ms for PAL 199 | * 200 | * Arguments: 201 | * x: 202 | * The number of ms this function should consume. 203 | */ 204 | void TVout::delay(unsigned int x) { 205 | unsigned long time = millis() + x; 206 | while(millis() < time); 207 | } // end of delay 208 | 209 | 210 | /* Delay for x frames, exits at the end of the last display line. 211 | * delay_frame(1) is useful prior to drawing so there is little/no flicker. 212 | * 213 | * Arguments: 214 | * x: 215 | * The number of frames to delay for. 216 | */ 217 | void TVout::delay_frame(unsigned int x) { 218 | int stop_line = (int)(display.first_frame_start_render_line + (display.vres * (display.vscale_const + 1))) + 1; 219 | while (x) { 220 | while (display.scanLine != stop_line); 221 | while (display.scanLine == stop_line); 222 | x--; 223 | } 224 | } // end of delay_frame 225 | 226 | 227 | /* Get the time in ms since begin was called. 228 | * The resolution is 16ms for NTSC and 20ms for PAL 229 | * 230 | * Returns: 231 | * The time in ms since video generation has started. 232 | */ 233 | unsigned long TVout::millis() { 234 | if (display.lines_frame == _NTSC_LINE_FRAME) { 235 | return display.frames * _NTSC_TIME_SCANLINE * _NTSC_LINE_FRAME / 1000; 236 | } 237 | else { 238 | return display.frames * _PAL_TIME_SCANLINE * _PAL_LINE_FRAME / 1000; 239 | } 240 | } // end of millis 241 | 242 | 243 | /* force the number of times to display each line. 244 | * 245 | * Arguments: 246 | * sfactor: 247 | * The scale number of times to repeate each line. 248 | */ 249 | void TVout::force_vscale(char sfactor) { 250 | delay_frame(1); 251 | display.vscale_const = sfactor - 1; 252 | display.vscale = sfactor - 1; 253 | } 254 | 255 | 256 | /* force the output start time of a scanline in micro seconds. 257 | * 258 | * Arguments: 259 | * time: 260 | * The new output start time in micro seconds. 261 | */ 262 | void TVout::force_outstart(uint8_t time) { 263 | delay_frame(1); 264 | display.output_delay = ((time * _CYCLES_PER_US) - 1); 265 | } 266 | 267 | 268 | /* force the start line for active video 269 | * 270 | * Arguments: 271 | * line: 272 | * The new active video output start line 273 | */ 274 | void TVout::force_linestart(uint8_t line) { 275 | delay_frame(1); 276 | display.first_frame_start_render_line = line; 277 | display.first_frame_end_render_line = display.first_frame_start_render_line + (display.vres * (display.vscale_const + 1)); 278 | display.second_frame_start_render_line = display.lines_frame + display.first_frame_start_render_line; 279 | display.second_frame_end_render_line = display.lines_frame + display.first_frame_end_render_line; 280 | } 281 | 282 | 283 | /* Set the color of a pixel 284 | * 285 | * Arguments: 286 | * x: 287 | * The x coordinate of the pixel. 288 | * y: 289 | * The y coordinate of the pixel. 290 | * c: 291 | * The color of the pixel 292 | * (see color note at the top of this file) 293 | */ 294 | void TVout::set_pixel(uint8_t x, uint8_t y, char c) { 295 | if (x >= display.hres*8 || y >= display.vres) 296 | return; 297 | sp(x,y,c); 298 | } // end of set_pixel 299 | 300 | 301 | /* get the color of the pixel at x,y 302 | * 303 | * Arguments: 304 | * x: 305 | * The x coordinate of the pixel. 306 | * y: 307 | * The y coordinate of the pixel. 308 | * 309 | * Returns: 310 | * The color of the pixel. 311 | * (see color note at the top of this file) 312 | * 313 | * Thank you gijs on the arduino.cc forum for the non obviouse fix. 314 | */ 315 | unsigned char TVout::get_pixel(uint8_t x, uint8_t y) { 316 | if (x >= display.hres*8 || y >= display.vres) 317 | return 0; 318 | if (display.screen[x/8+y*display.hres] & (0x80 >>(x&7))) 319 | return 1; 320 | return 0; 321 | } // end of get_pixel 322 | 323 | 324 | /* Draw a line from one point to another 325 | * 326 | * Arguments: 327 | * x0: 328 | * The x coordinate of point 0. 329 | * y0: 330 | * The y coordinate of point 0. 331 | * x1: 332 | * The x coordinate of point 1. 333 | * y1: 334 | * The y coordinate of point 1. 335 | * c: 336 | * The color of the line. 337 | * (see color note at the top of this file) 338 | */ 339 | /* Patched to allow support for the Arduino Leonardo */ 340 | void TVout::draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c) { 341 | if (x0 > display.hres*8 || y0 > display.vres || x1 > display.hres*8 || y1 > display.vres) 342 | return; 343 | if (x0 == x1) 344 | draw_column(x0,y0,y1,c); 345 | else if (y0 == y1) 346 | draw_row(y0,x0,x1,c); 347 | else { 348 | int e; 349 | signed int dx,dy,j, temp; 350 | signed char s1,s2, xchange; 351 | signed int x,y; 352 | 353 | x = x0; 354 | y = y0; 355 | 356 | //take absolute value 357 | if (x1 < x0) { 358 | dx = x0 - x1; 359 | s1 = -1; 360 | } 361 | else if (x1 == x0) { 362 | dx = 0; 363 | s1 = 0; 364 | } 365 | else { 366 | dx = x1 - x0; 367 | s1 = 1; 368 | } 369 | 370 | if (y1 < y0) { 371 | dy = y0 - y1; 372 | s2 = -1; 373 | } 374 | else if (y1 == y0) { 375 | dy = 0; 376 | s2 = 0; 377 | } 378 | else { 379 | dy = y1 - y0; 380 | s2 = 1; 381 | } 382 | 383 | xchange = 0; 384 | 385 | if (dy>dx) { 386 | temp = dx; 387 | dx = dy; 388 | dy = temp; 389 | xchange = 1; 390 | } 391 | 392 | e = ((int)dy<<1) - dx; 393 | 394 | for (j=0; j<=dx; j++) { 395 | sp(x,y,c); 396 | 397 | if (e>=0) { 398 | if (xchange==1) x = x + s1; 399 | else y = y + s2; 400 | e = e - ((int)dx<<1); 401 | } 402 | if (xchange==1) 403 | y = y + s2; 404 | else 405 | x = x + s1; 406 | e = e + ((int)dy<<1); 407 | } 408 | } 409 | } // end of draw_line 410 | 411 | 412 | /* Fill a row from one point to another 413 | * 414 | * Argument: 415 | * line: 416 | * The row that fill will be performed on. 417 | * x0: 418 | * edge 0 of the fill. 419 | * x1: 420 | * edge 1 of the fill. 421 | * c: 422 | * the color of the fill. 423 | * (see color note at the top of this file) 424 | */ 425 | void TVout::draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c) { 426 | uint8_t lbit, rbit; 427 | 428 | if (x0 == x1) 429 | set_pixel(x0,line,c); 430 | else { 431 | if (x0 > x1) { 432 | lbit = x0; 433 | x0 = x1; 434 | x1 = lbit; 435 | } 436 | lbit = 0xff >> (x0&7); 437 | x0 = x0/8 + display.hres*line; 438 | rbit = 0xff << (7 - (x1&7)); 439 | x1 = x1/8 + display.hres*line; 440 | if (x0 == x1) { 441 | lbit = lbit & rbit; 442 | if (c == WHITE) 443 | screen[x0] |= lbit; 444 | else if (c == BLACK) 445 | screen[x0] &= ~lbit; 446 | else if (c == INVERT) 447 | screen[x0] ^= lbit; 448 | } else { 449 | if (c == WHITE) { 450 | screen[x0++] |= lbit; 451 | while (x0 < x1) 452 | screen[x0++] = 0xff; 453 | screen[x0] |= rbit; 454 | } 455 | else if (c == BLACK) { 456 | screen[x0++] &= ~lbit; 457 | while (x0 < x1) 458 | screen[x0++] = 0; 459 | screen[x0] &= ~rbit; 460 | } 461 | else if (c == INVERT) { 462 | screen[x0++] ^= lbit; 463 | while (x0 < x1) 464 | screen[x0++] ^= 0xff; 465 | screen[x0] ^= rbit; 466 | } 467 | } 468 | } 469 | } // end of draw_row 470 | 471 | 472 | /* Fill a column from one point to another 473 | * 474 | * Argument: 475 | * row: 476 | * The row that fill will be performed on. 477 | * y0: 478 | * edge 0 of the fill. 479 | * y1: 480 | * edge 1 of the fill. 481 | * c: 482 | * the color of the fill. 483 | * (see color note at the top of this file) 484 | */ 485 | void TVout::draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c) { 486 | unsigned char bit; 487 | int byte; 488 | 489 | if (y0 == y1) 490 | set_pixel(row,y0,c); 491 | else { 492 | if (y1 < y0) { 493 | bit = y0; 494 | y0 = y1; 495 | y1 = bit; 496 | } 497 | bit = 0x80 >> (row&7); 498 | byte = row/8 + y0*display.hres; 499 | if (c == WHITE) { 500 | while ( y0 <= y1) { 501 | screen[byte] |= bit; 502 | byte += display.hres; 503 | y0++; 504 | } 505 | } 506 | else if (c == BLACK) { 507 | while ( y0 <= y1) { 508 | screen[byte] &= ~bit; 509 | byte += display.hres; 510 | y0++; 511 | } 512 | } 513 | else if (c == INVERT) { 514 | while ( y0 <= y1) { 515 | screen[byte] ^= bit; 516 | byte += display.hres; 517 | y0++; 518 | } 519 | } 520 | } 521 | } 522 | 523 | 524 | /* draw a rectangle at x,y with a specified width and height 525 | * 526 | * Arguments: 527 | * x0: 528 | * The x coordinate of upper left corner of the rectangle. 529 | * y0: 530 | * The y coordinate of upper left corner of the rectangle. 531 | * w: 532 | * The widht of the rectangle. 533 | * h: 534 | * The height of the rectangle. 535 | * c: 536 | * The color of the rectangle. 537 | * (see color note at the top of this file) 538 | * fc: 539 | * The fill color of the rectangle. 540 | * (see color note at the top of this file) 541 | * default =-1 (no fill) 542 | */ 543 | void TVout::draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc) { 544 | uint8_t x1 = x0+w-1; 545 | uint8_t y1 = y0+h-1; 546 | if (w==0 || h==0) 547 | return; 548 | if (c == fc) { 549 | for (unsigned char i = y0; i <= y1; i++) 550 | draw_row(i,x0,x1,c); 551 | } else { 552 | if (fc != -1 && w>2 && h>2) { 553 | for (unsigned char i = y0+1; i <= y1-1; i++) 554 | draw_row(i,x0+1,x1-1,fc); 555 | } 556 | draw_row(y0,x0,x1,c); 557 | if (h>1) 558 | draw_row(y1,x0,x1,c); 559 | if (h>2) { 560 | draw_column(x0,y0+1,y1-1,c); 561 | if (w>1) 562 | draw_column(x1,y0+1,y1-1,c); 563 | } 564 | } 565 | } // end of draw_rect 566 | 567 | 568 | /* draw a circle given a coordinate x,y and radius both filled and non filled. 569 | * 570 | * Arguments: 571 | * x0: 572 | * The x coordinate of the center of the circle. 573 | * y0: 574 | * The y coordinate of the center of the circle. 575 | * radius: 576 | * The radius of the circle. 577 | * c: 578 | * The color of the circle. 579 | * (see color note at the top of this file) 580 | * fc: 581 | * The color to fill the circle. 582 | * (see color note at the top of this file) 583 | * defualt =-1 (do not fill) 584 | */ 585 | void TVout::draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc) { 586 | 587 | int f = 1 - radius; 588 | int ddF_x = 1; 589 | int ddF_y = -2 * radius; 590 | int x = 0; 591 | int y = radius; 592 | uint8_t pyy = y,pyx = x; 593 | 594 | 595 | //there is a fill color 596 | if (fc != -1) 597 | draw_row(y0,x0-radius,x0+radius,fc); 598 | 599 | sp(x0, y0 + radius,c); 600 | sp(x0, y0 - radius,c); 601 | sp(x0 + radius, y0,c); 602 | sp(x0 - radius, y0,c); 603 | 604 | while(x < y) { 605 | if(f >= 0) { 606 | y--; 607 | ddF_y += 2; 608 | f += ddF_y; 609 | } 610 | x++; 611 | ddF_x += 2; 612 | f += ddF_x; 613 | 614 | //there is a fill color 615 | if (fc != -1) { 616 | //prevent double draws on the same rows 617 | if (pyy != y) { 618 | draw_row(y0+y,x0-x,x0+x,fc); 619 | draw_row(y0-y,x0-x,x0+x,fc); 620 | } 621 | if (pyx != x && x != y) { 622 | draw_row(y0+x,x0-y,x0+y,fc); 623 | draw_row(y0-x,x0-y,x0+y,fc); 624 | } 625 | pyy = y; 626 | pyx = x; 627 | } 628 | sp(x0 + x, y0 + y,c); 629 | sp(x0 - x, y0 + y,c); 630 | sp(x0 + x, y0 - y,c); 631 | sp(x0 - x, y0 - y,c); 632 | sp(x0 + y, y0 + x,c); 633 | sp(x0 - y, y0 + x,c); 634 | sp(x0 + y, y0 - x,c); 635 | sp(x0 - y, y0 - x,c); 636 | } 637 | } // end of draw_circle 638 | 639 | 640 | /* place a bitmap at x,y where the bitmap is defined as {width,height,imagedata....} 641 | * 642 | * Arguments: 643 | * x: 644 | * The x coordinate of the upper left corner. 645 | * y: 646 | * The y coordinate of the upper left corner. 647 | * bmp: 648 | * The bitmap data to print. 649 | * i: 650 | * The offset into the image data to start at. This is mainly used for fonts. 651 | * default =0 652 | * width: 653 | * Override the bitmap width. This is mainly used for fonts. 654 | * default =0 (do not override) 655 | * height: 656 | * Override the bitmap height. This is mainly used for fonts. 657 | * default =0 (do not override) 658 | */ 659 | void TVout::bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, 660 | uint16_t i, uint8_t width, uint8_t lines) { 661 | 662 | uint8_t temp, lshift, rshift, save, xtra; 663 | uint16_t si = 0; 664 | 665 | rshift = x&7; 666 | lshift = 8-rshift; 667 | if (width == 0) { 668 | width = pgm_read_byte((uint32_t)(bmp) + i); 669 | i++; 670 | } 671 | if (lines == 0) { 672 | lines = pgm_read_byte((uint32_t)(bmp) + i); 673 | i++; 674 | } 675 | 676 | if (width&7) { 677 | xtra = width&7; 678 | width = width/8; 679 | width++; 680 | } 681 | else { 682 | xtra = 8; 683 | width = width/8; 684 | } 685 | 686 | for (uint8_t l = 0; l < lines; l++) { 687 | si = (y + l)*display.hres + x/8; 688 | if (width == 1) 689 | temp = (0xff >> rshift) + xtra; 690 | else 691 | temp = 0; 692 | save = screen[si]; 693 | screen[si] &= ((0xff << lshift) | temp); 694 | temp = pgm_read_byte((uint32_t)(bmp) + i++); 695 | screen[si++] |= temp >> rshift; 696 | for ( uint16_t b = i + width-1; i < b; i++) { 697 | save = screen[si]; 698 | screen[si] = temp << lshift; 699 | temp = pgm_read_byte((uint32_t)(bmp) + i); 700 | screen[si++] |= temp >> rshift; 701 | } 702 | if (rshift + xtra < 8) 703 | screen[si-1] |= (save & ((0xff >> rshift) + xtra)); //test me!!! 704 | if (rshift + xtra - 8 > 0) 705 | screen[si] &= ((0xff >> rshift) + xtra - 8); 706 | screen[si] |= temp << lshift; 707 | } 708 | } // end of bitmap 709 | 710 | 711 | /* shift the pixel buffer in any direction 712 | * This function will shift the screen in a direction by any distance. 713 | * 714 | * Arguments: 715 | * distance: 716 | * The distance to shift the screen 717 | * direction: 718 | * The direction to shift the screen the direction and the integer values: 719 | * UP =0 720 | * DOWN =1 721 | * LEFT =2 722 | * RIGHT =3 723 | */ 724 | void TVout::shift(uint8_t distance, uint8_t direction) { 725 | uint8_t * src; 726 | uint8_t * dst; 727 | uint8_t * end; 728 | uint8_t shift; 729 | uint8_t tmp; 730 | switch(direction) { 731 | case UP: 732 | dst = display.screen; 733 | src = display.screen + distance*display.hres; 734 | end = display.screen + display.vres*display.hres; 735 | 736 | while (src <= end) { 737 | *dst = *src; 738 | *src = 0; 739 | dst++; 740 | src++; 741 | } 742 | break; 743 | case DOWN: 744 | dst = display.screen + display.vres*display.hres; 745 | src = dst - distance*display.hres; 746 | end = display.screen; 747 | 748 | while (src >= end) { 749 | *dst = *src; 750 | *src = 0; 751 | dst--; 752 | src--; 753 | } 754 | break; 755 | case LEFT: 756 | shift = distance & 7; 757 | 758 | for (uint8_t line = 0; line < display.vres; line++) { 759 | dst = display.screen + display.hres*line; 760 | src = dst + distance/8; 761 | end = dst + display.hres-2; 762 | while (src <= end) { 763 | tmp = 0; 764 | tmp = *src << shift; 765 | *src = 0; 766 | src++; 767 | tmp |= *src >> (8 - shift); 768 | *dst = tmp; 769 | dst++; 770 | } 771 | tmp = 0; 772 | tmp = *src << shift; 773 | *src = 0; 774 | *dst = tmp; 775 | } 776 | break; 777 | case RIGHT: 778 | shift = distance & 7; 779 | 780 | for (uint8_t line = 0; line < display.vres; line++) { 781 | dst = display.screen + display.hres-1 + display.hres*line; 782 | src = dst - distance/8; 783 | end = dst - display.hres+2; 784 | while (src >= end) { 785 | tmp = 0; 786 | tmp = *src >> shift; 787 | *src = 0; 788 | src--; 789 | tmp |= *src << (8 - shift); 790 | *dst = tmp; 791 | dst--; 792 | } 793 | tmp = 0; 794 | tmp = *src >> shift; 795 | *src = 0; 796 | *dst = tmp; 797 | } 798 | break; 799 | } 800 | } // end of shift 801 | 802 | 803 | /* Inline version of set_pixel that does not perform a bounds check 804 | * This function will be replaced by a macro. 805 | */ 806 | static void inline sp(uint8_t x, uint8_t y, char c) { 807 | if (c==1) 808 | display.screen[(x/8) + (y*display.hres)] |= 0x80 >> (x&7); 809 | else if (c==0) 810 | display.screen[(x/8) + (y*display.hres)] &= ~0x80 >> (x&7); 811 | else 812 | display.screen[(x/8) + (y*display.hres)] ^= 0x80 >> (x&7); 813 | } // end of sp 814 | 815 | 816 | /* set the vertical blank function call 817 | * The function passed to this function will be called one per frame. The function should be quickish. 818 | * 819 | * Arguments: 820 | * func: 821 | * The function to call. 822 | */ 823 | void TVout::set_vbi_hook(void (*func)()) { 824 | vbi_hook = func; 825 | } // end of set_vbi_hook 826 | 827 | 828 | /* set the horizonal blank function call 829 | * This function passed to this function will be called one per scan line. 830 | * The function MUST be VERY FAST(~2us max). 831 | * 832 | * Arguments: 833 | * funct: 834 | * The function to call. 835 | */ 836 | void TVout::set_hbi_hook(void (*func)()) { 837 | hbi_hook = func; 838 | } // end of set_bhi_hook 839 | 840 | 841 | /* Simple tone generation 842 | * 843 | * Arguments: 844 | * frequency: 845 | * the frequency of the tone 846 | * courtesy of adamwwolf 847 | */ 848 | void TVout::tone(unsigned int frequency) { 849 | tone(frequency, 0); 850 | } // end of tone 851 | 852 | 853 | /* Simple tone generation 854 | * 855 | * Arguments: 856 | * frequency: 857 | * the frequency of the tone 858 | * duration_ms: 859 | * The duration to play the tone in ms 860 | * courtesy of adamwwolf 861 | */ 862 | void TVout::tone(unsigned int frequency, unsigned long duration_ms) { 863 | 864 | if (frequency == 0) 865 | return; 866 | 867 | #if defined(__AVR_ATmega32U4__) 868 | #define TIMER 0 869 | #else 870 | #define TIMER 2 871 | #endif 872 | //this is init code 873 | TCCR2A = 0; 874 | TCCR2B = 0; 875 | TCCR2A |= _BV(WGM21); 876 | TCCR2B |= _BV(CS20); 877 | //end init code 878 | 879 | //most of this is taken from Tone.cpp from Arduino 880 | uint8_t prescalarbits = 0b001; 881 | uint32_t ocr = 0; 882 | 883 | 884 | DDR_SND |= _BV(SND_PIN); //set pb3 (digital pin 11) to output 885 | 886 | //we are using an 8 bit timer, scan through prescalars to find the best fit 887 | ocr = F_CPU / frequency / 2 - 1; 888 | prescalarbits = 0b001; // ck/1: same for both timers 889 | if (ocr > 255) { 890 | ocr = F_CPU / frequency / 2 / 8 - 1; 891 | prescalarbits = 0b010; // ck/8: same for both timers 892 | 893 | if (ocr > 255) { 894 | ocr = F_CPU / frequency / 2 / 32 - 1; 895 | prescalarbits = 0b011; 896 | } 897 | 898 | if (ocr > 255) { 899 | ocr = F_CPU / frequency / 2 / 64 - 1; 900 | prescalarbits = TIMER == 0 ? 0b011 : 0b100; 901 | if (ocr > 255) { 902 | ocr = F_CPU / frequency / 2 / 128 - 1; 903 | prescalarbits = 0b101; 904 | } 905 | 906 | if (ocr > 255) { 907 | ocr = F_CPU / frequency / 2 / 256 - 1; 908 | prescalarbits = TIMER == 0 ? 0b100 : 0b110; 909 | if (ocr > 255) { 910 | // can't do any better than /1024 911 | ocr = F_CPU / frequency / 2 / 1024 - 1; 912 | prescalarbits = TIMER == 0 ? 0b101 : 0b111; 913 | } 914 | } 915 | } 916 | } 917 | TCCR2B = prescalarbits; 918 | 919 | if (duration_ms > 0) 920 | remainingToneVsyncs = duration_ms*60/1000; //60 here represents the framerate 921 | else 922 | remainingToneVsyncs = -1; 923 | 924 | // Set the OCR for the given timer, 925 | OCR2A = ocr; 926 | //set it to toggle the pin by itself 927 | TCCR2A &= ~(_BV(COM2A1)); //set COM2A1 to 0 928 | TCCR2A |= _BV(COM2A0); 929 | } // end of tone 930 | 931 | /* Stops tone generation 932 | */ 933 | void TVout::noTone() { 934 | TCCR2B = 0; 935 | PORT_SND &= ~(_BV(SND_PIN)); //set pin 11 to 0 936 | } // end of noTone 937 | -------------------------------------------------------------------------------- /src/TVout.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | /* 26 | This library provides a simple method for outputting data to a tv 27 | from a frame buffer stored in sram. This implementation is done 28 | completly by interupt and will return give as much cpu time to the 29 | application as possible. 30 | */ 31 | #ifndef TVOUT_H 32 | #define TVOUT_H 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "video_gen.h" 41 | #include "spec/hardware_setup.h" 42 | #include "spec/video_properties.h" 43 | 44 | // macros for readability when selecting mode. 45 | #define WHITE 1 46 | #define BLACK 0 47 | #define INVERT 2 48 | 49 | #define UP 0 50 | #define DOWN 1 51 | #define LEFT 2 52 | #define RIGHT 3 53 | 54 | #define DEC 10 55 | #define HEX 16 56 | #define OCT 8 57 | #define BIN 2 58 | #define BYTE 0 59 | 60 | // Macros for clearer usage 61 | #define clear_screen() fill(0) 62 | #define invert(color) fill(2) 63 | 64 | /* 65 | TVout.cpp contains a brief expenation of each function. 66 | */ 67 | class TVout { 68 | public: 69 | uint8_t * screen; 70 | 71 | char begin(uint8_t mode); 72 | char begin(uint8_t mode, uint8_t x, uint8_t y); 73 | char begin(uint8_t mode, uint8_t x, uint8_t y, uint8_t *framebuffer); 74 | void end(); 75 | 76 | //accessor functions 77 | unsigned char hres(); 78 | unsigned char vres(); 79 | char char_line(); 80 | 81 | //flow control functions 82 | void delay(unsigned int x); 83 | void delay_frame(unsigned int x); 84 | unsigned long millis(); 85 | 86 | //override setup functions 87 | void force_vscale(char sfactor); 88 | void force_outstart(uint8_t time); 89 | void force_linestart(uint8_t line); 90 | 91 | //basic rendering functions 92 | void set_pixel(uint8_t x, uint8_t y, char c); 93 | unsigned char get_pixel(uint8_t x, uint8_t y); 94 | void fill(uint8_t color); 95 | void shift(uint8_t distance, uint8_t direction); 96 | void draw_line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, char c); 97 | void draw_row(uint8_t line, uint16_t x0, uint16_t x1, uint8_t c); 98 | void draw_column(uint8_t row, uint16_t y0, uint16_t y1, uint8_t c); 99 | void draw_rect(uint8_t x0, uint8_t y0, uint8_t w, uint8_t h, char c, char fc = -1); 100 | void draw_circle(uint8_t x0, uint8_t y0, uint8_t radius, char c, char fc = -1); 101 | void bitmap(uint8_t x, uint8_t y, const unsigned char * bmp, uint16_t i = 0, uint8_t width = 0, uint8_t lines = 0); 102 | 103 | //hook setup functions 104 | void set_vbi_hook(void (*func)()); 105 | void set_hbi_hook(void (*func)()); 106 | 107 | //tone functions 108 | void tone(unsigned int frequency, unsigned long duration_ms); 109 | void tone(unsigned int frequency); 110 | void noTone(); 111 | 112 | //The following function definitions can be found in TVoutPrint.cpp 113 | //printing functions 114 | void print_char(uint8_t x, uint8_t y, unsigned char c); 115 | void set_cursor(uint8_t, uint8_t); 116 | void select_font(const unsigned char * f); 117 | 118 | void write(uint8_t); 119 | void write(const char *str); 120 | void write(const class __FlashStringHelper *); 121 | void write(const uint8_t *buffer, uint8_t size); 122 | 123 | void print(const char[]); 124 | void print(const class __FlashStringHelper *); 125 | void print(char, int = BYTE); 126 | void print(unsigned char, int = BYTE); 127 | void print(int, int = DEC); 128 | void print(unsigned int, int = DEC); 129 | void print(long, int = DEC); 130 | void print(unsigned long, int = DEC); 131 | void print(double, int = 2); 132 | 133 | void print(uint8_t, uint8_t, const char[]); 134 | void print(uint8_t, uint8_t, const class __FlashStringHelper *); 135 | void print(uint8_t, uint8_t, char, int = BYTE); 136 | void print(uint8_t, uint8_t, unsigned char, int = BYTE); 137 | void print(uint8_t, uint8_t, int, int = DEC); 138 | void print(uint8_t, uint8_t, unsigned int, int = DEC); 139 | void print(uint8_t, uint8_t, long, int = DEC); 140 | void print(uint8_t, uint8_t, unsigned long, int = DEC); 141 | void print(uint8_t, uint8_t, double, int = 2); 142 | 143 | void println(uint8_t, uint8_t, const char[]); 144 | void println(uint8_t, uint8_t, const class __FlashStringHelper *); 145 | void println(uint8_t, uint8_t, char, int = BYTE); 146 | void println(uint8_t, uint8_t, unsigned char, int = BYTE); 147 | void println(uint8_t, uint8_t, int, int = DEC); 148 | void println(uint8_t, uint8_t, unsigned int, int = DEC); 149 | void println(uint8_t, uint8_t, long, int = DEC); 150 | void println(uint8_t, uint8_t, unsigned long, int = DEC); 151 | void println(uint8_t, uint8_t, double, int = 2); 152 | void println(uint8_t, uint8_t); 153 | 154 | void println(const char[]); 155 | void println(const class __FlashStringHelper *); 156 | void println(char, int = BYTE); 157 | void println(unsigned char, int = BYTE); 158 | void println(int, int = DEC); 159 | void println(unsigned int, int = DEC); 160 | void println(long, int = DEC); 161 | void println(unsigned long, int = DEC); 162 | void println(double, int = 2); 163 | void println(void); 164 | 165 | void printPGM(const char[]); 166 | void printPGM(uint8_t, uint8_t, const char[]); 167 | 168 | private: 169 | uint8_t cursor_x,cursor_y; 170 | const unsigned char * font; 171 | 172 | void inc_txtline(); 173 | void printNumber(unsigned long, uint8_t); 174 | void printFloat(double, uint8_t); 175 | }; 176 | 177 | #endif 178 | -------------------------------------------------------------------------------- /src/TVoutPrint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | TVPrint.cpp - Base class that provides print() and println() 3 | Copyright (c) 2008 David A. Mellis. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | 19 | Modified 23 November 2006 by David A. Mellis 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "TVout.h" 26 | 27 | void TVout::select_font(const unsigned char * f) { 28 | font = f; 29 | } 30 | 31 | /* 32 | * print an 8x8 char c at x,y 33 | * x must be a multiple of 8 34 | */ 35 | void TVout::print_char(uint8_t x, uint8_t y, unsigned char c) { 36 | 37 | c -= pgm_read_byte(font+2); 38 | bitmap(x,y,font,(c*pgm_read_byte(font+1))+3,pgm_read_byte(font),pgm_read_byte(font+1)); 39 | } 40 | 41 | void TVout::inc_txtline() { 42 | if (cursor_y >= (display.vres - pgm_read_byte(font+1))) 43 | shift(pgm_read_byte(font+1),UP); 44 | else 45 | cursor_y += pgm_read_byte(font+1); 46 | } 47 | 48 | /* default implementation: may be overridden */ 49 | void TVout::write(const char *str) 50 | { 51 | while (*str) 52 | write(*str++); 53 | } 54 | 55 | /* default implementation: may be overridden */ 56 | void TVout::write(const __FlashStringHelper *str) 57 | { 58 | const char *p = (const char *)str; 59 | char c; 60 | while ((c = pgm_read_byte(p))) { 61 | p++; 62 | write(c); 63 | } 64 | } 65 | 66 | /* default implementation: may be overridden */ 67 | void TVout::write(const uint8_t *buffer, uint8_t size) 68 | { 69 | while (size--) 70 | write(*buffer++); 71 | } 72 | 73 | void TVout::write(uint8_t c) { 74 | switch(c) { 75 | case '\0': //null 76 | break; 77 | case '\n': //line feed 78 | cursor_x = 0; 79 | inc_txtline(); 80 | break; 81 | case 8: //backspace 82 | cursor_x -= pgm_read_byte(font); 83 | print_char(cursor_x,cursor_y,' '); 84 | break; 85 | case 13: //carriage return !?!?!?!VT!?!??!?! 86 | cursor_x = 0; 87 | break; 88 | case 14: //form feed new page(clear screen) 89 | //clear_screen(); 90 | break; 91 | default: 92 | if (cursor_x >= (display.hres*8 - pgm_read_byte(font))) { 93 | cursor_x = 0; 94 | inc_txtline(); 95 | print_char(cursor_x,cursor_y,c); 96 | } 97 | else 98 | print_char(cursor_x,cursor_y,c); 99 | cursor_x += pgm_read_byte(font); 100 | } 101 | } 102 | 103 | void TVout::print(const char str[]) 104 | { 105 | write(str); 106 | } 107 | 108 | void TVout::print(const __FlashStringHelper *str) 109 | { 110 | write(str); 111 | } 112 | 113 | void TVout::print(char c, int base) 114 | { 115 | print((long) c, base); 116 | } 117 | 118 | void TVout::print(unsigned char b, int base) 119 | { 120 | print((unsigned long) b, base); 121 | } 122 | 123 | void TVout::print(int n, int base) 124 | { 125 | print((long) n, base); 126 | } 127 | 128 | void TVout::print(unsigned int n, int base) 129 | { 130 | print((unsigned long) n, base); 131 | } 132 | 133 | void TVout::print(long n, int base) 134 | { 135 | if (base == 0) { 136 | write(n); 137 | } else if (base == 10) { 138 | if (n < 0) { 139 | print('-'); 140 | n = -n; 141 | } 142 | printNumber(n, 10); 143 | } else { 144 | printNumber(n, base); 145 | } 146 | } 147 | 148 | void TVout::print(unsigned long n, int base) 149 | { 150 | if (base == 0) write(n); 151 | else printNumber(n, base); 152 | } 153 | 154 | void TVout::print(double n, int digits) 155 | { 156 | printFloat(n, digits); 157 | } 158 | 159 | void TVout::println(void) 160 | { 161 | print('\r'); 162 | print('\n'); 163 | } 164 | 165 | void TVout::println(const char c[]) 166 | { 167 | print(c); 168 | println(); 169 | } 170 | 171 | void TVout::println(const __FlashStringHelper *str) 172 | { 173 | print(str); 174 | println(); 175 | } 176 | 177 | void TVout::println(char c, int base) 178 | { 179 | print(c, base); 180 | println(); 181 | } 182 | 183 | void TVout::println(unsigned char b, int base) 184 | { 185 | print(b, base); 186 | println(); 187 | } 188 | 189 | void TVout::println(int n, int base) 190 | { 191 | print(n, base); 192 | println(); 193 | } 194 | 195 | void TVout::println(unsigned int n, int base) 196 | { 197 | print(n, base); 198 | println(); 199 | } 200 | 201 | void TVout::println(long n, int base) 202 | { 203 | print(n, base); 204 | println(); 205 | } 206 | 207 | void TVout::println(unsigned long n, int base) 208 | { 209 | print(n, base); 210 | println(); 211 | } 212 | 213 | void TVout::println(double n, int digits) 214 | { 215 | print(n, digits); 216 | println(); 217 | } 218 | 219 | void TVout::printPGM(const char str[]) { 220 | char c; 221 | while ((c = pgm_read_byte(str))) { 222 | str++; 223 | write(c); 224 | } 225 | } 226 | 227 | void TVout::printPGM(uint8_t x, uint8_t y, const char str[]) { 228 | char c; 229 | cursor_x = x; 230 | cursor_y = y; 231 | while ((c = pgm_read_byte(str))) { 232 | str++; 233 | write(c); 234 | } 235 | } 236 | 237 | void TVout::set_cursor(uint8_t x, uint8_t y) { 238 | cursor_x = x; 239 | cursor_y = y; 240 | } 241 | 242 | void TVout::print(uint8_t x, uint8_t y, const char str[]) { 243 | cursor_x = x; 244 | cursor_y = y; 245 | write(str); 246 | } 247 | void TVout::print(uint8_t x, uint8_t y, const __FlashStringHelper *str) { 248 | cursor_x = x; 249 | cursor_y = y; 250 | print(str); 251 | } 252 | void TVout::print(uint8_t x, uint8_t y, char c, int base) { 253 | cursor_x = x; 254 | cursor_y = y; 255 | print((long) c, base); 256 | } 257 | void TVout::print(uint8_t x, uint8_t y, unsigned char b, int base) { 258 | cursor_x = x; 259 | cursor_y = y; 260 | print((unsigned long) b, base); 261 | } 262 | void TVout::print(uint8_t x, uint8_t y, int n, int base) { 263 | cursor_x = x; 264 | cursor_y = y; 265 | print((long) n, base); 266 | } 267 | void TVout::print(uint8_t x, uint8_t y, unsigned int n, int base) { 268 | cursor_x = x; 269 | cursor_y = y; 270 | print((unsigned long) n, base); 271 | } 272 | void TVout::print(uint8_t x, uint8_t y, long n, int base) { 273 | cursor_x = x; 274 | cursor_y = y; 275 | print(n,base); 276 | } 277 | void TVout::print(uint8_t x, uint8_t y, unsigned long n, int base) { 278 | cursor_x = x; 279 | cursor_y = y; 280 | print(n,base); 281 | } 282 | void TVout::print(uint8_t x, uint8_t y, double n, int digits) { 283 | cursor_x = x; 284 | cursor_y = y; 285 | print(n,digits); 286 | } 287 | 288 | void TVout::println(uint8_t x, uint8_t y, const char c[]) 289 | { 290 | cursor_x = x; 291 | cursor_y = y; 292 | print(c); 293 | println(); 294 | } 295 | 296 | void TVout::println(uint8_t x, uint8_t y, const __FlashStringHelper *str) 297 | { 298 | cursor_x = x; 299 | cursor_y = y; 300 | print(str); 301 | println(); 302 | } 303 | 304 | void TVout::println(uint8_t x, uint8_t y, char c, int base) 305 | { 306 | cursor_x = x; 307 | cursor_y = y; 308 | print(c, base); 309 | println(); 310 | } 311 | 312 | void TVout::println(uint8_t x, uint8_t y, unsigned char b, int base) 313 | { 314 | cursor_x = x; 315 | cursor_y = y; 316 | print(b, base); 317 | println(); 318 | } 319 | 320 | void TVout::println(uint8_t x, uint8_t y, int n, int base) 321 | { 322 | cursor_x = x; 323 | cursor_y = y; 324 | print(n, base); 325 | println(); 326 | } 327 | 328 | void TVout::println(uint8_t x, uint8_t y, unsigned int n, int base) 329 | { 330 | cursor_x = x; 331 | cursor_y = y; 332 | print(n, base); 333 | println(); 334 | } 335 | 336 | void TVout::println(uint8_t x, uint8_t y, long n, int base) 337 | { 338 | cursor_x = x; 339 | cursor_y = y; 340 | print(n, base); 341 | println(); 342 | } 343 | 344 | void TVout::println(uint8_t x, uint8_t y, unsigned long n, int base) 345 | { 346 | cursor_x = x; 347 | cursor_y = y; 348 | print(n, base); 349 | println(); 350 | } 351 | 352 | void TVout::println(uint8_t x, uint8_t y, double n, int digits) 353 | { 354 | cursor_x = x; 355 | cursor_y = y; 356 | print(n, digits); 357 | println(); 358 | } 359 | 360 | void TVout::printNumber(unsigned long n, uint8_t base) 361 | { 362 | unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. 363 | unsigned long i = 0; 364 | 365 | if (n == 0) { 366 | print('0'); 367 | return; 368 | } 369 | 370 | while (n > 0) { 371 | buf[i++] = n % base; 372 | n /= base; 373 | } 374 | 375 | for (; i > 0; i--) 376 | print((char) (buf[i - 1] < 10 ? 377 | '0' + buf[i - 1] : 378 | 'A' + buf[i - 1] - 10)); 379 | } 380 | 381 | void TVout::printFloat(double number, uint8_t digits) 382 | { 383 | // Handle negative numbers 384 | if (number < 0.0) 385 | { 386 | print('-'); 387 | number = -number; 388 | } 389 | 390 | // Round correctly so that print(1.999, 2) prints as "2.00" 391 | double rounding = 0.5; 392 | for (uint8_t i=0; i 0) 404 | print("."); 405 | 406 | // Extract digits from the remainder one at a time 407 | while (digits-- > 0) 408 | { 409 | remainder *= 10.0; 410 | int toPrint = int(remainder); 411 | print(toPrint); 412 | remainder -= toPrint; 413 | } 414 | } 415 | -------------------------------------------------------------------------------- /src/TVoutfonts/README.md: -------------------------------------------------------------------------------- 1 | Copy this folder to your Arduino libraries folder 2 | -------------------------------------------------------------------------------- /src/TVoutfonts/font4x6.cpp: -------------------------------------------------------------------------------- 1 | #include "font4x6.h" 2 | 3 | PROGMEM const unsigned char font4x6[] = { 4 | 4,6,32, 5 | //space 6 | 0b00000000, 7 | 0b00000000, 8 | 0b00000000, 9 | 0b00000000, 10 | 0b00000000, 11 | 0b00000000, 12 | //! 13 | 0b01000000, 14 | 0b01000000, 15 | 0b01000000, 16 | 0b00000000, 17 | 0b01000000, 18 | 0b00000000, 19 | //" 20 | 0b10100000, 21 | 0b10100000, 22 | 0b00000000, 23 | 0b00000000, 24 | 0b00000000, 25 | 0b00000000, 26 | //# 27 | 0b10100000, 28 | 0b11100000, 29 | 0b10100000, 30 | 0b11100000, 31 | 0b10100000, 32 | 0b00000000, 33 | //$ 34 | 0b01000000, 35 | 0b01100000, 36 | 0b11000000, 37 | 0b01100000, 38 | 0b11000000, 39 | 0b00000000, 40 | //% 41 | 0b10100000, 42 | 0b00100000, 43 | 0b01000000, 44 | 0b10000000, 45 | 0b10100000, 46 | 0b00000000, 47 | //& 48 | 0b00100000, 49 | 0b01000000, 50 | 0b11000000, 51 | 0b10100000, 52 | 0b11100000, 53 | 0b00000000, 54 | //' 55 | 0b10000000, 56 | 0b10000000, 57 | 0b00000000, 58 | 0b00000000, 59 | 0b00000000, 60 | 0b00000000, 61 | //( 62 | 0b01000000, 63 | 0b10000000, 64 | 0b10000000, 65 | 0b10000000, 66 | 0b01000000, 67 | 0b00000000, 68 | //) 69 | 0b10000000, 70 | 0b01000000, 71 | 0b01000000, 72 | 0b01000000, 73 | 0b10000000, 74 | 0b00000000, 75 | //* 76 | 0b01000000, 77 | 0b10100000, 78 | 0b01000000, 79 | 0b00000000, 80 | 0b00000000, 81 | 0b00000000, 82 | //+ 83 | 0b00000000, 84 | 0b01000000, 85 | 0b11100000, 86 | 0b01000000, 87 | 0b00000000, 88 | 0b00000000, 89 | //, 90 | 0b00000000, 91 | 0b00000000, 92 | 0b00000000, 93 | 0b10000000, 94 | 0b10000000, 95 | 0b00000000, 96 | //- 97 | 0b00000000, 98 | 0b00000000, 99 | 0b11100000, 100 | 0b00000000, 101 | 0b00000000, 102 | 0b00000000, 103 | //. 104 | 0b00000000, 105 | 0b00000000, 106 | 0b00000000, 107 | 0b00000000, 108 | 0b10000000, 109 | 0b00000000, 110 | // / 111 | 0b00100000, 112 | 0b00100000, 113 | 0b01000000, 114 | 0b10000000, 115 | 0b10000000, 116 | 0b00000000, 117 | //0 118 | 0b11100000, 119 | 0b10100000, 120 | 0b10100000, 121 | 0b10100000, 122 | 0b11100000, 123 | 0b00000000, 124 | //1 125 | 0b01000000, 126 | 0b11000000, 127 | 0b01000000, 128 | 0b01000000, 129 | 0b11100000, 130 | 0b00000000, 131 | //2 132 | 0b11100000, 133 | 0b00100000, 134 | 0b11100000, 135 | 0b10000000, 136 | 0b11100000, 137 | 0b00000000, 138 | //3 139 | 0b11100000, 140 | 0b00100000, 141 | 0b11100000, 142 | 0b00100000, 143 | 0b11100000, 144 | 0b00000000, 145 | //4 146 | 0b10100000, 147 | 0b10100000, 148 | 0b11100000, 149 | 0b00100000, 150 | 0b00100000, 151 | 0b00000000, 152 | //5 153 | 0b11100000, 154 | 0b10000000, 155 | 0b11100000, 156 | 0b00100000, 157 | 0b11000000, 158 | 0b00000000, 159 | //6 160 | 0b11000000, 161 | 0b10000000, 162 | 0b11100000, 163 | 0b10100000, 164 | 0b11100000, 165 | 0b00000000, 166 | //7 167 | 0b11100000, 168 | 0b00100000, 169 | 0b01000000, 170 | 0b10000000, 171 | 0b10000000, 172 | 0b00000000, 173 | //8 174 | 0b11100000, 175 | 0b10100000, 176 | 0b11100000, 177 | 0b10100000, 178 | 0b11100000, 179 | 0b00000000, 180 | //9 181 | 0b11100000, 182 | 0b10100000, 183 | 0b11100000, 184 | 0b00100000, 185 | 0b01100000, 186 | 0b00000000, 187 | //: 188 | 0b00000000, 189 | 0b01000000, 190 | 0b00000000, 191 | 0b01000000, 192 | 0b00000000, 193 | 0b00000000, 194 | //; 195 | 0b00000000, 196 | 0b01000000, 197 | 0b00000000, 198 | 0b01000000, 199 | 0b10000000, 200 | 0b00000000, 201 | //< 202 | 0b00100000, 203 | 0b01000000, 204 | 0b10000000, 205 | 0b01000000, 206 | 0b00100000, 207 | 0b00000000, 208 | //= 209 | 0b00000000, 210 | 0b11100000, 211 | 0b00000000, 212 | 0b11100000, 213 | 0b00000000, 214 | 0b00000000, 215 | //> 216 | 0b10000000, 217 | 0b01000000, 218 | 0b00100000, 219 | 0b01000000, 220 | 0b10000000, 221 | 0b00000000, 222 | //? 223 | 0b11000000, 224 | 0b00100000, 225 | 0b01000000, 226 | 0b00000000, 227 | 0b01000000, 228 | 0b00000000, 229 | //@ 230 | 0b11100000, 231 | 0b10100000, 232 | 0b10100000, 233 | 0b11100000, 234 | 0b11100000, 235 | 0b00000000, 236 | //A 237 | 0b11100000, 238 | 0b10100000, 239 | 0b11100000, 240 | 0b10100000, 241 | 0b10100000, 242 | 0b00000000, 243 | //B 244 | 0b11000000, 245 | 0b10100000, 246 | 0b11100000, 247 | 0b10100000, 248 | 0b11000000, 249 | 0b00000000, 250 | //C 251 | 0b11100000, 252 | 0b10000000, 253 | 0b10000000, 254 | 0b10000000, 255 | 0b11100000, 256 | 0b00000000, 257 | //D 258 | 0b11000000, 259 | 0b10100000, 260 | 0b10100000, 261 | 0b10100000, 262 | 0b11000000, 263 | 0b00000000, 264 | //E 265 | 0b11100000, 266 | 0b10000000, 267 | 0b11100000, 268 | 0b10000000, 269 | 0b11100000, 270 | 0b00000000, 271 | //F 272 | 0b11100000, 273 | 0b10000000, 274 | 0b11100000, 275 | 0b10000000, 276 | 0b10000000, 277 | 0b00000000, 278 | //G 279 | 0b11100000, 280 | 0b10000000, 281 | 0b10000000, 282 | 0b10100000, 283 | 0b11100000, 284 | 0b00000000, 285 | //H 286 | 0b10100000, 287 | 0b10100000, 288 | 0b11100000, 289 | 0b10100000, 290 | 0b10100000, 291 | 0b00000000, 292 | //I 293 | 0b11100000, 294 | 0b01000000, 295 | 0b01000000, 296 | 0b01000000, 297 | 0b11100000, 298 | 0b00000000, 299 | //J 300 | 0b00100000, 301 | 0b00100000, 302 | 0b00100000, 303 | 0b10100000, 304 | 0b11100000, 305 | 0b00000000, 306 | //K 307 | 0b10000000, 308 | 0b10100000, 309 | 0b11000000, 310 | 0b11000000, 311 | 0b10100000, 312 | 0b00000000, 313 | //L 314 | 0b10000000, 315 | 0b10000000, 316 | 0b10000000, 317 | 0b10000000, 318 | 0b11100000, 319 | 0b00000000, 320 | //M 321 | 0b10100000, 322 | 0b11100000, 323 | 0b11100000, 324 | 0b10100000, 325 | 0b10100000, 326 | 0b00000000, 327 | //N 328 | 0b11000000, 329 | 0b10100000, 330 | 0b10100000, 331 | 0b10100000, 332 | 0b10100000, 333 | 0b00000000, 334 | //O 335 | 0b01000000, 336 | 0b10100000, 337 | 0b10100000, 338 | 0b10100000, 339 | 0b01000000, 340 | 0b00000000, 341 | //P 342 | 0b11100000, 343 | 0b10100000, 344 | 0b11100000, 345 | 0b10000000, 346 | 0b10000000, 347 | 0b00000000, 348 | //Q 349 | 0b01000000, 350 | 0b10100000, 351 | 0b10100000, 352 | 0b11100000, 353 | 0b01100110, 354 | 0b00000000, 355 | //R 356 | 0b11100000, 357 | 0b10100000, 358 | 0b11000000, 359 | 0b11100000, 360 | 0b10101010, 361 | 0b00000000, 362 | //S 363 | 0b11100000, 364 | 0b10000000, 365 | 0b11100000, 366 | 0b00100000, 367 | 0b11100000, 368 | 0b00000000, 369 | //T 370 | 0b11100000, 371 | 0b01000000, 372 | 0b01000000, 373 | 0b01000000, 374 | 0b01000000, 375 | 0b00000000, 376 | //U 377 | 0b10100000, 378 | 0b10100000, 379 | 0b10100000, 380 | 0b10100000, 381 | 0b11100000, 382 | 0b00000000, 383 | //V 384 | 0b10100000, 385 | 0b10100000, 386 | 0b10100000, 387 | 0b10100000, 388 | 0b01000000, 389 | 0b00000000, 390 | //W 391 | 0b10100000, 392 | 0b10100000, 393 | 0b11100000, 394 | 0b11100000, 395 | 0b10100010, 396 | 0b00000000, 397 | //X 398 | 0b10100000, 399 | 0b10100000, 400 | 0b01000000, 401 | 0b10100000, 402 | 0b10100000, 403 | 0b00000000, 404 | //Y 405 | 0b10100000, 406 | 0b10100000, 407 | 0b01000000, 408 | 0b01000000, 409 | 0b01000000, 410 | 0b00000000, 411 | //Z 412 | 0b11100000, 413 | 0b00100000, 414 | 0b01000000, 415 | 0b10000000, 416 | 0b11100000, 417 | 0b00000000, 418 | //[ 419 | 0b11000000, 420 | 0b10000000, 421 | 0b10000000, 422 | 0b10000000, 423 | 0b11000000, 424 | 0b00000000, 425 | // (backslash \ ) 426 | 0b10000000, 427 | 0b10000000, 428 | 0b01000000, 429 | 0b00100000, 430 | 0b00100000, 431 | 0b00000000, 432 | //] 433 | 0b11000000, 434 | 0b01000000, 435 | 0b01000000, 436 | 0b01000000, 437 | 0b11000000, 438 | 0b00000000, 439 | //^ 440 | 0b01000000, 441 | 0b10100000, 442 | 0b00000000, 443 | 0b00000000, 444 | 0b00000000, 445 | 0b00000000, 446 | //_ 447 | 0b00000000, 448 | 0b00000000, 449 | 0b00000000, 450 | 0b00000000, 451 | 0b11100000, 452 | 0b00000000, 453 | //` 454 | 0b10000000, 455 | 0b01000000, 456 | 0b00000000, 457 | 0b00000000, 458 | 0b00000000, 459 | 0b00000000, 460 | //a 461 | 0b00000000, 462 | 0b01100000, 463 | 0b10100000, 464 | 0b10100000, 465 | 0b01100000, 466 | 0b00000000, 467 | //b 468 | 0b10000000, 469 | 0b10000000, 470 | 0b11000000, 471 | 0b10100000, 472 | 0b11000000, 473 | 0b00000000, 474 | //c 475 | 0b00000000, 476 | 0b01100000, 477 | 0b10000000, 478 | 0b10000000, 479 | 0b01100000, 480 | 0b00000000, 481 | //d 482 | 0b00100000, 483 | 0b00100000, 484 | 0b01100000, 485 | 0b10100000, 486 | 0b01100000, 487 | 0b00000000, 488 | //e 489 | 0b01000000, 490 | 0b10100000, 491 | 0b11100000, 492 | 0b10000000, 493 | 0b01100000, 494 | 0b00000000, 495 | //f 496 | 0b01100000, 497 | 0b01000000, 498 | 0b11100000, 499 | 0b01000000, 500 | 0b01000000, 501 | 0b00000000, 502 | //g 503 | 0b01100000, 504 | 0b10100000, 505 | 0b01100000, 506 | 0b00100000, 507 | 0b11000000, 508 | 0b00000000, 509 | //h 510 | 0b10000000, 511 | 0b10000000, 512 | 0b11000000, 513 | 0b10100000, 514 | 0b10100000, 515 | 0b00000000, 516 | //i 517 | 0b01000000, 518 | 0b00000000, 519 | 0b01000000, 520 | 0b01000000, 521 | 0b01000000, 522 | 0b00000000, 523 | //j 524 | 0b01000000, 525 | 0b00000000, 526 | 0b01000000, 527 | 0b01000000, 528 | 0b11000000, 529 | 0b00000000, 530 | //k 531 | 0b10000000, 532 | 0b10000000, 533 | 0b10100000, 534 | 0b11000000, 535 | 0b10100000, 536 | 0b00000000, 537 | //l 538 | 0b11000000, 539 | 0b01000000, 540 | 0b01000000, 541 | 0b01000000, 542 | 0b11100000, 543 | 0b00000000, 544 | //m 545 | 0b00000000, 546 | 0b10100000, 547 | 0b11100000, 548 | 0b10100000, 549 | 0b10100000, 550 | 0b00000000, 551 | //n 552 | 0b00000000, 553 | 0b11000000, 554 | 0b10100000, 555 | 0b10100000, 556 | 0b10100000, 557 | 0b00000000, 558 | //o 559 | 0b00000000, 560 | 0b01000000, 561 | 0b10100000, 562 | 0b10100000, 563 | 0b01000000, 564 | 0b00000000, 565 | //p 566 | 0b00000000, 567 | 0b11000000, 568 | 0b10100000, 569 | 0b11000000, 570 | 0b10000000, 571 | 0b00000000, 572 | //q 573 | 0b00000000, 574 | 0b01100000, 575 | 0b10100000, 576 | 0b01100000, 577 | 0b00100000, 578 | 0b00000000, 579 | //r 580 | 0b00000000, 581 | 0b11000000, 582 | 0b10100000, 583 | 0b10000000, 584 | 0b10000000, 585 | 0b00000000, 586 | //s 587 | 0b00000000, 588 | 0b01100000, 589 | 0b01000000, 590 | 0b00100000, 591 | 0b01100000, 592 | 0b00000000, 593 | //t 594 | 0b01000000, 595 | 0b11100000, 596 | 0b01000000, 597 | 0b01000000, 598 | 0b01000000, 599 | 0b00000000, 600 | //u 601 | 0b00000000, 602 | 0b10100000, 603 | 0b10100000, 604 | 0b10100000, 605 | 0b01100000, 606 | 0b00000000, 607 | //v 608 | 0b00000000, 609 | 0b10100000, 610 | 0b10100000, 611 | 0b10100000, 612 | 0b01000000, 613 | 0b00000000, 614 | //w 615 | 0b00000000, 616 | 0b10100000, 617 | 0b10100000, 618 | 0b11100000, 619 | 0b10100000, 620 | 0b00000000, 621 | //x 622 | 0b00000000, 623 | 0b10100000, 624 | 0b01000000, 625 | 0b01000000, 626 | 0b10100000, 627 | 0b00000000, 628 | //y 629 | 0b00000000, 630 | 0b10100000, 631 | 0b11100000, 632 | 0b00100000, 633 | 0b01000000, 634 | 0b00000000, 635 | //x 636 | 0b00000000, 637 | 0b11100000, 638 | 0b01000000, 639 | 0b10000000, 640 | 0b11100000, 641 | 0b00000000, 642 | //{ 643 | 0b00100000, 644 | 0b01000000, 645 | 0b11000000, 646 | 0b01000000, 647 | 0b00100010, 648 | 0b00000000, 649 | //| 650 | 0b01000000, 651 | 0b01000000, 652 | 0b00000000, 653 | 0b01000000, 654 | 0b01000000, 655 | 0b00000000, 656 | //} 657 | 0b10000000, 658 | 0b01000000, 659 | 0b01100000, 660 | 0b01000000, 661 | 0b10000000, 662 | 0b00000000, 663 | //~ 664 | 0b00000000, 665 | 0b10100000, 666 | 0b01000000, 667 | 0b00000000, 668 | 0b00000000, 669 | 0b00000000 670 | }; 671 | -------------------------------------------------------------------------------- /src/TVoutfonts/font4x6.h: -------------------------------------------------------------------------------- 1 | #ifndef FONT4X6_h 2 | #define FONT4X6_h 3 | #include 4 | 5 | extern const unsigned char font4x6[]; 6 | 7 | #endif -------------------------------------------------------------------------------- /src/TVoutfonts/font6x8.cpp: -------------------------------------------------------------------------------- 1 | #include "font6x8.h" 2 | 3 | PROGMEM const unsigned char font6x8[] = { 4 | 5 | 6,8,32, 6 | //32 Space 7 | 0b00000000, 8 | 0b00000000, 9 | 0b00000000, 10 | 0b00000000, 11 | 0b00000000, 12 | 0b00000000, 13 | 0b00000000, 14 | 0b00000000, 15 | //33 Exclamation ! 16 | 0b01000000, 17 | 0b01000000, 18 | 0b01000000, 19 | 0b01000000, 20 | 0b01000000, 21 | 0b00000000, 22 | 0b01000000, 23 | 0b00000000, 24 | //34 Quotes " 25 | 0b01010000, 26 | 0b01010000, 27 | 0b01010000, 28 | 0b00000000, 29 | 0b00000000, 30 | 0b00000000, 31 | 0b00000000, 32 | 0b00000000, 33 | //35 Number # 34 | 0b00000000, 35 | 0b00000000, 36 | 0b01010000, 37 | 0b11111000, 38 | 0b01010000, 39 | 0b11111000, 40 | 0b01010000, 41 | 0b00000000, 42 | //36 Dollars $ 43 | 0b00100000, 44 | 0b01110000, 45 | 0b10100000, 46 | 0b01110000, 47 | 0b00101000, 48 | 0b01110000, 49 | 0b00100000, 50 | 0b00000000, 51 | //37 Percent % 52 | 0b00000000, 53 | 0b11001000, 54 | 0b11010000, 55 | 0b00100000, 56 | 0b01011000, 57 | 0b10011000, 58 | 0b00000000, 59 | 0b00000000, 60 | //38 Ampersand & 61 | 0b00100000, 62 | 0b01010000, 63 | 0b10000000, 64 | 0b01000000, 65 | 0b10101000, 66 | 0b10010000, 67 | 0b01101000, 68 | 0b00000000, 69 | //39 Single Quote ' 70 | 0b01000000, 71 | 0b01000000, 72 | 0b01000000, 73 | 0b00000000, 74 | 0b00000000, 75 | 0b00000000, 76 | 0b00000000, 77 | 0b00000000, 78 | //40 Left Parenthesis ( 79 | 0b00010000, 80 | 0b00100000, 81 | 0b01000000, 82 | 0b01000000, 83 | 0b01000000, 84 | 0b00100000, 85 | 0b00010000, 86 | 0b00000000, 87 | //41 Right Parenthesis ) 88 | 0b01000000, 89 | 0b00100000, 90 | 0b00010000, 91 | 0b00010000, 92 | 0b00010000, 93 | 0b00100000, 94 | 0b01000000, 95 | 0b00000000, 96 | //42 Star * 97 | 0b00010000, 98 | 0b00111000, 99 | 0b00010000, 100 | 0b00000000, 101 | 0b00000000, 102 | 0b00000000, 103 | 0b00000000, 104 | 0b00000000, 105 | //43 Plus + 106 | 0b00000000, 107 | 0b00100000, 108 | 0b00100000, 109 | 0b11111000, 110 | 0b00100000, 111 | 0b00100000, 112 | 0b00000000, 113 | 0b00000000, 114 | //44 Comma , 115 | 0b00000000, 116 | 0b00000000, 117 | 0b00000000, 118 | 0b00000000, 119 | 0b00000000, 120 | 0b00010000, 121 | 0b00010000, 122 | 0b00000000, 123 | //45 Minus - 124 | 0b00000000, 125 | 0b00000000, 126 | 0b00000000, 127 | 0b11111000, 128 | 0b00000000, 129 | 0b00000000, 130 | 0b00000000, 131 | 0b00000000, 132 | //46 Period . 133 | 0b00000000, 134 | 0b00000000, 135 | 0b00000000, 136 | 0b00000000, 137 | 0b00000000, 138 | 0b00010000, 139 | 0b00000000, 140 | 0b00000000, 141 | // 47 Backslash / 142 | 0b00000000, 143 | 0b00001000, 144 | 0b00010000, 145 | 0b00100000, 146 | 0b01000000, 147 | 0b10000000, 148 | 0b00000000, 149 | 0b00000000, 150 | // 48 Zero 151 | 0b01110000, 152 | 0b10001000, 153 | 0b10101000, 154 | 0b10101000, 155 | 0b10001000, 156 | 0b01110000, 157 | 0b00000000, 158 | 0b00000000, 159 | //49 One 160 | 0b00100000, 161 | 0b01100000, 162 | 0b00100000, 163 | 0b00100000, 164 | 0b00100000, 165 | 0b01110000, 166 | 0b00000000, 167 | 0b00000000, 168 | //50 two 169 | 0b01110000, 170 | 0b10001000, 171 | 0b00010000, 172 | 0b00100000, 173 | 0b01000000, 174 | 0b11111000, 175 | 0b00000000, 176 | 0b00000000, 177 | //51 Three 178 | 0b11111000, 179 | 0b00010000, 180 | 0b00100000, 181 | 0b00010000, 182 | 0b10001000, 183 | 0b01110000, 184 | 0b00000000, 185 | 0b00000000, 186 | //52 Four 187 | 0b10010000, 188 | 0b10010000, 189 | 0b10010000, 190 | 0b11111000, 191 | 0b00010000, 192 | 0b00010000, 193 | 0b00000000, 194 | 0b00000000, 195 | //53 Five 196 | 0b11111000, 197 | 0b10000000, 198 | 0b11110000, 199 | 0b00001000, 200 | 0b10001000, 201 | 0b01110000, 202 | 0b00000000, 203 | 0b00000000, 204 | //54 Six 205 | 0b01110000, 206 | 0b10000000, 207 | 0b11110000, 208 | 0b10001000, 209 | 0b10001000, 210 | 0b01110000, 211 | 0b00000000, 212 | 0b00000000, 213 | //55 Seven 214 | 0b11111000, 215 | 0b00001000, 216 | 0b00010000, 217 | 0b00100000, 218 | 0b01000000, 219 | 0b10000000, 220 | 0b00000000, 221 | 0b00000000, 222 | //56 Eight 223 | 0b01110000, 224 | 0b10001000, 225 | 0b01110000, 226 | 0b10001000, 227 | 0b10001000, 228 | 0b01110000, 229 | 0b00000000, 230 | 0b00000000, 231 | //57 Nine 232 | 0b01110000, 233 | 0b10001000, 234 | 0b10001000, 235 | 0b01111000, 236 | 0b00001000, 237 | 0b01110000, 238 | 0b00000000, 239 | 0b00000000, 240 | //58 : 241 | 0b00000000, 242 | 0b00000000, 243 | 0b00100000, 244 | 0b00000000, 245 | 0b00000000, 246 | 0b00100000, 247 | 0b00000000, 248 | 0b00000000, 249 | //59 ; 250 | 0b00000000, 251 | 0b00000000, 252 | 0b00100000, 253 | 0b00000000, 254 | 0b00100000, 255 | 0b00100000, 256 | 0b01000000, 257 | 0b00000000, 258 | //60 < 259 | 0b00000000, 260 | 0b00011000, 261 | 0b01100000, 262 | 0b10000000, 263 | 0b01100000, 264 | 0b00011000, 265 | 0b00000000, 266 | 0b00000000, 267 | //61 = 268 | 0b00000000, 269 | 0b00000000, 270 | 0b01111000, 271 | 0b00000000, 272 | 0b01111000, 273 | 0b00000000, 274 | 0b00000000, 275 | 0b00000000, 276 | //62 > 277 | 0b00000000, 278 | 0b11000000, 279 | 0b00110000, 280 | 0b00001000, 281 | 0b00110000, 282 | 0b11000000, 283 | 0b00000000, 284 | 0b00000000, 285 | //63 ? 286 | 0b01100000, 287 | 0b10010000, 288 | 0b00100000, 289 | 0b00100000, 290 | 0b00000000, 291 | 0b00100000, 292 | 0b00000000, 293 | 0b00000000, 294 | //64 @ 295 | 0b01110000, 296 | 0b10001000, 297 | 0b10011000, 298 | 0b10101000, 299 | 0b10010000, 300 | 0b10001000, 301 | 0b01110000, 302 | 0b00000000, 303 | //65 A 304 | 0b00100000, 305 | 0b01010000, 306 | 0b10001000, 307 | 0b11111000, 308 | 0b10001000, 309 | 0b10001000, 310 | 0b00000000, 311 | 0b00000000, 312 | //B 313 | 0b11110000, 314 | 0b10001000, 315 | 0b11110000, 316 | 0b10001000, 317 | 0b10001000, 318 | 0b11110000, 319 | 0b00000000, 320 | 0b00000000, 321 | //C 322 | 0b01110000, 323 | 0b10001000, 324 | 0b10000000, 325 | 0b10000000, 326 | 0b10001000, 327 | 0b01110000, 328 | 0b00000000, 329 | 0b00000000, 330 | //D 331 | 0b11110000, 332 | 0b10001000, 333 | 0b10001000, 334 | 0b10001000, 335 | 0b10001000, 336 | 0b11110000, 337 | 0b00000000, 338 | 0b00000000, 339 | //E 340 | 0b11111000, 341 | 0b10000000, 342 | 0b11111000, 343 | 0b10000000, 344 | 0b10000000, 345 | 0b11111000, 346 | 0b00000000, 347 | 0b00000000, 348 | //F 349 | 0b11111000, 350 | 0b10000000, 351 | 0b11110000, 352 | 0b10000000, 353 | 0b10000000, 354 | 0b10000000, 355 | 0b00000000, 356 | 0b00000000, 357 | //G 358 | 0b01110000, 359 | 0b10001000, 360 | 0b10000000, 361 | 0b10011000, 362 | 0b10001000, 363 | 0b01110000, 364 | 0b00000000, 365 | 0b00000000, 366 | //H 367 | 0b10001000, 368 | 0b10001000, 369 | 0b11111000, 370 | 0b10001000, 371 | 0b10001000, 372 | 0b10001000, 373 | 0b00000000, 374 | 0b00000000, 375 | //I 376 | 0b01110000, 377 | 0b00100000, 378 | 0b00100000, 379 | 0b00100000, 380 | 0b00100000, 381 | 0b01110000, 382 | 0b00000000, 383 | 0b00000000, 384 | //J 385 | 0b00111000, 386 | 0b00010000, 387 | 0b00010000, 388 | 0b00010000, 389 | 0b10010000, 390 | 0b01100000, 391 | 0b00000000, 392 | 0b00000000, 393 | //K 394 | 0b10001000, 395 | 0b10010000, 396 | 0b11100000, 397 | 0b10100000, 398 | 0b10010000, 399 | 0b10001000, 400 | 0b00000000, 401 | 0b00000000, 402 | //L 403 | 0b10000000, 404 | 0b10000000, 405 | 0b10000000, 406 | 0b10000000, 407 | 0b10000000, 408 | 0b11111000, 409 | 0b00000000, 410 | 0b00000000, 411 | //M 412 | 0b10001000, 413 | 0b11011000, 414 | 0b10101000, 415 | 0b10101000, 416 | 0b10001000, 417 | 0b10001000, 418 | 0b00000000, 419 | 0b00000000, 420 | //N 421 | 0b10001000, 422 | 0b10001000, 423 | 0b11001000, 424 | 0b10101000, 425 | 0b10011000, 426 | 0b10001000, 427 | 0b00000000, 428 | 0b00000000, 429 | //O 430 | 0b01110000, 431 | 0b10001000, 432 | 0b10001000, 433 | 0b10001000, 434 | 0b10001000, 435 | 0b01110000, 436 | 0b00000000, 437 | 0b00000000, 438 | //P 439 | 0b11110000, 440 | 0b10001000, 441 | 0b11110000, 442 | 0b10000000, 443 | 0b10000000, 444 | 0b10000000, 445 | 0b00000000, 446 | 0b00000000, 447 | //Q 448 | 0b01110000, 449 | 0b10001000, 450 | 0b10001000, 451 | 0b10101000, 452 | 0b10010000, 453 | 0b01101000, 454 | 0b00000000, 455 | 0b00000000, 456 | //R 457 | 0b11110000, 458 | 0b10001000, 459 | 0b11110000, 460 | 0b10100000, 461 | 0b10010000, 462 | 0b10001000, 463 | 0b00000000, 464 | 0b00000000, 465 | //S 466 | 0b01111000, 467 | 0b10000000, 468 | 0b01110000, 469 | 0b00001000, 470 | 0b00001000, 471 | 0b11110000, 472 | 0b00000000, 473 | 0b00000000, 474 | //T 475 | 0b11111000, 476 | 0b00100000, 477 | 0b00100000, 478 | 0b00100000, 479 | 0b00100000, 480 | 0b00100000, 481 | 0b00000000, 482 | 0b00000000, 483 | //U 484 | 0b10001000, 485 | 0b10001000, 486 | 0b10001000, 487 | 0b10001000, 488 | 0b10001000, 489 | 0b01110000, 490 | 0b00000000, 491 | 0b00000000, 492 | //V 493 | 0b10001000, 494 | 0b10001000, 495 | 0b10001000, 496 | 0b10001000, 497 | 0b01010000, 498 | 0b00100000, 499 | 0b00000000, 500 | 0b00000000, 501 | //W 502 | 0b10001000, 503 | 0b10001000, 504 | 0b10101000, 505 | 0b10101000, 506 | 0b10101000, 507 | 0b01010000, 508 | 0b00000000, 509 | 0b00000000, 510 | //X 511 | 0b10001000, 512 | 0b01010000, 513 | 0b00100000, 514 | 0b01010000, 515 | 0b10001000, 516 | 0b10001000, 517 | 0b00000000, 518 | 0b00000000, 519 | //Y 520 | 0b10001000, 521 | 0b10001000, 522 | 0b01010000, 523 | 0b00100000, 524 | 0b00100000, 525 | 0b00100000, 526 | 0b00000000, 527 | 0b00000000, 528 | //Z 529 | 0b11111000, 530 | 0b00001000, 531 | 0b00010000, 532 | 0b00100000, 533 | 0b01000000, 534 | 0b11111000, 535 | 0b00000000, 536 | 0b00000000, 537 | //91 [ 538 | 0b11100000, 539 | 0b10000000, 540 | 0b10000000, 541 | 0b10000000, 542 | 0b10000000, 543 | 0b11100000, 544 | 0b00000000, 545 | 0b00000000, 546 | //92 (backslash) 547 | 0b00000000, 548 | 0b10000000, 549 | 0b01000000, 550 | 0b00100000, 551 | 0b00010000, 552 | 0b00001000, 553 | 0b00000000, 554 | 0b00000000, 555 | //93 ] 556 | 0b00111000, 557 | 0b00001000, 558 | 0b00001000, 559 | 0b00001000, 560 | 0b00001000, 561 | 0b00111000, 562 | 0b00000000, 563 | 0b00000000, 564 | //94 ^ 565 | 0b00100000, 566 | 0b01010000, 567 | 0b00000000, 568 | 0b00000000, 569 | 0b00000000, 570 | 0b00000000, 571 | 0b00000000, 572 | 0b00000000, 573 | //95 _ 574 | 0b00000000, 575 | 0b00000000, 576 | 0b00000000, 577 | 0b00000000, 578 | 0b00000000, 579 | 0b00000000, 580 | 0b11111000, 581 | 0b00000000, 582 | //96 ` 583 | 0b10000000, 584 | 0b01000000, 585 | 0b00000000, 586 | 0b00000000, 587 | 0b00000000, 588 | 0b00000000, 589 | 0b00000000, 590 | 0b00000000, 591 | //97 a 592 | 0b00000000, 593 | 0b01100000, 594 | 0b00010000, 595 | 0b01110000, 596 | 0b10010000, 597 | 0b01100000, 598 | 0b00000000, 599 | 0b00000000, 600 | //98 b 601 | 0b10000000, 602 | 0b10000000, 603 | 0b11100000, 604 | 0b10010000, 605 | 0b10010000, 606 | 0b11100000, 607 | 0b00000000, 608 | 0b00000000, 609 | //99 c 610 | 0b00000000, 611 | 0b00000000, 612 | 0b01110000, 613 | 0b10000000, 614 | 0b10000000, 615 | 0b01110000, 616 | 0b00000000, 617 | 0b00000000, 618 | // 100 d 619 | 0b00010000, 620 | 0b00010000, 621 | 0b01110000, 622 | 0b10010000, 623 | 0b10010000, 624 | 0b01110000, 625 | 0b00000000, 626 | 0b00000000, 627 | //101 e 628 | 0b00000000, 629 | 0b01100000, 630 | 0b10010000, 631 | 0b11110000, 632 | 0b10000000, 633 | 0b01110000, 634 | 0b00000000, 635 | 0b00000000, 636 | //102 f 637 | 0b00110000, 638 | 0b01000000, 639 | 0b11100000, 640 | 0b01000000, 641 | 0b01000000, 642 | 0b01000000, 643 | 0b00000000, 644 | 0b00000000, 645 | //103 g 646 | 0b00000000, 647 | 0b01100000, 648 | 0b10010000, 649 | 0b01110000, 650 | 0b00010000, 651 | 0b00010000, 652 | 0b01100000, 653 | 0b00000000, 654 | //104 h 655 | 0b10000000, 656 | 0b10000000, 657 | 0b11100000, 658 | 0b10010000, 659 | 0b10010000, 660 | 0b10010000, 661 | 0b00000000, 662 | 0b00000000, 663 | //105 i 664 | 0b00100000, 665 | 0b00000000, 666 | 0b00100000, 667 | 0b00100000, 668 | 0b00100000, 669 | 0b01110000, 670 | 0b00000000, 671 | 0b00000000, 672 | //106 j 673 | 0b00010000, 674 | 0b00000000, 675 | 0b00110000, 676 | 0b00010000, 677 | 0b00010000, 678 | 0b00010000, 679 | 0b01100000, 680 | 0b00000000, 681 | //107 k 682 | 0b10000000, 683 | 0b10010000, 684 | 0b10100000, 685 | 0b11000000, 686 | 0b10100000, 687 | 0b10010000, 688 | 0b00000000, 689 | 0b00000000, 690 | //108 l 691 | 0b01100000, 692 | 0b00100000, 693 | 0b00100000, 694 | 0b00100000, 695 | 0b00100000, 696 | 0b01110000, 697 | 0b00000000, 698 | 0b00000000, 699 | //109 m 700 | 0b00000000, 701 | 0b00000000, 702 | 0b01010000, 703 | 0b10101000, 704 | 0b10101000, 705 | 0b10101000, 706 | 0b00000000, 707 | 0b00000000, 708 | //110 n 709 | 0b00000000, 710 | 0b00000000, 711 | 0b11110000, 712 | 0b10001000, 713 | 0b10001000, 714 | 0b10001000, 715 | 0b00000000, 716 | 0b00000000, 717 | //111 o 718 | 0b00000000, 719 | 0b00000000, 720 | 0b01100000, 721 | 0b10010000, 722 | 0b10010000, 723 | 0b01100000, 724 | 0b00000000, 725 | 0b00000000, 726 | //112 p 727 | 0b00000000, 728 | 0b00000000, 729 | 0b01100000, 730 | 0b10010000, 731 | 0b11110000, 732 | 0b10000000, 733 | 0b10000000, 734 | 0b00000000, 735 | //113 q 736 | 0b00000000, 737 | 0b00000000, 738 | 0b01100000, 739 | 0b10010000, 740 | 0b11110000, 741 | 0b00010000, 742 | 0b00010000, 743 | 0b00000000, 744 | //114 r 745 | 0b00000000, 746 | 0b00000000, 747 | 0b10110000, 748 | 0b01001000, 749 | 0b01000000, 750 | 0b01000000, 751 | 0b00000000, 752 | 0b00000000, 753 | //115 s 754 | 0b00000000, 755 | 0b00110000, 756 | 0b01000000, 757 | 0b00100000, 758 | 0b00010000, 759 | 0b01100000, 760 | 0b00000000, 761 | 0b00000000, 762 | //116 t 763 | 0b01000000, 764 | 0b01000000, 765 | 0b11100000, 766 | 0b01000000, 767 | 0b01000000, 768 | 0b01000000, 769 | 0b00000000, 770 | 0b00000000, 771 | // 117u 772 | 0b00000000, 773 | 0b00000000, 774 | 0b10010000, 775 | 0b10010000, 776 | 0b10010000, 777 | 0b01100000, 778 | 0b00000000, 779 | 0b00000000, 780 | //118 v 781 | 0b00000000, 782 | 0b00000000, 783 | 0b10001000, 784 | 0b10001000, 785 | 0b01010000, 786 | 0b00100000, 787 | 0b00000000, 788 | 0b00000000, 789 | //119 w 790 | 0b00000000, 791 | 0b00000000, 792 | 0b10001000, 793 | 0b10101000, 794 | 0b10101000, 795 | 0b01010000, 796 | 0b00000000, 797 | 0b00000000, 798 | //120 x 799 | 0b00000000, 800 | 0b10001000, 801 | 0b01010000, 802 | 0b00100000, 803 | 0b01010000, 804 | 0b10001000, 805 | 0b00000000, 806 | 0b00000000, 807 | //121 y 808 | 0b00000000, 809 | 0b00000000, 810 | 0b10010000, 811 | 0b10010000, 812 | 0b01100000, 813 | 0b01000000, 814 | 0b10000000, 815 | 0b00000000, 816 | //122 z 817 | 0b00000000, 818 | 0b00000000, 819 | 0b11110000, 820 | 0b00100000, 821 | 0b01000000, 822 | 0b11110000, 823 | 0b00000000, 824 | 0b00000000, 825 | //123 { 826 | 0b00100000, 827 | 0b01000000, 828 | 0b01000000, 829 | 0b10000000, 830 | 0b01000000, 831 | 0b01000000, 832 | 0b00100000, 833 | 0b00000000, 834 | //124 | 835 | 0b00100000, 836 | 0b00100000, 837 | 0b00100000, 838 | 0b00100000, 839 | 0b00100000, 840 | 0b00100000, 841 | 0b00100000, 842 | 0b00000000, 843 | //125 } 844 | 0b00100000, 845 | 0b00010000, 846 | 0b00010000, 847 | 0b00001000, 848 | 0b00010000, 849 | 0b00010000, 850 | 0b00100000, 851 | 0b00000000, 852 | //126 ~ 853 | 0b01000000, 854 | 0b10101000, 855 | 0b00010000, 856 | 0b00000000, 857 | 0b00000000, 858 | 0b00000000, 859 | 0b00000000, 860 | 0b00000000, 861 | //127 DEL 862 | 0b00000000, 863 | 0b00000000, 864 | 0b00000000, 865 | 0b00000000, 866 | 0b00000000, 867 | 0b00000000, 868 | 0b00000000, 869 | 0b00000000 870 | }; -------------------------------------------------------------------------------- /src/TVoutfonts/font6x8.h: -------------------------------------------------------------------------------- 1 | #ifndef FONT6X8_H 2 | #define FONT6X8_H 3 | 4 | #include 5 | 6 | extern const unsigned char font6x8[]; 7 | 8 | #endif -------------------------------------------------------------------------------- /src/TVoutfonts/font8x8.cpp: -------------------------------------------------------------------------------- 1 | #include "font8x8.h" 2 | 3 | PROGMEM const unsigned char font8x8[] = { 4 | 8,8,0, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 | 0x00, 0x3E, 0x41, 0x55, 0x41, 0x55, 0x49, 0x3E, 7 | 0x00, 0x3E, 0x7F, 0x6B, 0x7F, 0x6B, 0x77, 0x3E, 8 | 0x00, 0x22, 0x77, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 9 | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, 10 | 0x00, 0x08, 0x1C, 0x2A, 0x7F, 0x2A, 0x08, 0x1C, 11 | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C, 12 | 0x00, 0x00, 0x1C, 0x3E, 0x3E, 0x3E, 0x1C, 0x00, 13 | 0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF, 14 | 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, 15 | 0xFF, 0xFF, 0xE3, 0xDD, 0xDD, 0xDD, 0xE3, 0xFF, 16 | 0x00, 0x0F, 0x03, 0x05, 0x39, 0x48, 0x48, 0x30, 17 | 0x00, 0x08, 0x3E, 0x08, 0x1C, 0x22, 0x22, 0x1C, 18 | 0x00, 0x18, 0x14, 0x10, 0x10, 0x30, 0x70, 0x60, 19 | 0x00, 0x0F, 0x19, 0x11, 0x13, 0x37, 0x76, 0x60, 20 | 0x00, 0x08, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x08, 21 | 0x00, 0x60, 0x78, 0x7E, 0x7F, 0x7E, 0x78, 0x60, 22 | 0x00, 0x03, 0x0F, 0x3F, 0x7F, 0x3F, 0x0F, 0x03, 23 | 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x08, 24 | 0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 25 | 0x00, 0x3F, 0x65, 0x65, 0x3D, 0x05, 0x05, 0x05, 26 | 0x00, 0x0C, 0x32, 0x48, 0x24, 0x12, 0x4C, 0x30, 27 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 28 | 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x3E, 29 | 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x1C, 0x1C, 0x1C, 30 | 0x00, 0x1C, 0x1C, 0x1C, 0x7F, 0x3E, 0x1C, 0x08, 31 | 0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08, 32 | 0x00, 0x08, 0x18, 0x3F, 0x7F, 0x3F, 0x18, 0x08, 33 | 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x7F, 0x7F, 34 | 0x00, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00, 35 | 0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F, 36 | 0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 39 | 0x00, 0x36, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00, 40 | 0x00, 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36, 41 | 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08, 42 | 0x00, 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06, 43 | 0x00, 0x3C, 0x66, 0x3C, 0x28, 0x65, 0x66, 0x3F, 44 | 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 45 | 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 46 | 0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 47 | 0x00, 0x00, 0x36, 0x1C, 0x7F, 0x1C, 0x36, 0x00, 48 | 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60, 50 | 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 52 | 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 53 | 0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, 54 | 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, 55 | 0x00, 0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E, 56 | 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 57 | 0x00, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C, 58 | 0x00, 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 59 | 0x00, 0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, 60 | 0x00, 0x7E, 0x66, 0x0C, 0x0C, 0x18, 0x18, 0x18, 61 | 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 62 | 0x00, 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 63 | 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 64 | 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, 65 | 0x00, 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 66 | 0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00, 67 | 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 68 | 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x18, 0x00, 0x18, 69 | 0x00, 0x38, 0x44, 0x5C, 0x58, 0x42, 0x3C, 0x00, 70 | 0x00, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 71 | 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 72 | 0x00, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 73 | 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 74 | 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E, 75 | 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60, 76 | 0x00, 0x3C, 0x66, 0x60, 0x60, 0x6E, 0x66, 0x3C, 77 | 0x00, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 78 | 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 79 | 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, 80 | 0x00, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 81 | 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 82 | 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 83 | 0x00, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x63, 0x63, 84 | 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 85 | 0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 86 | 0x00, 0x3C, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06, 87 | 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, 88 | 0x00, 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 89 | 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18, 90 | 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E, 91 | 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 92 | 0x00, 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 93 | 0x00, 0x63, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x63, 94 | 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 95 | 0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 96 | 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E, 97 | 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 98 | 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 99 | 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 101 | 0x00, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00, 102 | 0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 103 | 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 104 | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C, 105 | 0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, 106 | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 107 | 0x00, 0x1C, 0x36, 0x30, 0x30, 0x7C, 0x30, 0x30, 108 | 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C, 109 | 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 110 | 0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C, 111 | 0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x6C, 0x6C, 0x38, 112 | 0x00, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, 113 | 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 114 | 0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x6B, 115 | 0x00, 0x00, 0x00, 0x7C, 0x7E, 0x66, 0x66, 0x66, 116 | 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 117 | 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 118 | 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3C, 0x0D, 0x0F, 119 | 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x60, 0x60, 120 | 0x00, 0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C, 121 | 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 122 | 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 123 | 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 124 | 0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x3E, 125 | 0x00, 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 126 | 0x00, 0x00, 0x00, 0x66, 0x66, 0x3E, 0x06, 0x3C, 127 | 0x00, 0x00, 0x00, 0x3C, 0x0C, 0x18, 0x30, 0x3C, 128 | 0x00, 0x0E, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0E, 129 | 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 130 | 0x00, 0x70, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x70, 131 | 0x00, 0x00, 0x00, 0x3A, 0x6C, 0x00, 0x00, 0x00, 132 | 0x00, 0x08, 0x1C, 0x36, 0x63, 0x41, 0x41, 0x7F 133 | }; -------------------------------------------------------------------------------- /src/TVoutfonts/font8x8.h: -------------------------------------------------------------------------------- 1 | #ifndef FONT8X8_H 2 | #define FONT8X8_H 3 | 4 | #include 5 | extern const unsigned char font8x8[]; 6 | 7 | #endif -------------------------------------------------------------------------------- /src/TVoutfonts/font8x8ext.cpp: -------------------------------------------------------------------------------- 1 | #include "font8x8ext.h" 2 | 3 | PROGMEM const unsigned char font8x8ext[] = { 4 | 8,8,0, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 6 | 0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E, 7 | 0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, 8 | 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00, 9 | 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00, 10 | 0x38, 0x7C, 0x38, 0xFE, 0xFE, 0xD6, 0x10, 0x38, 11 | 0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x7C, 0x10, 0x38, 12 | 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 13 | 0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF, 14 | 0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00, 15 | 0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF, 16 | 0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78, 17 | 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 18 | 0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0, 19 | 0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0, 20 | 0x18, 0xDB, 0x3C, 0xE7, 0xE7, 0x3C, 0xDB, 0x18, 21 | 0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00, 22 | 0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00, 23 | 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18, 24 | 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00, 25 | 0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00, 26 | 0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, 27 | 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00, 28 | 0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF, 29 | 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, 30 | 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 31 | 0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00, 32 | 0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00, 33 | 0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00, 34 | 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, 35 | 0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00, 36 | 0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00, 37 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 38 | 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00, 39 | 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 40 | 0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00, 41 | 0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00, 42 | 0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00, 43 | 0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00, 44 | 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 45 | 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00, 46 | 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00, 47 | 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 48 | 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 50 | 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 52 | 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00, 53 | 0x7C, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0x7C, 0x00, 54 | 0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 55 | 0x7C, 0xC6, 0x06, 0x1C, 0x30, 0x66, 0xFE, 0x00, 56 | 0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, 57 | 0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00, 58 | 0xFE, 0xC0, 0xC0, 0xFC, 0x06, 0xC6, 0x7C, 0x00, 59 | 0x38, 0x60, 0xC0, 0xFC, 0xC6, 0xC6, 0x7C, 0x00, 60 | 0xFE, 0xC6, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00, 61 | 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, 62 | 0x7C, 0xC6, 0xC6, 0x7E, 0x06, 0x0C, 0x78, 0x00, 63 | 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00, 64 | 0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30, 65 | 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00, 66 | 0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, 67 | 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00, 68 | 0x7C, 0xC6, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00, 69 | 0x7C, 0xC6, 0xDE, 0xDE, 0xDE, 0xC0, 0x78, 0x00, 70 | 0x38, 0x6C, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 71 | 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 72 | 0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00, 73 | 0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00, 74 | 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, 75 | 0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00, 76 | 0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00, 77 | 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 78 | 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 79 | 0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00, 80 | 0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00, 81 | 0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00, 82 | 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, 83 | 0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00, 84 | 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 85 | 0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00, 86 | 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xCE, 0x7C, 0x0E, 87 | 0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00, 88 | 0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 89 | 0x7E, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x3C, 0x00, 90 | 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 91 | 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 92 | 0xC6, 0xC6, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, 93 | 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, 94 | 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x3C, 0x00, 95 | 0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00, 96 | 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, 97 | 0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00, 98 | 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, 99 | 0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00, 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 101 | 0x30, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 102 | 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, 103 | 0xE0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0xDC, 0x00, 104 | 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, 105 | 0x1C, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 106 | 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, 107 | 0x3C, 0x66, 0x60, 0xF8, 0x60, 0x60, 0xF0, 0x00, 108 | 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8, 109 | 0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00, 110 | 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, 111 | 0x06, 0x00, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3C, 112 | 0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00, 113 | 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 114 | 0x00, 0x00, 0xEC, 0xFE, 0xD6, 0xD6, 0xD6, 0x00, 115 | 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x00, 116 | 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 117 | 0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0, 118 | 0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E, 119 | 0x00, 0x00, 0xDC, 0x76, 0x60, 0x60, 0xF0, 0x00, 120 | 0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, 121 | 0x30, 0x30, 0xFC, 0x30, 0x30, 0x36, 0x1C, 0x00, 122 | 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 123 | 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00, 124 | 0x00, 0x00, 0xC6, 0xD6, 0xD6, 0xFE, 0x6C, 0x00, 125 | 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 126 | 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xFC, 127 | 0x00, 0x00, 0x7E, 0x4C, 0x18, 0x32, 0x7E, 0x00, 128 | 0x0E, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0E, 0x00, 129 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 130 | 0x70, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x70, 0x00, 131 | 0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 132 | 0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00, 133 | 0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x0C, 134 | 0xFC, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x6C, 0x00, 135 | 0x1C, 0x10, 0x00, 0x7E, 0x60, 0x60, 0x60, 0x00, 136 | 0x38, 0x20, 0xFE, 0xC0, 0xC0, 0xC0, 0xC0, 0x00, 137 | 0x6C, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, 138 | 0x6C, 0xFE, 0x62, 0x78, 0x60, 0x62, 0xFE, 0x00, 139 | 0x00, 0x00, 0x7C, 0xC6, 0xF0, 0xC6, 0x7C, 0x00, 140 | 0x3C, 0x66, 0xC0, 0xF8, 0xC0, 0x66, 0x3C, 0x00, 141 | 0x00, 0x00, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x00, 142 | 0x7C, 0xC6, 0x60, 0x38, 0x0C, 0xC6, 0x7C, 0x00, 143 | 0x30, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 144 | 0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 145 | 0xCC, 0x00, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00, 146 | 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 147 | 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x70, 148 | 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0xCC, 0x78, 0x00, 149 | 0x00, 0x00, 0x70, 0x50, 0x5C, 0x52, 0xDC, 0x00, 150 | 0x70, 0x50, 0x5C, 0x52, 0x52, 0x52, 0xDC, 0x00, 151 | 0x00, 0x00, 0xA0, 0xA0, 0xFC, 0xA2, 0xBC, 0x00, 152 | 0xA0, 0xA0, 0xA0, 0xFC, 0xA2, 0xA2, 0xBC, 0x00, 153 | 0x60, 0xF0, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00, 154 | 0xF8, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00, 155 | 0x1C, 0x10, 0xC6, 0xD8, 0xF8, 0xCC, 0xC6, 0x00, 156 | 0x18, 0xD6, 0xCC, 0xF8, 0xF8, 0xCC, 0xC6, 0x00, 157 | 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, 158 | 0x38, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, 159 | 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, 160 | 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0x10, 161 | 0x00, 0x00, 0xDC, 0xD6, 0xF6, 0xD6, 0xDC, 0x00, 162 | 0xDC, 0xD6, 0xD6, 0xF6, 0xD6, 0xD6, 0xDC, 0x00, 163 | 0x00, 0x00, 0xF0, 0xB0, 0x3C, 0x36, 0x3C, 0x00, 164 | 0xF0, 0xF0, 0xB0, 0x3C, 0x36, 0x36, 0x3C, 0x00, 165 | 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00, 166 | 0x3E, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, 167 | 0x06, 0x7C, 0xC0, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, 168 | 0xFE, 0x66, 0x60, 0x7C, 0x66, 0x66, 0xFC, 0x00, 169 | 0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, 170 | 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFE, 0x06, 171 | 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x6C, 0xFE, 0xC6, 172 | 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, 173 | 0x00, 0x00, 0x7C, 0xC6, 0xFE, 0xC0, 0x7C, 0x00, 174 | 0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00, 175 | 0x00, 0x00, 0x7C, 0xD6, 0xD6, 0x7C, 0x10, 0x38, 176 | 0x7C, 0xD6, 0xD6, 0xD6, 0x7C, 0x10, 0x38, 0x00, 177 | 0x00, 0x00, 0xFE, 0x66, 0x60, 0x60, 0xF0, 0x00, 178 | 0xFE, 0x66, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 179 | 0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, 180 | 0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, 181 | 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 182 | 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 183 | 0xDB, 0x77, 0xDB, 0xEE, 0xDB, 0x77, 0xDB, 0xEE, 184 | 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 185 | 0x18, 0x18, 0x18, 0x18, 0xF8, 0x18, 0x18, 0x18, 186 | 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 187 | 0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00, 188 | 0x00, 0x00, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, 189 | 0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, 190 | 0x36, 0x36, 0xF6, 0x06, 0xF6, 0x36, 0x36, 0x36, 191 | 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 192 | 0x00, 0x00, 0xFE, 0x06, 0xF6, 0x36, 0x36, 0x36, 193 | 0x36, 0x36, 0xF6, 0x06, 0xFE, 0x00, 0x00, 0x00, 194 | 0x00, 0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0x00, 195 | 0x38, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x00, 196 | 0x00, 0x00, 0x00, 0x00, 0xF8, 0x18, 0x18, 0x18, 197 | 0x18, 0x18, 0x18, 0x18, 0x1F, 0x00, 0x00, 0x00, 198 | 0x18, 0x18, 0x18, 0x18, 0xFF, 0x00, 0x00, 0x00, 199 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0x18, 0x18, 0x18, 200 | 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 201 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 202 | 0x18, 0x18, 0x18, 0x18, 0xFF, 0x18, 0x18, 0x18, 203 | 0x00, 0x00, 0xE6, 0x6C, 0x78, 0x6C, 0xE6, 0x00, 204 | 0xE6, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 205 | 0x36, 0x36, 0x37, 0x30, 0x3F, 0x00, 0x00, 0x00, 206 | 0x00, 0x00, 0x3F, 0x30, 0x37, 0x36, 0x36, 0x36, 207 | 0x36, 0x36, 0xF7, 0x00, 0xFF, 0x00, 0x00, 0x00, 208 | 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x36, 0x36, 0x36, 209 | 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 210 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0x00, 211 | 0x36, 0x36, 0xF7, 0x00, 0xF7, 0x36, 0x36, 0x36, 212 | 0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, 213 | 0x00, 0x00, 0x3E, 0x66, 0x66, 0x66, 0xE6, 0x00, 214 | 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xC6, 0x00, 215 | 0x00, 0x00, 0xC6, 0xFE, 0xFE, 0xD6, 0xC6, 0x00, 216 | 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00, 217 | 0x00, 0x00, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0x00, 218 | 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 219 | 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 220 | 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 221 | 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 222 | 0x18, 0x18, 0x18, 0x18, 0xF8, 0x00, 0x00, 0x00, 223 | 0x00, 0x00, 0x00, 0x00, 0x1F, 0x18, 0x18, 0x18, 224 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 225 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 226 | 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 227 | 0x00, 0x00, 0x7E, 0xC6, 0x7E, 0x66, 0xC6, 0x00, 228 | 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 229 | 0x7E, 0xC6, 0xC6, 0xC6, 0x7E, 0x66, 0xC6, 0x00, 230 | 0x00, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x60, 0xF0, 231 | 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xF0, 0x00, 232 | 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC6, 0x7C, 0x00, 233 | 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 234 | 0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x3C, 0x00, 235 | 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 236 | 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x7C, 237 | 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0xC6, 0x7C, 0x00, 238 | 0x00, 0x00, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0x00, 239 | 0xD6, 0xD6, 0x7C, 0x38, 0x7C, 0xD6, 0xD6, 0x00, 240 | 0x00, 0x00, 0xFC, 0x66, 0x7C, 0x66, 0xFC, 0x00, 241 | 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 242 | 0x00, 0x00, 0xF0, 0x60, 0x7C, 0x66, 0xFC, 0x00, 243 | 0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00, 244 | 0x8F, 0xCD, 0xEF, 0xFC, 0xDC, 0xCC, 0xCC, 0x00, 245 | 0x00, 0x00, 0x00, 0x7C, 0x7C, 0x00, 0x00, 0x00, 246 | 0x00, 0x00, 0xC6, 0xC6, 0xF6, 0xDE, 0xF6, 0x00, 247 | 0xC6, 0xC6, 0xC6, 0xF6, 0xDE, 0xDE, 0xF6, 0x00, 248 | 0x00, 0x00, 0x7C, 0xC6, 0x1C, 0xC6, 0x7C, 0x00, 249 | 0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, 250 | 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 251 | 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 252 | 0x00, 0x00, 0x7C, 0xC6, 0x1E, 0xC6, 0x7C, 0x00, 253 | 0x78, 0x8C, 0x06, 0x3E, 0x06, 0x8C, 0x78, 0x00, 254 | 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, 255 | 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, 256 | 0x00, 0x00, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x00, 257 | 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x00, 258 | 0x3E, 0x61, 0x3C, 0x66, 0x66, 0x3C, 0x86, 0x7C, 259 | 0x00, 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 0x00, 0x00, 260 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 261 | }; -------------------------------------------------------------------------------- /src/TVoutfonts/font8x8ext.h: -------------------------------------------------------------------------------- 1 | #ifndef FONT8X8EXT_H 2 | #define FONT8X8EXT_H 3 | 4 | #include 5 | extern const unsigned char font8x8ext[]; 6 | 7 | #endif -------------------------------------------------------------------------------- /src/TVoutfonts/fontALL.h: -------------------------------------------------------------------------------- 1 | #ifndef FONTALL_H 2 | #define FONTALL_H 3 | 4 | #include "TVoutfonts/font4x6.h" 5 | #include "TVoutfonts/font6x8.h" 6 | #include "TVoutfonts/font8x8.h" 7 | #include "TVoutfonts/font8x8ext.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /src/spec/asm_macros.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include "hardware_setup.h" 27 | 28 | #ifndef ASM_MACROS_H 29 | #define ASM_MACROS_H 30 | 31 | // delay macros 32 | __asm__ __volatile__ ( 33 | // delay 1 clock cycle. 34 | ".macro delay1\n\t" 35 | "nop\n" 36 | ".endm\n" 37 | 38 | // delay 2 clock cycles 39 | ".macro delay2\n\t" 40 | "nop\n\t" 41 | "nop\n" 42 | ".endm\n" 43 | 44 | // delay 3 clock cyles 45 | ".macro delay3\n\t" 46 | "nop\n\t" 47 | "nop\n\t" 48 | "nop\n" 49 | ".endm\n" 50 | 51 | // delay 4 clock cylces 52 | ".macro delay4\n\t" 53 | "nop\n\t" 54 | "nop\n\t" 55 | "nop\n\t" 56 | "nop\n" 57 | ".endm\n" 58 | 59 | // delay 5 clock cylces 60 | ".macro delay5\n\t" 61 | "nop\n\t" 62 | "nop\n\t" 63 | "nop\n\t" 64 | "nop\n\t" 65 | "nop\n" 66 | ".endm\n" 67 | 68 | // delay 6 clock cylces 69 | ".macro delay6\n\t" 70 | "nop\n\t" 71 | "nop\n\t" 72 | "nop\n\t" 73 | "nop\n\t" 74 | "nop\n\t" 75 | "nop\n" 76 | ".endm\n" 77 | 78 | // delay 7 clock cylces 79 | ".macro delay7\n\t" 80 | "nop\n\t" 81 | "nop\n\t" 82 | "nop\n\t" 83 | "nop\n\t" 84 | "nop\n\t" 85 | "nop\n\t" 86 | "nop\n" 87 | ".endm\n" 88 | 89 | // delay 8 clock cylces 90 | ".macro delay8\n\t" 91 | "nop\n\t" 92 | "nop\n\t" 93 | "nop\n\t" 94 | "nop\n\t" 95 | "nop\n\t" 96 | "nop\n\t" 97 | "nop\n\t" 98 | "nop\n" 99 | ".endm\n" 100 | 101 | // delay 9 clock cylces 102 | ".macro delay9\n\t" 103 | "nop\n\t" 104 | "nop\n\t" 105 | "nop\n\t" 106 | "nop\n\t" 107 | "nop\n\t" 108 | "nop\n\t" 109 | "nop\n\t" 110 | "nop\n\t" 111 | "nop\n" 112 | ".endm\n" 113 | 114 | // delay 10 clock cylces 115 | ".macro delay10\n\t" 116 | "nop\n\t" 117 | "nop\n\t" 118 | "nop\n\t" 119 | "nop\n\t" 120 | "nop\n\t" 121 | "nop\n\t" 122 | "nop\n\t" 123 | "nop\n\t" 124 | "nop\n\t" 125 | "nop\n" 126 | ".endm\n" 127 | ); // end of delay macros 128 | 129 | // common output macros, specific output macros at top of file 130 | __asm__ __volatile__ ( 131 | 132 | // save port 16 and clear the video bit 133 | ".macro svprt p\n\t" 134 | "in r16,\\p\n\t" 135 | ANDI_HWS 136 | ".endm\n" 137 | 138 | // ouput 1 bit port safe 139 | ".macro o1bs p\n\t" 140 | BLD_HWS 141 | "out \\p,r16\n" 142 | ".endm\n" 143 | ); // end of output macros 144 | #endif -------------------------------------------------------------------------------- /src/spec/hardware_setup.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | // sound is output on OC2A 27 | // sync output is on OC1A 28 | 29 | //ENABLE_FAST_OUTPUT chooses the highest bit of a port over the original output method 30 | //comment out this line to switch back to the original output pins. 31 | #define ENABLE_FAST_OUTPUT 32 | 33 | #ifndef HARDWARE_SETUP_H 34 | #define HARDWARE_SETUP_H 35 | 36 | // device specific settings. 37 | #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) 38 | #if defined(ENABLE_FAST_OUTPUT) 39 | #define PORT_VID PORTA 40 | #define DDR_VID DDRA 41 | #define VID_PIN 7 42 | #else 43 | //video 44 | #define PORT_VID PORTB 45 | #define DDR_VID DDRB 46 | #define VID_PIN 6 47 | #endif 48 | //sync 49 | #define PORT_SYNC PORTB 50 | #define DDR_SYNC DDRB 51 | #define SYNC_PIN 5 52 | //sound 53 | #define PORT_SND PORTB 54 | #define DDR_SND DDRB 55 | #define SND_PIN 4 56 | 57 | #elif defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) 58 | //video 59 | #if defined(ENABLE_FAST_OUTPUT) 60 | #define PORT_VID PORTA 61 | #define DDR_VID DDRA 62 | #define VID_PIN 7 63 | #else 64 | #define PORT_VID PORTD 65 | #define DDR_VID DDRD 66 | #define VID_PIN 4 67 | #endif 68 | //sync 69 | #define PORT_SYNC PORTD 70 | #define DDR_SYNC DDRD 71 | #define SYNC_PIN 5 72 | //sound 73 | #define PORT_SND PORTD 74 | #define DDR_SND DDRD 75 | #define SND_PIN 7 76 | 77 | #elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) || defined(__AVR_ATmega168P__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) 78 | //video 79 | #if defined(ENABLE_FAST_OUTPUT) 80 | #define PORT_VID PORTD 81 | #define DDR_VID DDRD 82 | #define VID_PIN 7 83 | #else 84 | #define PORT_VID PORTB 85 | #define DDR_VID DDRB 86 | #define VID_PIN 0 87 | #endif 88 | //sync 89 | #define PORT_SYNC PORTB 90 | #define DDR_SYNC DDRB 91 | #define SYNC_PIN 1 92 | //sound 93 | #define PORT_SND PORTB 94 | #define DDR_SND DDRB 95 | #define SND_PIN 3 96 | 97 | #elif defined (__AVR_AT90USB1286__) 98 | //video 99 | #define PORT_VID PORTF 100 | #define DDR_VID DDRF 101 | #define VID_PIN 7 102 | //sync 103 | #define PORT_SYNC PORTB 104 | #define DDR_SYNC DDRB 105 | #define SYNC_PIN 5 106 | //sound 107 | #define PORT_SND PORTB 108 | #define DDR_SND DDRB 109 | #define SND_PIN 4 110 | #elif defined(__AVR_ATmega32U4__) // Modified for Arduino Leonardo 111 | //video 112 | #define PORT_VID PORTB 113 | #define DDR_VID DDRB 114 | #define VID_PIN 4 // 8 115 | //sync 116 | #define PORT_SYNC PORTB 117 | #define DDR_SYNC DDRB 118 | #define SYNC_PIN 5 // 9 119 | //sound 120 | #define PORT_SND PORTB 121 | #define DDR_SND DDRB 122 | #define SND_PIN 7 // 11 123 | #define TCCR2A TCCR0A 124 | #define TCCR2B TCCR0B 125 | #define OCR2A OCR0A 126 | #define OCR2B OCR0B 127 | #define COM2A0 COM0A0 128 | #define COM2A1 COM0A1 129 | #define CS20 CS00 130 | #define WGM21 WGM01 131 | #endif 132 | 133 | //automatic BST/BLD/ANDI macro definition 134 | #if VID_PIN == 0 135 | #define BLD_HWS "bld r16,0\n\t" 136 | #define BST_HWS "bst r16,0\n\t" 137 | #define ANDI_HWS "andi r16,0xFE\n" 138 | #elif VID_PIN == 1 139 | #define BLD_HWS "bld r16,1\n\t" 140 | #define BST_HWS "bst r16,1\n\t" 141 | #define ANDI_HWS "andi r16,0xFD\n" 142 | #elif VID_PIN == 2 143 | #define BLD_HWS "bld r16,2\n\t" 144 | #define BST_HWS "bst r16,2\n\t" 145 | #define ANDI_HWS "andi r16,0xFB\n" 146 | #elif VID_PIN == 3 147 | #define BLD_HWS "bld r16,3\n\t" 148 | #define BST_HWS "bst r16,3\n\t" 149 | #define ANDI_HWS "andi r16,0xF7\n" 150 | #elif VID_PIN == 4 151 | #define BLD_HWS "bld r16,4\n\t" 152 | #define BST_HWS "bst r16,4\n\t" 153 | #define ANDI_HWS "andi r16,0xEF\n" 154 | #elif VID_PIN == 5 155 | #define BLD_HWS "bld r16,5\n\t" 156 | #define BST_HWS "bst r16,5\n\t" 157 | #define ANDI_HWS "andi r16,0xDF\n" 158 | #elif VID_PIN == 6 159 | #define BLD_HWS "bld r16,6\n\t" 160 | #define BST_HWS "bst r16,6\n\t" 161 | #define ANDI_HWS "andi r16,0xBF\n" 162 | #elif VID_PIN == 7 163 | #define BLD_HWS "bld r16,7\n\t" 164 | #define BST_HWS "bst r16,7\n\t" 165 | #define ANDI_HWS "andi r16,0x7F\n" 166 | #endif 167 | #endif 168 | -------------------------------------------------------------------------------- /src/spec/video_properties.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | /* 27 | This File contains the timing definitions for the TVout AVR composite video 28 | generation Library 29 | */ 30 | #ifndef VIDEO_TIMING_H 31 | #define VIDEO_TIMING_H 32 | 33 | #define _CYCLES_PER_US (F_CPU / 1000000) 34 | 35 | 36 | 37 | /* 38 | Analog Video Vertical Sync (NTSC): https://www.youtube.com/watch?v=NY2rIjkH1Xw 39 | PAL video timing specification: http://martin.hinner.info/vga/pal.html 40 | Field Synchronization of PAL System: http://martin.hinner.info/vga/pal.gif 41 | Field Synchronization of NTSC System: http://martin.hinner.info/vga/ntsc.gif 42 | */ 43 | 44 | // Timing settings for NTSC 45 | #define _NTSC_LINE_FULL_FRAME 525 // lines 46 | #define _NTSC_LINE_FRAME (_NTSC_LINE_FULL_FRAME / 2) // 262 lines 47 | 48 | #define _NTSC_TIME_RENDERING_LINE 46 // µs 49 | #define _NTSC_LINE_DISPLAY 216 // lines 50 | #define _NTSC_LINE_MID ((_NTSC_LINE_FRAME - _NTSC_LINE_DISPLAY) / 2 + _NTSC_LINE_DISPLAY / 2) // lines 51 | 52 | #define _NTSC_TIME_SCANLINE 63.563 // 63.5 µs 53 | #define _NTSC_TIME_HSYNC_PULSE 4.7 // 4.7 µs 54 | #define _NTSC_TIME_OUTPUT_START 12.5 // 10.9 + 0.5 µs + ... 55 | 56 | #define _NTSC_CYCLES_SCANLINE ((_NTSC_TIME_SCANLINE * _CYCLES_PER_US) - 1) 57 | #define _NTSC_CYCLES_HSYNC_PULSE ((_NTSC_TIME_HSYNC_PULSE * _CYCLES_PER_US) - 1) 58 | #define _NTSC_CYCLES_OUTPUT_START ((_NTSC_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) 59 | 60 | #define _NTSC_TIME_VSYNC_SCANLINE (_NTSC_TIME_SCANLINE / 2) // µs 61 | #define _NTSC_TIME_VSYNC_PRE_EQUALIZING_PULSE 2.3 // 2.3 µs 62 | #define _NTSC_TIME_VSYNC_PULSE 27.1 // 27.1 µs 63 | 64 | #define _NTSC_CYCLES_VSYNC_SCANLINE ((_NTSC_TIME_VSYNC_SCANLINE * _CYCLES_PER_US) - 1) 65 | #define _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE ((_NTSC_TIME_VSYNC_PRE_EQUALIZING_PULSE * _CYCLES_PER_US) - 1) 66 | #define _NTSC_CYCLES_VSYNC_PULSE ((_NTSC_TIME_VSYNC_PULSE * _CYCLES_PER_US) - 1) 67 | 68 | #define _NTSC_LINE_FIRSTFRAME_END 263 // 262 line# 69 | #define _NTSC_LINE_SECONDFRAME_START 272 // 271 line# 70 | 71 | #define _NTSC_LINE_SECONDFRAME_END 525 // 525 line# 72 | #define _NTSC_LINE_FIRSTFRAME_START 10 // 9 line# 73 | 74 | 75 | 76 | // Timing settings for PAL 77 | #define _PAL_LINE_FULL_FRAME 625 // lines 78 | #define _PAL_LINE_FRAME 312 // 312 lines 79 | 80 | #define _PAL_TIME_RENDERING_LINE 46 // µs 81 | #define _PAL_LINE_DISPLAY 260 // lines 82 | #define _PAL_LINE_MID ((_PAL_LINE_FRAME - _PAL_LINE_DISPLAY) / 2 + _PAL_LINE_DISPLAY / 2) // lines 83 | 84 | #define _PAL_TIME_SCANLINE 64 // 64 µs 85 | #define _PAL_TIME_HSYNC_PULSE 4.7 // 4.7 µs 86 | #define _PAL_TIME_OUTPUT_START 12.5 // 12.05 + 0.45 µs 87 | 88 | #define _PAL_CYCLES_SCANLINE ((_PAL_TIME_SCANLINE * _CYCLES_PER_US) - 1) 89 | #define _PAL_CYCLES_HSYNC_PULSE ((_PAL_TIME_HSYNC_PULSE * _CYCLES_PER_US) - 1) 90 | #define _PAL_CYCLES_OUTPUT_START ((_PAL_TIME_OUTPUT_START * _CYCLES_PER_US) - 1) 91 | 92 | #define _PAL_TIME_VSYNC_SCANLINE (_PAL_TIME_SCANLINE / 2) // µs 93 | #define _PAL_TIME_VSYNC_PRE_EQUALIZING_PULSE 2.38 // 2.35 µs 94 | #define _PAL_TIME_VSYNC_PULSE 27.32 // 27.3 µs 95 | 96 | #define _PAL_CYCLES_VSYNC_SCANLINE ((_PAL_TIME_VSYNC_SCANLINE * _CYCLES_PER_US) - 1) 97 | #define _PAL_CYCLES_VSYNC_EQUALIZING_PULSE ((_PAL_TIME_VSYNC_PRE_EQUALIZING_PULSE * _CYCLES_PER_US) - 1) 98 | #define _PAL_CYCLES_VSYNC_PULSE ((_PAL_TIME_VSYNC_PULSE * _CYCLES_PER_US) - 1) 99 | 100 | #define _PAL_LINE_FIRSTFRAME_END 311 // line# 310 101 | #define _PAL_LINE_SECONDFRAME_START 318 // line# 317 102 | 103 | #define _PAL_LINE_SECONDFRAME_END 624 // line# 622 104 | #define _PAL_LINE_FIRSTFRAME_START 6 // line# 5 105 | 106 | #endif -------------------------------------------------------------------------------- /src/video_gen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #include 27 | #include 28 | 29 | #include "video_gen.h" 30 | #include "spec/video_properties.h" 31 | #include "spec/asm_macros.h" 32 | #include "spec/hardware_setup.h" 33 | 34 | //#define REMOVE6C 35 | //#define REMOVE5C 36 | //#define REMOVE4C 37 | //#define REMOVE3C 38 | 39 | int renderLine; 40 | TVout_vid display; 41 | void (*render_line)(); //remove me 42 | void (*line_handler)(); //remove me 43 | void (*hbi_hook)() = ∅ 44 | void (*vbi_hook)() = ∅ 45 | 46 | // sound properties 47 | volatile long remainingToneVsyncs; 48 | 49 | // forward declaration 50 | static void inline wait_until(uint8_t time); 51 | 52 | void empty() {} 53 | 54 | void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr) { 55 | display.screen = scrnptr; 56 | display.hres = x; 57 | display.vres = y; 58 | display.frames = 0; 59 | display.size = x * y; 60 | 61 | if (mode & PAL) 62 | display.vscale_const = _PAL_LINE_DISPLAY/display.vres - 1; 63 | else 64 | display.vscale_const = _NTSC_LINE_DISPLAY/display.vres - 1; 65 | display.vscale = display.vscale_const; 66 | 67 | //selects the widest render method that fits in 46us 68 | //as of 9/16/10 rendermode 3 will not work for resolutions lower than 69 | //192(display.hres lower than 24) 70 | unsigned char rmethod; 71 | if (mode == PAL) { 72 | rmethod = (_PAL_TIME_RENDERING_LINE * _CYCLES_PER_US) / (display.hres * 8); // re: 46 µs * 16 / (16 * 8) = 5.75 ticks per pixel 73 | } 74 | else { 75 | rmethod = (_NTSC_TIME_RENDERING_LINE * _CYCLES_PER_US) / (display.hres * 8); // re: 46 µs * 16 / (16 * 8) = 5.75 ticks per pixel 76 | } 77 | switch(rmethod) { 78 | case 6: 79 | render_line = &render_line6c; 80 | break; 81 | case 5: 82 | render_line = &render_line5c; 83 | break; 84 | case 4: 85 | render_line = &render_line4c; 86 | break; 87 | case 3: 88 | render_line = &render_line3c; 89 | break; 90 | default: 91 | if (rmethod > 6) 92 | render_line = &render_line6c; 93 | else 94 | render_line = &render_line3c; 95 | } 96 | DDR_VID |= _BV(VID_PIN); 97 | DDR_SYNC |= _BV(SYNC_PIN); 98 | PORT_VID &= ~_BV(VID_PIN); 99 | PORT_SYNC |= _BV(SYNC_PIN); 100 | DDR_SND |= _BV(SND_PIN); // for tone generation. 101 | 102 | if (mode & PAL) { 103 | display.output_delay = _PAL_CYCLES_OUTPUT_START; 104 | display.lines_frame = _PAL_LINE_FRAME; 105 | 106 | display.first_frame_start_render_line = _PAL_LINE_MID - (display.vres * (display.vscale_const + 1)) / 2; 107 | display.first_frame_end_render_line = display.first_frame_start_render_line + (display.vres * (display.vscale_const + 1)); 108 | display.second_frame_start_render_line = display.lines_frame + display.first_frame_start_render_line; 109 | display.second_frame_end_render_line = display.lines_frame + display.first_frame_end_render_line; 110 | 111 | ICR1 = _PAL_CYCLES_VSYNC_SCANLINE; 112 | OCR1A = _PAL_CYCLES_VSYNC_EQUALIZING_PULSE; 113 | } 114 | else { // NTSC 115 | display.output_delay = _NTSC_CYCLES_OUTPUT_START; 116 | display.lines_frame = _NTSC_LINE_FRAME; 117 | 118 | display.first_frame_start_render_line = _NTSC_LINE_MID - (display.vres * (display.vscale_const + 1)) / 2; 119 | display.first_frame_end_render_line = display.first_frame_start_render_line + (display.vres * (display.vscale_const + 1)); 120 | display.second_frame_start_render_line = display.lines_frame + display.first_frame_start_render_line; 121 | display.second_frame_end_render_line = display.lines_frame + display.first_frame_end_render_line; 122 | 123 | ICR1 = _NTSC_CYCLES_VSYNC_SCANLINE; 124 | OCR1A = _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE; 125 | } 126 | 127 | display.vsyncScanLine = 0; 128 | display.scanLine = 0; 129 | 130 | if (mode & OVERLAY) { 131 | line_handler = ∅ 132 | // Enable timer1. ICES0 is set to 0 for falling edge detection on input capture pin. 133 | TCCR1A = 0; 134 | TCCR1B = _BV(CS10); 135 | 136 | // Enable input capture interrupt 137 | TIMSK1 |= _BV(ICIE1); 138 | 139 | // Enable external interrupt INT0 on pin 2 with falling edge. 140 | EIMSK = _BV(INT0); 141 | EICRA = _BV(ISC11); 142 | } else { 143 | line_handler = &first_frame_vsync_lines; 144 | // inverted fast pwm mode on timer 1 145 | TCCR1A = _BV(COM1A1) | _BV(COM1A0) | _BV(WGM11); 146 | TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); 147 | TIMSK1 = _BV(TOIE1); 148 | } 149 | 150 | sei(); 151 | } 152 | 153 | // render a line when we get a line timer overflow (generated sync mode) 154 | ISR(TIMER1_OVF_vect) { 155 | hbi_hook(); 156 | line_handler(); 157 | } 158 | 159 | // render a line when we get a horizonal sync pulse (overlay mode) 160 | ISR(TIMER1_CAPT_vect) { 161 | TCNT1 -= ICR1; 162 | hbi_hook(); 163 | line_handler(); 164 | } 165 | 166 | // reset the scan line when we get a vertical sync (overlay mode) 167 | ISR(INT0_vect) { 168 | if (display.scanLine != 0) { 169 | display.frames++; 170 | if (remainingToneVsyncs > 0) { 171 | if (--remainingToneVsyncs == 0) { 172 | TCCR2B = 0; //stop the tone 173 | PORTB &= ~(_BV(SND_PIN)); 174 | } 175 | } 176 | } 177 | display.scanLine = 0; 178 | line_handler = &overlay_blank_line; 179 | } 180 | 181 | void first_frame_vsync_lines() { 182 | display.vsyncScanLine++; 183 | 184 | if (display.lines_frame == _PAL_LINE_FRAME) { 185 | 186 | if (display.vsyncScanLine == 5) { 187 | OCR1A = _PAL_CYCLES_VSYNC_PULSE; 188 | } 189 | else if (display.vsyncScanLine == 10) { 190 | OCR1A = _PAL_CYCLES_VSYNC_EQUALIZING_PULSE; 191 | } 192 | else if (display.vsyncScanLine == 15) { 193 | ICR1 = _PAL_CYCLES_SCANLINE; 194 | OCR1A = _PAL_CYCLES_HSYNC_PULSE; 195 | 196 | display.scanLine = _PAL_LINE_FIRSTFRAME_START; 197 | line_handler = &first_frame_blank_line; 198 | } 199 | } 200 | else { 201 | if (display.vsyncScanLine == 6) { 202 | OCR1A = _NTSC_CYCLES_VSYNC_PULSE; 203 | } 204 | else if (display.vsyncScanLine == 12) { 205 | OCR1A = _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE; 206 | } 207 | else if (display.vsyncScanLine == 18) { 208 | ICR1 = _NTSC_CYCLES_SCANLINE; 209 | OCR1A = _NTSC_CYCLES_HSYNC_PULSE; 210 | 211 | display.scanLine = _NTSC_LINE_FIRSTFRAME_START; 212 | line_handler = &first_frame_blank_line; 213 | } 214 | } 215 | } 216 | 217 | void first_frame_blank_line() { 218 | display.scanLine++; 219 | 220 | if (display.lines_frame == _PAL_LINE_FRAME) { 221 | if (display.scanLine == _PAL_LINE_FIRSTFRAME_END) { 222 | ICR1 = _PAL_CYCLES_VSYNC_SCANLINE; 223 | OCR1A = _PAL_CYCLES_VSYNC_EQUALIZING_PULSE; 224 | 225 | line_handler = &second_frame_vsync_lines; 226 | display.vsyncScanLine = 0; 227 | } 228 | } 229 | else { 230 | if (display.scanLine == (_NTSC_LINE_FIRSTFRAME_END - 1)) { 231 | ICR1 = _NTSC_CYCLES_VSYNC_SCANLINE; 232 | } 233 | else if (display.scanLine == _NTSC_LINE_FIRSTFRAME_END) { 234 | OCR1A = _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE; 235 | 236 | line_handler = &second_frame_vsync_lines; 237 | display.vsyncScanLine = 0; 238 | } 239 | } 240 | 241 | if (display.scanLine == display.first_frame_start_render_line) { 242 | renderLine = 0; 243 | display.vscale = display.vscale_const; 244 | line_handler = &first_frame_active_line; 245 | 246 | if (remainingToneVsyncs > 0) { 247 | if (--remainingToneVsyncs == 0) { 248 | TCCR2B = 0; //stop the tone 249 | PORTB &= ~(_BV(SND_PIN)); 250 | } 251 | } 252 | 253 | vbi_hook(); 254 | } 255 | } 256 | 257 | void first_frame_active_line() { 258 | display.scanLine++; 259 | 260 | wait_until(display.output_delay); 261 | render_line(); 262 | 263 | if (display.vscale == 0) { 264 | display.vscale = display.vscale_const; 265 | renderLine += display.hres; 266 | } 267 | else { 268 | display.vscale--; 269 | } 270 | 271 | if (display.scanLine == display.first_frame_end_render_line) { 272 | display.frames++; 273 | line_handler = &first_frame_blank_line; 274 | } 275 | } 276 | 277 | void second_frame_vsync_lines() { 278 | display.vsyncScanLine++; 279 | 280 | if (display.lines_frame == _PAL_LINE_FRAME) { 281 | 282 | if (display.vsyncScanLine == 5) { 283 | OCR1A = _PAL_CYCLES_VSYNC_PULSE; 284 | } 285 | else if (display.vsyncScanLine == 10) { 286 | OCR1A = _PAL_CYCLES_VSYNC_EQUALIZING_PULSE; 287 | } 288 | else if (display.vsyncScanLine == 14) { 289 | ICR1 = _PAL_CYCLES_SCANLINE; 290 | OCR1A = _PAL_CYCLES_HSYNC_PULSE; 291 | 292 | display.scanLine = _PAL_LINE_SECONDFRAME_START; 293 | line_handler = &second_frame_blank_line; 294 | } 295 | } 296 | else { 297 | 298 | if (display.vsyncScanLine == 6) { 299 | OCR1A = _NTSC_CYCLES_VSYNC_PULSE; 300 | } 301 | else if (display.vsyncScanLine == 12) { 302 | OCR1A = _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE; 303 | } 304 | else if (display.vsyncScanLine == 17) { 305 | ICR1 = _NTSC_CYCLES_SCANLINE; 306 | } 307 | else if (display.vsyncScanLine == 18) { 308 | OCR1A = _NTSC_CYCLES_HSYNC_PULSE; 309 | 310 | display.scanLine = _NTSC_LINE_SECONDFRAME_START; 311 | line_handler = &second_frame_blank_line; 312 | } 313 | } 314 | } 315 | 316 | void second_frame_blank_line() { 317 | display.scanLine++; 318 | 319 | if (display.lines_frame == _PAL_LINE_FRAME) { 320 | if (display.scanLine == (_PAL_LINE_SECONDFRAME_END - 1)) { 321 | ICR1 = _PAL_CYCLES_VSYNC_SCANLINE; 322 | } 323 | else if (display.scanLine == _PAL_LINE_SECONDFRAME_END) { 324 | OCR1A = _PAL_CYCLES_VSYNC_EQUALIZING_PULSE; 325 | 326 | line_handler = &first_frame_vsync_lines; 327 | display.vsyncScanLine = 0; 328 | } 329 | } 330 | else { 331 | if (display.scanLine == _NTSC_LINE_SECONDFRAME_END) { 332 | ICR1 = _NTSC_CYCLES_VSYNC_SCANLINE; 333 | OCR1A = _NTSC_CYCLES_VSYNC_EQUALIZING_PULSE; 334 | 335 | line_handler = &first_frame_vsync_lines; 336 | display.vsyncScanLine = 0; 337 | } 338 | } 339 | 340 | if (display.scanLine == display.second_frame_start_render_line) { 341 | renderLine = 0; 342 | display.vscale = display.vscale_const; 343 | line_handler = &second_frame_active_line; 344 | 345 | if (remainingToneVsyncs > 0) { 346 | if (--remainingToneVsyncs == 0) { 347 | TCCR2B = 0; //stop the tone 348 | PORTB &= ~(_BV(SND_PIN)); 349 | } 350 | } 351 | 352 | vbi_hook(); 353 | } 354 | } 355 | 356 | void second_frame_active_line() { 357 | display.scanLine++; 358 | 359 | wait_until(display.output_delay); 360 | render_line(); 361 | 362 | if (display.vscale == 0) { 363 | display.vscale = display.vscale_const; 364 | renderLine += display.hres; 365 | } 366 | else { 367 | display.vscale--; 368 | } 369 | 370 | if (display.scanLine == display.second_frame_end_render_line) { 371 | display.frames++; 372 | line_handler = &second_frame_blank_line; 373 | } 374 | } 375 | 376 | 377 | void overlay_blank_line() { 378 | display.scanLine++; 379 | 380 | if ( display.scanLine == display.first_frame_start_render_line) { 381 | renderLine = 0; 382 | display.vscale = display.vscale_const; 383 | line_handler = &overlay_active_line; 384 | } 385 | else if (display.scanLine > display.first_frame_end_render_line) { 386 | line_handler = ∅ 387 | vbi_hook(); 388 | } 389 | } 390 | 391 | void overlay_active_line() { 392 | display.scanLine++; 393 | 394 | wait_until(display.output_delay); 395 | render_line(); 396 | 397 | if (display.vscale == 0) { 398 | display.vscale = display.vscale_const; 399 | renderLine += display.hres; 400 | } 401 | else { 402 | display.vscale--; 403 | } 404 | 405 | if (display.scanLine == display.first_frame_end_render_line) { 406 | line_handler = &overlay_blank_line; 407 | } 408 | } 409 | 410 | static void inline wait_until(uint8_t time) { 411 | __asm__ __volatile__ ( 412 | "subi %[time], 10\n" 413 | "sub %[time], %[tcnt1l]\n\t" 414 | "100:\n\t" 415 | "subi %[time], 3\n\t" 416 | "brcc 100b\n\t" 417 | "subi %[time], 0-3\n\t" 418 | "breq 101f\n\t" 419 | "dec %[time]\n\t" 420 | "breq 102f\n\t" 421 | "rjmp 102f\n" 422 | "101:\n\t" 423 | "nop\n" 424 | "102:\n" 425 | : 426 | : [time] "a" (time), 427 | [tcnt1l] "a" (TCNT1L) 428 | ); 429 | } 430 | 431 | void render_line6c() { 432 | #ifndef REMOVE6C 433 | __asm__ __volatile__ ( 434 | "ADD r26,r28\n\t" 435 | "ADC r27,r29\n\t" 436 | //save PORTB 437 | "svprt %[port]\n\t" 438 | 439 | "rjmp enter6\n" 440 | "loop6:\n\t" 441 | "bst __tmp_reg__,0\n\t" //8 442 | "o1bs %[port]\n" 443 | "enter6:\n\t" 444 | "LD __tmp_reg__,X+\n\t" //1 445 | "delay1\n\t" 446 | "bst __tmp_reg__,7\n\t" 447 | "o1bs %[port]\n\t" 448 | "delay3\n\t" //2 449 | "bst __tmp_reg__,6\n\t" 450 | "o1bs %[port]\n\t" 451 | "delay3\n\t" //3 452 | "bst __tmp_reg__,5\n\t" 453 | "o1bs %[port]\n\t" 454 | "delay3\n\t" //4 455 | "bst __tmp_reg__,4\n\t" 456 | "o1bs %[port]\n\t" 457 | "delay3\n\t" //5 458 | "bst __tmp_reg__,3\n\t" 459 | "o1bs %[port]\n\t" 460 | "delay3\n\t" //6 461 | "bst __tmp_reg__,2\n\t" 462 | "o1bs %[port]\n\t" 463 | "delay3\n\t" //7 464 | "bst __tmp_reg__,1\n\t" 465 | "o1bs %[port]\n\t" 466 | "dec %[hres]\n\t" 467 | "brne loop6\n\t" //go too loopsix 468 | "delay2\n\t" 469 | "bst __tmp_reg__,0\n\t" //8 470 | "o1bs %[port]\n" 471 | 472 | "svprt %[port]\n\t" 473 | BST_HWS 474 | "o1bs %[port]\n\t" 475 | : 476 | : [port] "i" (_SFR_IO_ADDR(PORT_VID)), 477 | "x" (display.screen), 478 | "y" (renderLine), 479 | [hres] "d" (display.hres) 480 | : "r16" // try to remove this clobber later... 481 | ); 482 | #endif 483 | } 484 | 485 | void render_line5c() { 486 | #ifndef REMOVE5C 487 | __asm__ __volatile__ ( 488 | "ADD r26,r28\n\t" 489 | "ADC r27,r29\n\t" 490 | //save PORTB 491 | "svprt %[port]\n\t" 492 | 493 | "rjmp enter5\n" 494 | "loop5:\n\t" 495 | "bst __tmp_reg__,0\n\t" //8 496 | "o1bs %[port]\n" 497 | "enter5:\n\t" 498 | "LD __tmp_reg__,X+\n\t" //1 499 | "bst __tmp_reg__,7\n\t" 500 | "o1bs %[port]\n\t" 501 | "delay2\n\t" //2 502 | "bst __tmp_reg__,6\n\t" 503 | "o1bs %[port]\n\t" 504 | "delay2\n\t" //3 505 | "bst __tmp_reg__,5\n\t" 506 | "o1bs %[port]\n\t" 507 | "delay2\n\t" //4 508 | "bst __tmp_reg__,4\n\t" 509 | "o1bs %[port]\n\t" 510 | "delay2\n\t" //5 511 | "bst __tmp_reg__,3\n\t" 512 | "o1bs %[port]\n\t" 513 | "delay2\n\t" //6 514 | "bst __tmp_reg__,2\n\t" 515 | "o1bs %[port]\n\t" 516 | "delay1\n\t" //7 517 | "dec %[hres]\n\t" 518 | "bst __tmp_reg__,1\n\t" 519 | "o1bs %[port]\n\t" 520 | "brne loop5\n\t" //go too loop5 521 | "delay1\n\t" 522 | "bst __tmp_reg__,0\n\t" //8 523 | "o1bs %[port]\n" 524 | 525 | "svprt %[port]\n\t" 526 | BST_HWS 527 | "o1bs %[port]\n\t" 528 | : 529 | : [port] "i" (_SFR_IO_ADDR(PORT_VID)), 530 | "x" (display.screen), 531 | "y" (renderLine), 532 | [hres] "d" (display.hres) 533 | : "r16" // try to remove this clobber later... 534 | ); 535 | #endif 536 | } 537 | 538 | void render_line4c() { 539 | #ifndef REMOVE4C 540 | __asm__ __volatile__ ( 541 | "ADD r26,r28\n\t" 542 | "ADC r27,r29\n\t" 543 | 544 | "rjmp enter4\n" 545 | "loop4:\n\t" 546 | "lsl __tmp_reg__\n\t" //8 547 | "out %[port],__tmp_reg__\n\t" 548 | "enter4:\n\t" 549 | "LD __tmp_reg__,X+\n\t" //1 550 | "delay1\n\t" 551 | "out %[port],__tmp_reg__\n\t" 552 | "delay2\n\t" //2 553 | "lsl __tmp_reg__\n\t" 554 | "out %[port],__tmp_reg__\n\t" 555 | "delay2\n\t" //3 556 | "lsl __tmp_reg__\n\t" 557 | "out %[port],__tmp_reg__\n\t" 558 | "delay2\n\t" //4 559 | "lsl __tmp_reg__\n\t" 560 | "out %[port],__tmp_reg__\n\t" 561 | "delay2\n\t" //5 562 | "lsl __tmp_reg__\n\t" 563 | "out %[port],__tmp_reg__\n\t" 564 | "delay2\n\t" //6 565 | "lsl __tmp_reg__\n\t" 566 | "out %[port],__tmp_reg__\n\t" 567 | "delay1\n\t" //7 568 | "lsl __tmp_reg__\n\t" 569 | "dec %[hres]\n\t" 570 | "out %[port],__tmp_reg__\n\t" 571 | "brne loop4\n\t" //go too loop4 572 | "delay1\n\t" //8 573 | "lsl __tmp_reg__\n\t" 574 | "out %[port],__tmp_reg__\n\t" 575 | "delay3\n\t" 576 | "cbi %[port],7\n\t" 577 | : 578 | : [port] "i" (_SFR_IO_ADDR(PORT_VID)), 579 | "x" (display.screen), 580 | "y" (renderLine), 581 | [hres] "d" (display.hres) 582 | : "r16" // try to remove this clobber later... 583 | ); 584 | #endif 585 | } 586 | 587 | // only 16mhz right now!!! 588 | void render_line3c() { 589 | #ifndef REMOVE3C 590 | __asm__ __volatile__ ( 591 | ".macro byteshift\n\t" 592 | "LD __tmp_reg__,X+\n\t" 593 | "out %[port],__tmp_reg__\n\t" //0 594 | "nop\n\t" 595 | "lsl __tmp_reg__\n\t" 596 | "out %[port],__tmp_reg__\n\t" //1 597 | "nop\n\t" 598 | "lsl __tmp_reg__\n\t" 599 | "out %[port],__tmp_reg__\n\t" //2 600 | "nop\n\t" 601 | "lsl __tmp_reg__\n\t" 602 | "out %[port],__tmp_reg__\n\t" //3 603 | "nop\n\t" 604 | "lsl __tmp_reg__\n\t" 605 | "out %[port],__tmp_reg__\n\t" //4 606 | "nop\n\t" 607 | "lsl __tmp_reg__\n\t" 608 | "out %[port],__tmp_reg__\n\t" //5 609 | "nop\n\t" 610 | "lsl __tmp_reg__\n\t" 611 | "out %[port],__tmp_reg__\n\t" //6 612 | "nop\n\t" 613 | "lsl __tmp_reg__\n\t" 614 | "out %[port],__tmp_reg__\n\t" //7 615 | ".endm\n\t" 616 | 617 | "ADD r26,r28\n\t" 618 | "ADC r27,r29\n\t" 619 | 620 | "cpi %[hres],30\n\t" //615 621 | "breq skip0\n\t" 622 | "cpi %[hres],29\n\t" 623 | "breq jumpto1\n\t" 624 | "cpi %[hres],28\n\t" 625 | "breq jumpto2\n\t" 626 | "cpi %[hres],27\n\t" 627 | "breq jumpto3\n\t" 628 | "cpi %[hres],26\n\t" 629 | "breq jumpto4\n\t" 630 | "cpi %[hres],25\n\t" 631 | "breq jumpto5\n\t" 632 | "cpi %[hres],24\n\t" 633 | "breq jumpto6\n\t" 634 | "jumpto1:\n\t" 635 | "rjmp skip1\n\t" 636 | "jumpto2:\n\t" 637 | "rjmp skip2\n\t" 638 | "jumpto3:\n\t" 639 | "rjmp skip3\n\t" 640 | "jumpto4:\n\t" 641 | "rjmp skip4\n\t" 642 | "jumpto5:\n\t" 643 | "rjmp skip5\n\t" 644 | "jumpto6:\n\t" 645 | "rjmp skip6\n\t" 646 | "skip0:\n\t" 647 | "byteshift\n\t" //1 \\643 648 | "skip1:\n\t" 649 | "byteshift\n\t" //2 650 | "skip2:\n\t" 651 | "byteshift\n\t" //3 652 | "skip3:\n\t" 653 | "byteshift\n\t" //4 654 | "skip4:\n\t" 655 | "byteshift\n\t" //5 656 | "skip5:\n\t" 657 | "byteshift\n\t" //6 658 | "skip6:\n\t" 659 | "byteshift\n\t" //7 660 | "byteshift\n\t" //8 661 | "byteshift\n\t" //9 662 | "byteshift\n\t" //10 663 | "byteshift\n\t" //11 664 | "byteshift\n\t" //12 665 | "byteshift\n\t" //13 666 | "byteshift\n\t" //14 667 | "byteshift\n\t" //15 668 | "byteshift\n\t" //16 669 | "byteshift\n\t" //17 670 | "byteshift\n\t" //18 671 | "byteshift\n\t" //19 672 | "byteshift\n\t" //20 673 | "byteshift\n\t" //21 674 | "byteshift\n\t" //22 675 | "byteshift\n\t" //23 676 | "byteshift\n\t" //24 677 | "byteshift\n\t" //25 678 | "byteshift\n\t" //26 679 | "byteshift\n\t" //27 680 | "byteshift\n\t" //28 681 | "byteshift\n\t" //29 682 | "byteshift\n\t" //30 683 | 684 | "delay2\n\t" 685 | "cbi %[port],7\n\t" 686 | : 687 | : [port] "i" (_SFR_IO_ADDR(PORT_VID)), 688 | "x" (display.screen), 689 | "y" (renderLine), 690 | [hres] "d" (display.hres) 691 | : "r16" // try to remove this clobber later... 692 | ); 693 | #endif 694 | } 695 | -------------------------------------------------------------------------------- /src/video_gen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2010 Myles Metzer 3 | 4 | Permission is hereby granted, free of charge, to any person 5 | obtaining a copy of this software and associated documentation 6 | files (the "Software"), to deal in the Software without 7 | restriction, including without limitation the rights to use, 8 | copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 20 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 21 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | #ifndef VIDEO_GEN_H 27 | #define VIDEO_GEN_H 28 | 29 | #define NTSC 0 30 | #define _NTSC 0 31 | #define PAL 1 32 | #define _PAL 1 33 | #define OVERLAY 2 34 | #define _OVERLAY 2 35 | 36 | typedef struct { 37 | volatile int scanLine; 38 | volatile int vsyncScanLine; 39 | volatile unsigned long frames; 40 | int first_frame_start_render_line; 41 | int first_frame_end_render_line; 42 | int second_frame_start_render_line; 43 | int second_frame_end_render_line; 44 | int lines_frame; //remove me 45 | uint8_t vres; 46 | uint8_t hres; 47 | uint16_t size; 48 | uint8_t output_delay; //remove me 49 | char vscale_const; //combine me with status switch 50 | char vscale; //combine me too. 51 | uint8_t * screen; 52 | } TVout_vid; 53 | 54 | extern TVout_vid display; 55 | 56 | extern void (*hbi_hook)(); 57 | extern void (*vbi_hook)(); 58 | 59 | void render_setup(uint8_t mode, uint8_t x, uint8_t y, uint8_t *scrnptr); 60 | 61 | void first_frame_vsync_lines(); 62 | void first_frame_blank_line(); 63 | void first_frame_active_line(); 64 | void second_frame_vsync_lines(); 65 | void second_frame_blank_line(); 66 | void second_frame_active_line(); 67 | void overlay_blank_line(); 68 | void overlay_active_line(); 69 | void empty(); 70 | 71 | //tone generation properties 72 | extern volatile long remainingToneVsyncs; 73 | 74 | // 6cycles functions 75 | void render_line6c(); 76 | void render_line5c(); 77 | void render_line4c(); 78 | void render_line3c(); 79 | #endif 80 | -------------------------------------------------------------------------------- /version history.txt: -------------------------------------------------------------------------------- 1 | R6 (June 2010) (Currently Beta at 5.9): 2 | -transitioned API to a more be more "arduino like", macros were included 3 | maintain compatibility, with the exception of the start_render(mode,x,y) which 4 | has no such compatibility layer. 5 | -created a fill method that will either fill the screen with white or black or 6 | invert the screen. clear_screen() and invert() are now macro calls of fill() 7 | -switched to an 8x8 font because of the simplicity and speed of rendering by the 8 | byte, all character printing is now restricted x's that are multiples of 8 9 | to reflect this x is now taken as a multiple of 8pixels. 10 | -encapsolated all global variables into structs. one for the video portion and 11 | one for the audio portion. 12 | -the interrupt now uses the timer1 overflow vector. Leaving compare match b for 13 | intitiating the rendering(does not do this yet) 14 | -the line handler portion of line interrupt is now handled by a function pointer 15 | and functions that corrispond to each of the 3 possible line types. 16 | -Switched the actual rendering to an assembly loop that will work for resolutions 17 | all the way up to 192pixels(at 16mhz). This cuts off down the required flash 18 | by 1.5kbytes. 19 | -Moved Hardware specific deffinitions to there on hardware_setup.h file. 20 | -fixed the number of lines in the PAL mode, Thanks Lover on arduino.cc forums. 21 | -Added circle function thank you Andy Crook 22 | -Added box function thank you Andy Crook 23 | 24 | R5 (May 27th 2010): 25 | -Fixed a render bug preventing a full white screen 26 | -Fixed the get_pixel function actually works now 27 | -reverted to original version of the draw_line function works correctly now 28 | -added gijs(arduino.cc forums) invert function inverts the whole screen 29 | -added nootropic(arduino.cc forums) tone generation system 30 | -added a full screen bitmap function, very limited will be expanded upon. 31 | 32 | R4.x (May 19th 2010): 33 | -fixed sanguino support, works properly in R4.6 34 | 35 | R4 (May 18th 2010): 36 | -Added support for runtime resolution setup. 37 | -start_render(mode,hres,vres) 38 | -cleaned up the rendering code. 39 | -If speed/low memory usage is required it is recommended that R3 is used and the 40 | resolution is changed in the video_properties.h file. 41 | -Added sanguino support, untested. 42 | 43 | R3 (May 9th 2010): 44 | -Added horz_res(), vert_res(), char_line(), get_pixel(x,y) 45 | -horz_res/vert_res gets resolution of screen 46 | -char_line gets the number of characters that will fit on a line 47 | -get_pixel gets the status of x,y returns 1 for white 0 for black. 48 | -rewrote the line render functions 49 | -fixed bugs preventing changes in resolution and pixel scaling 50 | -automatically centers the screen vertically 51 | -added arduino mega support, untested 52 | -Sync pin: pin11 53 | -Video pin: pin12 54 | -changing the redering resolution is now supported. 55 | to do so change the virtical and horizontal resolution in video_properties.h 56 | -Note: 57 | (_RESOLUTION_HORIZONTAL/8)*_RESOLUTION_VERTICAL 58 | must be less than the amount of memory the arduino has. 59 | 60 | R2 (May 2nd 2010): 61 | -Added PAL support: 62 | -to render in pal call start_render(_PAL); 63 | -to render in NTSC call start_render(_NTSC); 64 | -centered video better. 65 | -reduced system to useing one interupt, this will allow for adding sound, and or 66 | support for polling the UART/SPI/ect. once per scanline. 67 | -now renders full half frames(262 lines) instead of 255 lines for NTSC 68 | -modified fonts to be less horrid looking. 69 | -slightly faster line rendering. 70 | -Fixed issue with line rendering not working on last horizonal pixel 71 | -added support for pausing video; output still issues h sync 72 | -pause: pause_render(); 73 | -resume: resume_render(); 74 | -This does cause a Vsync glitch for the first frame, recovers after 75 | soon. 76 | R1 (April 30th 2010): 77 | Initial release. 78 | --------------------------------------------------------------------------------