Jared DiCarlo
/
manworm_tv_gpu
asdf
Fork of manworm_ticker_tv by
main.cpp@11:537cde55b27f, 2018-05-03 (annotated)
- Committer:
- dicarloj
- Date:
- Thu May 03 23:38:46 2018 +0000
- Revision:
- 11:537cde55b27f
- Parent:
- 10:1163fb31b0a7
- Child:
- 12:e99cc1e9d928
commit before bayleys grayscale thing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dicarloj | 0:7757ab3f7206 | 1 | #include "mbed.h" |
dicarloj | 0:7757ab3f7206 | 2 | #include <math.h> |
dicarloj | 9:2a47b9ff8911 | 3 | #include "lisp.h" |
dicarloj | 9:2a47b9ff8911 | 4 | #include "main.h" |
dicarloj | 9:2a47b9ff8911 | 5 | #include "gfx.h" |
dicarloj | 0:7757ab3f7206 | 6 | |
dicarloj | 9:2a47b9ff8911 | 7 | // Resolution, including porches |
dicarloj | 9:2a47b9ff8911 | 8 | #define V_RES 200 |
dicarloj | 9:2a47b9ff8911 | 9 | #define H_RES 300 |
dicarloj | 9:2a47b9ff8911 | 10 | |
dicarloj | 9:2a47b9ff8911 | 11 | |
dicarloj | 9:2a47b9ff8911 | 12 | // old shit |
bwang | 4:02e3ae7a3aea | 13 | #define SX_MIN 30 |
bwang | 4:02e3ae7a3aea | 14 | #define SX_MAX 95 |
bwang | 4:02e3ae7a3aea | 15 | #define SY_MIN 10 |
bwang | 4:02e3ae7a3aea | 16 | #define SY_MAX 48 |
dicarloj | 0:7757ab3f7206 | 17 | #define BX_0 30 |
dicarloj | 0:7757ab3f7206 | 18 | #define BY_0 (V_RES/4 - 15) |
dicarloj | 0:7757ab3f7206 | 19 | #define BX 42 |
dicarloj | 0:7757ab3f7206 | 20 | #define BY 15 |
bwang | 4:02e3ae7a3aea | 21 | #define BY2 9 |
dicarloj | 9:2a47b9ff8911 | 22 | |
dicarloj | 9:2a47b9ff8911 | 23 | // good new stuff |
dicarloj | 9:2a47b9ff8911 | 24 | #define X0 75 // start of image in X |
dicarloj | 9:2a47b9ff8911 | 25 | #define Y0 30 // start of image in Y |
dicarloj | 9:2a47b9ff8911 | 26 | #define XL 220 // 25 chars |
dicarloj | 9:2a47b9ff8911 | 27 | #define YL 165 // 20 chars |
dicarloj | 9:2a47b9ff8911 | 28 | |
dicarloj | 9:2a47b9ff8911 | 29 | #define TX 24 // number of characters in X |
dicarloj | 9:2a47b9ff8911 | 30 | #define TY 18 // number of characters in Y |
dicarloj | 0:7757ab3f7206 | 31 | |
dicarloj | 9:2a47b9ff8911 | 32 | #define CHECK_BIT(var,pos) ((var) & (1<<(pos))) |
dicarloj | 9:2a47b9ff8911 | 33 | #define MIN(a,b) (((a)<(b))?(a):(b)) |
dicarloj | 9:2a47b9ff8911 | 34 | #define MAX(a,b) (((a)>(b))?(a):(b)) |
dicarloj | 9:2a47b9ff8911 | 35 | |
dicarloj | 11:537cde55b27f | 36 | #define N_COLOR 16 |
dicarloj | 11:537cde55b27f | 37 | |
dicarloj | 9:2a47b9ff8911 | 38 | uint8_t char_col = 0; // current column counter |
dicarloj | 9:2a47b9ff8911 | 39 | uint8_t char_row = 0; // current row counter |
dicarloj | 9:2a47b9ff8911 | 40 | uint8_t text_buffer_counter = 0; // current index in text buffer counter |
dicarloj | 9:2a47b9ff8911 | 41 | char most_recent_char = '0'; |
dicarloj | 9:2a47b9ff8911 | 42 | |
dicarloj | 9:2a47b9ff8911 | 43 | char text_buffer[TX*TY]; // input text buffer for lisp |
dicarloj | 9:2a47b9ff8911 | 44 | |
dicarloj | 11:537cde55b27f | 45 | AnalogIn joy1(A0); |
dicarloj | 11:537cde55b27f | 46 | AnalogIn joy2(A1); |
dicarloj | 11:537cde55b27f | 47 | |
dicarloj | 9:2a47b9ff8911 | 48 | uint8_t want_gfx = 0; |
dicarloj | 10:1163fb31b0a7 | 49 | uint8_t vsync = 0; |
dicarloj | 9:2a47b9ff8911 | 50 | |
dicarloj | 9:2a47b9ff8911 | 51 | Serial pc(USBTX, USBRX); |
dicarloj | 0:7757ab3f7206 | 52 | |
dicarloj | 9:2a47b9ff8911 | 53 | // font |
dicarloj | 9:2a47b9ff8911 | 54 | char vincent_data[128][8] = { |
dicarloj | 9:2a47b9ff8911 | 55 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 56 | { 0x00, 0x3E, 0x41, 0x55, 0x41, 0x55, 0x49, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 57 | { 0x00, 0x3E, 0x7F, 0x6B, 0x7F, 0x6B, 0x77, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 58 | { 0x00, 0x22, 0x77, 0x7F, 0x7F, 0x3E, 0x1C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 59 | { 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 60 | { 0x00, 0x08, 0x1C, 0x2A, 0x7F, 0x2A, 0x08, 0x1C }, |
dicarloj | 9:2a47b9ff8911 | 61 | { 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x08, 0x1C }, |
dicarloj | 9:2a47b9ff8911 | 62 | { 0x00, 0x00, 0x1C, 0x3E, 0x3E, 0x3E, 0x1C, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 63 | { 0xFF, 0xFF, 0xE3, 0xC1, 0xC1, 0xC1, 0xE3, 0xFF }, |
dicarloj | 9:2a47b9ff8911 | 64 | { 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 65 | { 0xFF, 0xFF, 0xE3, 0xDD, 0xDD, 0xDD, 0xE3, 0xFF }, |
dicarloj | 9:2a47b9ff8911 | 66 | { 0x00, 0x0F, 0x03, 0x05, 0x39, 0x48, 0x48, 0x30 }, |
dicarloj | 9:2a47b9ff8911 | 67 | { 0x00, 0x08, 0x3E, 0x08, 0x1C, 0x22, 0x22, 0x1C }, |
dicarloj | 9:2a47b9ff8911 | 68 | { 0x00, 0x18, 0x14, 0x10, 0x10, 0x30, 0x70, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 69 | { 0x00, 0x0F, 0x19, 0x11, 0x13, 0x37, 0x76, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 70 | { 0x00, 0x08, 0x2A, 0x1C, 0x77, 0x1C, 0x2A, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 71 | { 0x00, 0x60, 0x78, 0x7E, 0x7F, 0x7E, 0x78, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 72 | { 0x00, 0x03, 0x0F, 0x3F, 0x7F, 0x3F, 0x0F, 0x03 }, |
dicarloj | 9:2a47b9ff8911 | 73 | { 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 74 | { 0x00, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 75 | { 0x00, 0x3F, 0x65, 0x65, 0x3D, 0x05, 0x05, 0x05 }, |
dicarloj | 9:2a47b9ff8911 | 76 | { 0x00, 0x0C, 0x32, 0x48, 0x24, 0x12, 0x4C, 0x30 }, |
dicarloj | 9:2a47b9ff8911 | 77 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F }, |
dicarloj | 9:2a47b9ff8911 | 78 | { 0x00, 0x08, 0x1C, 0x2A, 0x08, 0x2A, 0x1C, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 79 | { 0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x1C, 0x1C, 0x1C }, |
dicarloj | 9:2a47b9ff8911 | 80 | { 0x00, 0x1C, 0x1C, 0x1C, 0x7F, 0x3E, 0x1C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 81 | { 0x00, 0x08, 0x0C, 0x7E, 0x7F, 0x7E, 0x0C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 82 | { 0x00, 0x08, 0x18, 0x3F, 0x7F, 0x3F, 0x18, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 83 | { 0x00, 0x00, 0x00, 0x70, 0x70, 0x70, 0x7F, 0x7F }, |
dicarloj | 9:2a47b9ff8911 | 84 | { 0x00, 0x00, 0x14, 0x22, 0x7F, 0x22, 0x14, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 85 | { 0x00, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F }, |
dicarloj | 9:2a47b9ff8911 | 86 | { 0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 87 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 88 | { 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 89 | { 0x00, 0x36, 0x36, 0x14, 0x00, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 90 | { 0x00, 0x36, 0x36, 0x7F, 0x36, 0x7F, 0x36, 0x36 }, |
dicarloj | 9:2a47b9ff8911 | 91 | { 0x00, 0x08, 0x1E, 0x20, 0x1C, 0x02, 0x3C, 0x08 }, |
dicarloj | 9:2a47b9ff8911 | 92 | { 0x00, 0x60, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x06 }, |
dicarloj | 9:2a47b9ff8911 | 93 | { 0x00, 0x3C, 0x66, 0x3C, 0x28, 0x65, 0x66, 0x3F }, |
dicarloj | 9:2a47b9ff8911 | 94 | { 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 95 | { 0x00, 0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 96 | { 0x00, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06 }, |
dicarloj | 9:2a47b9ff8911 | 97 | { 0x00, 0x00, 0x36, 0x1C, 0x7F, 0x1C, 0x36, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 98 | { 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 99 | { 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 100 | { 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 101 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 102 | { 0x00, 0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 103 | { 0x00, 0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 104 | { 0x00, 0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E }, |
dicarloj | 9:2a47b9ff8911 | 105 | { 0x00, 0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E }, |
dicarloj | 9:2a47b9ff8911 | 106 | { 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 107 | { 0x00, 0x0C, 0x1C, 0x2C, 0x4C, 0x7E, 0x0C, 0x0C }, |
dicarloj | 9:2a47b9ff8911 | 108 | { 0x00, 0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 109 | { 0x00, 0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 110 | { 0x00, 0x7E, 0x66, 0x0C, 0x0C, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 111 | { 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 112 | { 0x00, 0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 113 | { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 114 | { 0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30 }, |
dicarloj | 9:2a47b9ff8911 | 115 | { 0x00, 0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06 }, |
dicarloj | 9:2a47b9ff8911 | 116 | { 0x00, 0x00, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 117 | { 0x00, 0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 118 | { 0x00, 0x3C, 0x66, 0x06, 0x1C, 0x18, 0x00, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 119 | { 0x00, 0x38, 0x44, 0x5C, 0x58, 0x42, 0x3C, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 120 | { 0x00, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 121 | { 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C }, |
dicarloj | 9:2a47b9ff8911 | 122 | { 0x00, 0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 123 | { 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C }, |
dicarloj | 9:2a47b9ff8911 | 124 | { 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x7E }, |
dicarloj | 9:2a47b9ff8911 | 125 | { 0x00, 0x7E, 0x60, 0x60, 0x7C, 0x60, 0x60, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 126 | { 0x00, 0x3C, 0x66, 0x60, 0x60, 0x6E, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 127 | { 0x00, 0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 128 | { 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 129 | { 0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x6C, 0x6C, 0x38 }, |
dicarloj | 9:2a47b9ff8911 | 130 | { 0x00, 0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 131 | { 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E }, |
dicarloj | 9:2a47b9ff8911 | 132 | { 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63 }, |
dicarloj | 9:2a47b9ff8911 | 133 | { 0x00, 0x63, 0x73, 0x7B, 0x6F, 0x67, 0x63, 0x63 }, |
dicarloj | 9:2a47b9ff8911 | 134 | { 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 135 | { 0x00, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 136 | { 0x00, 0x3C, 0x66, 0x66, 0x66, 0x6E, 0x3C, 0x06 }, |
dicarloj | 9:2a47b9ff8911 | 137 | { 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 138 | { 0x00, 0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 139 | { 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 140 | { 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 141 | { 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 142 | { 0x00, 0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63 }, |
dicarloj | 9:2a47b9ff8911 | 143 | { 0x00, 0x63, 0x63, 0x36, 0x1C, 0x36, 0x63, 0x63 }, |
dicarloj | 9:2a47b9ff8911 | 144 | { 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 145 | { 0x00, 0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E }, |
dicarloj | 9:2a47b9ff8911 | 146 | { 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1E }, |
dicarloj | 9:2a47b9ff8911 | 147 | { 0x00, 0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 148 | { 0x00, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78 }, |
dicarloj | 9:2a47b9ff8911 | 149 | { 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 150 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F }, |
dicarloj | 9:2a47b9ff8911 | 151 | { 0x00, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 152 | { 0x00, 0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 153 | { 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C }, |
dicarloj | 9:2a47b9ff8911 | 154 | { 0x00, 0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 155 | { 0x00, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 156 | { 0x00, 0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 157 | { 0x00, 0x1C, 0x36, 0x30, 0x30, 0x7C, 0x30, 0x30 }, |
dicarloj | 9:2a47b9ff8911 | 158 | { 0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 159 | { 0x00, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 160 | { 0x00, 0x00, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 161 | { 0x00, 0x0C, 0x00, 0x0C, 0x0C, 0x6C, 0x6C, 0x38 }, |
dicarloj | 9:2a47b9ff8911 | 162 | { 0x00, 0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 163 | { 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 164 | { 0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x6B }, |
dicarloj | 9:2a47b9ff8911 | 165 | { 0x00, 0x00, 0x00, 0x7C, 0x7E, 0x66, 0x66, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 166 | { 0x00, 0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 167 | { 0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 168 | { 0x00, 0x00, 0x3C, 0x6C, 0x6C, 0x3C, 0x0D, 0x0F }, |
dicarloj | 9:2a47b9ff8911 | 169 | { 0x00, 0x00, 0x00, 0x7C, 0x66, 0x66, 0x60, 0x60 }, |
dicarloj | 9:2a47b9ff8911 | 170 | { 0x00, 0x00, 0x00, 0x3E, 0x40, 0x3C, 0x02, 0x7C }, |
dicarloj | 9:2a47b9ff8911 | 171 | { 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 172 | { 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 173 | { 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x3C, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 174 | { 0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x3E }, |
dicarloj | 9:2a47b9ff8911 | 175 | { 0x00, 0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66 }, |
dicarloj | 9:2a47b9ff8911 | 176 | { 0x00, 0x00, 0x00, 0x66, 0x66, 0x3E, 0x06, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 177 | { 0x00, 0x00, 0x00, 0x3C, 0x0C, 0x18, 0x30, 0x3C }, |
dicarloj | 9:2a47b9ff8911 | 178 | { 0x00, 0x0E, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0E }, |
dicarloj | 9:2a47b9ff8911 | 179 | { 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18 }, |
dicarloj | 9:2a47b9ff8911 | 180 | { 0x00, 0x70, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x70 }, |
dicarloj | 9:2a47b9ff8911 | 181 | { 0x00, 0x00, 0x00, 0x3A, 0x6C, 0x00, 0x00, 0x00 }, |
dicarloj | 9:2a47b9ff8911 | 182 | { 0x00, 0x08, 0x1C, 0x36, 0x63, 0x41, 0x41, 0x7F } |
dicarloj | 9:2a47b9ff8911 | 183 | }; |
dicarloj | 9:2a47b9ff8911 | 184 | |
dicarloj | 9:2a47b9ff8911 | 185 | DigitalOut sout(D8); //sync PA_9 |
dicarloj | 9:2a47b9ff8911 | 186 | DigitalOut vout(D7); //video PA_8 |
dicarloj | 9:2a47b9ff8911 | 187 | |
dicarloj | 9:2a47b9ff8911 | 188 | // trigger horizontal line draw |
dicarloj | 0:7757ab3f7206 | 189 | Ticker t; |
dicarloj | 9:2a47b9ff8911 | 190 | |
dicarloj | 0:7757ab3f7206 | 191 | uint8_t draw_line_inv = 0; |
dicarloj | 9:2a47b9ff8911 | 192 | |
dicarloj | 9:2a47b9ff8911 | 193 | // miters logo bitmap |
dicarloj | 0:7757ab3f7206 | 194 | uint8_t miters[] = { |
dicarloj | 0:7757ab3f7206 | 195 | 1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 196 | 1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 197 | 1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 198 | 1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 199 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 200 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0, |
dicarloj | 0:7757ab3f7206 | 201 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0, |
dicarloj | 0:7757ab3f7206 | 202 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 203 | 1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 204 | 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 205 | 0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,1,0,0,0,0,0,0, |
dicarloj | 0:7757ab3f7206 | 206 | 1,1,1,1,1,0,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,0,0,1,1,0,1,1,0,1,1,0,1,1,0,0,0,1,1,1,1,1, |
dicarloj | 0:7757ab3f7206 | 207 | 1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 208 | 1,0,1,0,1,0,1,0,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 209 | 1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1, |
dicarloj | 0:7757ab3f7206 | 210 | |
dicarloj | 0:7757ab3f7206 | 211 | }; |
dicarloj | 0:7757ab3f7206 | 212 | |
dicarloj | 0:7757ab3f7206 | 213 | |
bwang | 3:d9edc0575aa3 | 214 | |
bwang | 3:d9edc0575aa3 | 215 | |
bwang | 3:d9edc0575aa3 | 216 | |
dicarloj | 9:2a47b9ff8911 | 217 | uint8_t bl_line_s[H_RES]; //blank line sync buffer |
dicarloj | 9:2a47b9ff8911 | 218 | uint8_t bl_line_v[H_RES]; //blank line video buffer |
dicarloj | 9:2a47b9ff8911 | 219 | uint8_t vb_line_s[H_RES]; //vertical sync, sync buffer |
dicarloj | 9:2a47b9ff8911 | 220 | uint8_t vb_line_v[H_RES]; //vertical sync, video buffer |
dicarloj | 9:2a47b9ff8911 | 221 | uint8_t im_line_s[H_RES]; //image sync buffer |
dicarloj | 9:2a47b9ff8911 | 222 | uint8_t im_line_va_1[H_RES*V_RES]; |
dicarloj | 9:2a47b9ff8911 | 223 | uint8_t im_line_va_2[H_RES*V_RES]; |
dicarloj | 9:2a47b9ff8911 | 224 | uint8_t* im_line_va; // active image buff |
dicarloj | 9:2a47b9ff8911 | 225 | //uint8_t im_line_va[H_RES*V_RES]; //image video buffer |
bwang | 6:0a34891a82c7 | 226 | |
dicarloj | 0:7757ab3f7206 | 227 | uint16_t l=0; //current line of scan |
dicarloj | 0:7757ab3f7206 | 228 | |
dicarloj | 9:2a47b9ff8911 | 229 | // positive or negative? |
dicarloj | 9:2a47b9ff8911 | 230 | int16_t sign(int16_t a) |
bwang | 6:0a34891a82c7 | 231 | { |
dicarloj | 9:2a47b9ff8911 | 232 | if(a > 0) return 1; |
dicarloj | 9:2a47b9ff8911 | 233 | if(a < 0) return -1; |
dicarloj | 9:2a47b9ff8911 | 234 | return 0; |
dicarloj | 0:7757ab3f7206 | 235 | } |
dicarloj | 0:7757ab3f7206 | 236 | |
dicarloj | 9:2a47b9ff8911 | 237 | // clear the text buffer |
dicarloj | 9:2a47b9ff8911 | 238 | void clr_text_buff() |
dicarloj | 9:2a47b9ff8911 | 239 | { |
dicarloj | 9:2a47b9ff8911 | 240 | text_buffer_counter = 0; |
dicarloj | 9:2a47b9ff8911 | 241 | for(int i = 0; i < TX*TY; i++) |
dicarloj | 9:2a47b9ff8911 | 242 | text_buffer[i] = 0; |
dicarloj | 9:2a47b9ff8911 | 243 | } |
dicarloj | 9:2a47b9ff8911 | 244 | |
dicarloj | 9:2a47b9ff8911 | 245 | // clear the screen and the text buffer |
bwang | 3:d9edc0575aa3 | 246 | void clr() |
bwang | 3:d9edc0575aa3 | 247 | { |
bwang | 3:d9edc0575aa3 | 248 | for(int i = 0; i < H_RES; i++) |
bwang | 3:d9edc0575aa3 | 249 | for(int j = 0; j < V_RES; j++) |
bwang | 3:d9edc0575aa3 | 250 | im_line_va[i+j*H_RES] = 0; |
dicarloj | 9:2a47b9ff8911 | 251 | |
dicarloj | 9:2a47b9ff8911 | 252 | clr_text_buff(); |
bwang | 3:d9edc0575aa3 | 253 | |
bwang | 3:d9edc0575aa3 | 254 | } |
bwang | 3:d9edc0575aa3 | 255 | |
dicarloj | 9:2a47b9ff8911 | 256 | // initialize video buffers |
dicarloj | 0:7757ab3f7206 | 257 | void init_buffers() |
dicarloj | 0:7757ab3f7206 | 258 | { |
dicarloj | 9:2a47b9ff8911 | 259 | clr(); // zero buffers |
dicarloj | 0:7757ab3f7206 | 260 | for(int i = 0; i < H_RES; i++) |
dicarloj | 0:7757ab3f7206 | 261 | { |
dicarloj | 0:7757ab3f7206 | 262 | im_line_s[i] = 1; |
dicarloj | 0:7757ab3f7206 | 263 | bl_line_s[i] = 1; |
dicarloj | 0:7757ab3f7206 | 264 | bl_line_v[i] = 0; |
dicarloj | 0:7757ab3f7206 | 265 | vb_line_s[i] = 0; |
dicarloj | 0:7757ab3f7206 | 266 | vb_line_v[i] = 0; |
dicarloj | 0:7757ab3f7206 | 267 | } |
dicarloj | 0:7757ab3f7206 | 268 | im_line_s[0] = 0; |
dicarloj | 0:7757ab3f7206 | 269 | im_line_s[1] = 0; |
dicarloj | 0:7757ab3f7206 | 270 | im_line_s[2] = 0; |
dicarloj | 9:2a47b9ff8911 | 271 | im_line_s[3] = 0; |
dicarloj | 9:2a47b9ff8911 | 272 | |
dicarloj | 9:2a47b9ff8911 | 273 | for(int i = 0; i < 15; i++) |
dicarloj | 9:2a47b9ff8911 | 274 | im_line_s[i] = 0; |
dicarloj | 9:2a47b9ff8911 | 275 | |
dicarloj | 9:2a47b9ff8911 | 276 | |
dicarloj | 0:7757ab3f7206 | 277 | bl_line_s[0] = 0; |
dicarloj | 0:7757ab3f7206 | 278 | vb_line_s[0] = 1; |
dicarloj | 0:7757ab3f7206 | 279 | bl_line_s[1] = 0; |
dicarloj | 0:7757ab3f7206 | 280 | vb_line_s[1] = 1; |
dicarloj | 0:7757ab3f7206 | 281 | |
dicarloj | 9:2a47b9ff8911 | 282 | bl_line_s[3] = 0; |
dicarloj | 9:2a47b9ff8911 | 283 | vb_line_s[3] = 1; |
dicarloj | 9:2a47b9ff8911 | 284 | bl_line_s[2] = 0; |
dicarloj | 9:2a47b9ff8911 | 285 | vb_line_s[2] = 1; |
dicarloj | 0:7757ab3f7206 | 286 | } |
dicarloj | 9:2a47b9ff8911 | 287 | |
dicarloj | 9:2a47b9ff8911 | 288 | // video interrupt |
dicarloj | 0:7757ab3f7206 | 289 | void isr() |
dicarloj | 0:7757ab3f7206 | 290 | { |
dicarloj | 0:7757ab3f7206 | 291 | uint8_t nop = 0; //use nops or use wait_us |
dicarloj | 0:7757ab3f7206 | 292 | uint8_t* sptr; //pointer to sync buffer for line |
dicarloj | 0:7757ab3f7206 | 293 | uint8_t* vptr; //pointer to video buffer for line |
dicarloj | 10:1163fb31b0a7 | 294 | if(l < V_RES){ vptr = im_line_va + ((l)*H_RES); sptr = im_line_s; nop = 1; vsync = 0;} //pick line buffers |
dicarloj | 10:1163fb31b0a7 | 295 | else if(l < 254){ vptr = bl_line_v; sptr = bl_line_s; nop = 0; } |
dicarloj | 10:1163fb31b0a7 | 296 | else{ vptr = vb_line_v; sptr = vb_line_s; nop = 1; } |
dicarloj | 9:2a47b9ff8911 | 297 | uint16_t lmax = nop?H_RES:12; //number of columns |
dicarloj | 9:2a47b9ff8911 | 298 | for(uint16_t i = 0; i < lmax; i++) //loop over each column |
dicarloj | 0:7757ab3f7206 | 299 | { |
dicarloj | 9:2a47b9ff8911 | 300 | nop = 1; |
dicarloj | 9:2a47b9ff8911 | 301 | if(sptr[i]) |
dicarloj | 9:2a47b9ff8911 | 302 | GPIOA->ODR |= (1 << 9); |
dicarloj | 9:2a47b9ff8911 | 303 | else |
dicarloj | 9:2a47b9ff8911 | 304 | GPIOA->ODR &= ~(1 << 9); |
dicarloj | 9:2a47b9ff8911 | 305 | |
dicarloj | 9:2a47b9ff8911 | 306 | if(vptr[i]) |
dicarloj | 9:2a47b9ff8911 | 307 | GPIOA->ODR |= (1 << 8); |
dicarloj | 9:2a47b9ff8911 | 308 | else |
dicarloj | 9:2a47b9ff8911 | 309 | GPIOA->ODR &= ~(1 << 8); |
dicarloj | 9:2a47b9ff8911 | 310 | |
dicarloj | 9:2a47b9ff8911 | 311 | |
dicarloj | 0:7757ab3f7206 | 312 | if(nop) //nop delay |
dicarloj | 0:7757ab3f7206 | 313 | { |
dicarloj | 9:2a47b9ff8911 | 314 | asm("nop");asm("nop");//asm("nop");asm("nop");//asm("nop");asm("nop");asm("nop");//asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); |
dicarloj | 0:7757ab3f7206 | 315 | } |
dicarloj | 9:2a47b9ff8911 | 316 | else {wait_us(1); if(i > 2) i+=1;} //wait delay |
dicarloj | 0:7757ab3f7206 | 317 | } |
dicarloj | 0:7757ab3f7206 | 318 | //move to next line |
dicarloj | 0:7757ab3f7206 | 319 | l++; |
dicarloj | 10:1163fb31b0a7 | 320 | if(l == V_RES) vsync = 1; |
dicarloj | 0:7757ab3f7206 | 321 | if(l > 255) l = 0; |
dicarloj | 0:7757ab3f7206 | 322 | } |
dicarloj | 0:7757ab3f7206 | 323 | |
dicarloj | 9:2a47b9ff8911 | 324 | // draw checkerboard pattern |
dicarloj | 9:2a47b9ff8911 | 325 | void write_test_pattern(int x_in, int y_in,int k) |
dicarloj | 0:7757ab3f7206 | 326 | { |
dicarloj | 9:2a47b9ff8911 | 327 | int x_max = MIN(H_RES,x_in); |
dicarloj | 9:2a47b9ff8911 | 328 | int y_max = MIN(V_RES,y_in); |
dicarloj | 9:2a47b9ff8911 | 329 | |
dicarloj | 9:2a47b9ff8911 | 330 | // x 50 to 245 |
dicarloj | 9:2a47b9ff8911 | 331 | for(int x = 65; x < x_max; x++) |
dicarloj | 9:2a47b9ff8911 | 332 | { |
dicarloj | 9:2a47b9ff8911 | 333 | for(int y = 30; y < y_max; y++) |
dicarloj | 9:2a47b9ff8911 | 334 | { |
dicarloj | 9:2a47b9ff8911 | 335 | im_line_va[y*H_RES + x] = ((y/k)%2)^((x/k)%2); |
dicarloj | 9:2a47b9ff8911 | 336 | } |
dicarloj | 9:2a47b9ff8911 | 337 | } |
dicarloj | 0:7757ab3f7206 | 338 | } |
dicarloj | 0:7757ab3f7206 | 339 | |
dicarloj | 9:2a47b9ff8911 | 340 | // draw miters logo |
dicarloj | 9:2a47b9ff8911 | 341 | void draw_miters_at(int xx, int yy) |
dicarloj | 9:2a47b9ff8911 | 342 | { |
dicarloj | 9:2a47b9ff8911 | 343 | int bmi = 0; |
dicarloj | 9:2a47b9ff8911 | 344 | for(int y = yy; y < BY2+yy; y++) |
dicarloj | 9:2a47b9ff8911 | 345 | { |
dicarloj | 9:2a47b9ff8911 | 346 | for(int x = xx; x < BX+xx; x++) |
dicarloj | 9:2a47b9ff8911 | 347 | { |
dicarloj | 9:2a47b9ff8911 | 348 | im_line_va[H_RES*y + x] = miters[bmi]; |
dicarloj | 9:2a47b9ff8911 | 349 | bmi++; |
dicarloj | 9:2a47b9ff8911 | 350 | } |
dicarloj | 9:2a47b9ff8911 | 351 | } |
dicarloj | 9:2a47b9ff8911 | 352 | } |
dicarloj | 9:2a47b9ff8911 | 353 | |
dicarloj | 9:2a47b9ff8911 | 354 | // draw vertical line |
dicarloj | 0:7757ab3f7206 | 355 | void draw_vert(int16_t y0, int16_t y1, int16_t x0) |
dicarloj | 0:7757ab3f7206 | 356 | { |
dicarloj | 0:7757ab3f7206 | 357 | for(int16_t i = y0; i < y1; i++) |
dicarloj | 0:7757ab3f7206 | 358 | im_line_va[H_RES*i + x0] = 1; |
dicarloj | 0:7757ab3f7206 | 359 | } |
dicarloj | 0:7757ab3f7206 | 360 | |
dicarloj | 9:2a47b9ff8911 | 361 | // draw horizonal line |
dicarloj | 0:7757ab3f7206 | 362 | void draw_horiz(int16_t x0, int16_t x1, int16_t y0) |
dicarloj | 0:7757ab3f7206 | 363 | { |
dicarloj | 0:7757ab3f7206 | 364 | for(int16_t i = x0; i < x1; i++) |
dicarloj | 0:7757ab3f7206 | 365 | im_line_va[H_RES*y0 + i] = 1; |
dicarloj | 0:7757ab3f7206 | 366 | } |
dicarloj | 0:7757ab3f7206 | 367 | |
dicarloj | 9:2a47b9ff8911 | 368 | // draw line between points |
dicarloj | 0:7757ab3f7206 | 369 | void draw_line(int16_t x0, int16_t y0, int16_t x1, int16_t y1) |
dicarloj | 0:7757ab3f7206 | 370 | { |
dicarloj | 0:7757ab3f7206 | 371 | if(x0 > x1){ x0 = x0 ^ x1; x1 = x1^x0; x0 = x0^x1;y0 = y0 ^ y1; y1 = y1^y0; y0 = y0^y1; } |
dicarloj | 0:7757ab3f7206 | 372 | if(x0 == x1){draw_vert(y0,y1,x0);} |
dicarloj | 0:7757ab3f7206 | 373 | if(y0 == y1){draw_horiz(x0,x1,y0);} |
dicarloj | 0:7757ab3f7206 | 374 | int16_t dx = x1 - x0; |
dicarloj | 0:7757ab3f7206 | 375 | int16_t dy = y1 - y0; |
dicarloj | 0:7757ab3f7206 | 376 | float derr = fabs((float)(dy)/(float)(dx)); |
dicarloj | 0:7757ab3f7206 | 377 | float err = 0.f; |
dicarloj | 0:7757ab3f7206 | 378 | int16_t y = y0; |
dicarloj | 0:7757ab3f7206 | 379 | for(int16_t x = x0; x < x1; x++) |
dicarloj | 0:7757ab3f7206 | 380 | { |
dicarloj | 0:7757ab3f7206 | 381 | //plotxy |
dicarloj | 0:7757ab3f7206 | 382 | im_line_va[H_RES*y + x] = !draw_line_inv; |
dicarloj | 0:7757ab3f7206 | 383 | err += derr; |
dicarloj | 0:7757ab3f7206 | 384 | while(err >= 0.5f) |
dicarloj | 0:7757ab3f7206 | 385 | { |
dicarloj | 0:7757ab3f7206 | 386 | y += sign(dy); |
dicarloj | 0:7757ab3f7206 | 387 | im_line_va[H_RES*y + x] = !draw_line_inv; |
dicarloj | 0:7757ab3f7206 | 388 | err -= 1.f; |
dicarloj | 0:7757ab3f7206 | 389 | } |
dicarloj | 0:7757ab3f7206 | 390 | } |
dicarloj | 0:7757ab3f7206 | 391 | } |
dicarloj | 0:7757ab3f7206 | 392 | |
dicarloj | 9:2a47b9ff8911 | 393 | // draw letter |
dicarloj | 9:2a47b9ff8911 | 394 | void draw_vincent(uint16_t x0, uint16_t y0, uint8_t c) |
dicarloj | 0:7757ab3f7206 | 395 | { |
dicarloj | 9:2a47b9ff8911 | 396 | if(c == 40) c = 41; |
dicarloj | 9:2a47b9ff8911 | 397 | else if(c == 41) c = 40; |
dicarloj | 9:2a47b9ff8911 | 398 | char* letter = vincent_data[c]; |
dicarloj | 9:2a47b9ff8911 | 399 | for(uint16_t xp = 0; xp < 8; xp++) |
dicarloj | 0:7757ab3f7206 | 400 | { |
dicarloj | 9:2a47b9ff8911 | 401 | for(uint16_t yp = 0; yp < 8; yp++) |
dicarloj | 0:7757ab3f7206 | 402 | { |
dicarloj | 9:2a47b9ff8911 | 403 | im_line_va[H_RES*(yp+y0) + xp + x0] = CHECK_BIT(letter[yp],8-xp); |
dicarloj | 0:7757ab3f7206 | 404 | } |
dicarloj | 0:7757ab3f7206 | 405 | } |
dicarloj | 0:7757ab3f7206 | 406 | } |
dicarloj | 0:7757ab3f7206 | 407 | |
dicarloj | 9:2a47b9ff8911 | 408 | // go to new line |
dicarloj | 9:2a47b9ff8911 | 409 | void new_line() |
dicarloj | 9:2a47b9ff8911 | 410 | { |
dicarloj | 9:2a47b9ff8911 | 411 | char_col = 0; |
dicarloj | 9:2a47b9ff8911 | 412 | char_row++; |
dicarloj | 9:2a47b9ff8911 | 413 | if(char_row >= TY) |
dicarloj | 9:2a47b9ff8911 | 414 | { |
dicarloj | 9:2a47b9ff8911 | 415 | char_row = 0; |
bwang | 3:d9edc0575aa3 | 416 | } |
bwang | 3:d9edc0575aa3 | 417 | } |
bwang | 3:d9edc0575aa3 | 418 | |
dicarloj | 9:2a47b9ff8911 | 419 | // draw string |
dicarloj | 9:2a47b9ff8911 | 420 | void draw_vincent_string(char* str) |
dicarloj | 9:2a47b9ff8911 | 421 | { |
dicarloj | 9:2a47b9ff8911 | 422 | for(int i = 0; i < strlen(str); i++) |
dicarloj | 9:2a47b9ff8911 | 423 | { |
dicarloj | 9:2a47b9ff8911 | 424 | if(str[i] == 0 || str[i] == EOF) return; |
dicarloj | 9:2a47b9ff8911 | 425 | char_col++; |
dicarloj | 9:2a47b9ff8911 | 426 | if(char_col >= TX) |
dicarloj | 9:2a47b9ff8911 | 427 | { |
dicarloj | 9:2a47b9ff8911 | 428 | char_col = 0; |
dicarloj | 9:2a47b9ff8911 | 429 | char_row++; |
bwang | 3:d9edc0575aa3 | 430 | } |
dicarloj | 9:2a47b9ff8911 | 431 | if(char_row >= TY) |
dicarloj | 9:2a47b9ff8911 | 432 | { |
dicarloj | 9:2a47b9ff8911 | 433 | char_row = 0; |
dicarloj | 9:2a47b9ff8911 | 434 | } |
bwang | 3:d9edc0575aa3 | 435 | |
dicarloj | 9:2a47b9ff8911 | 436 | draw_vincent(X0 +2 + 8*char_col, Y0 + 14 + 8*char_row, |
dicarloj | 9:2a47b9ff8911 | 437 | str[i]); |
bwang | 3:d9edc0575aa3 | 438 | } |
bwang | 3:d9edc0575aa3 | 439 | } |
bwang | 3:d9edc0575aa3 | 440 | |
dicarloj | 9:2a47b9ff8911 | 441 | //void draw_text_buffer() |
dicarloj | 9:2a47b9ff8911 | 442 | //{ |
dicarloj | 9:2a47b9ff8911 | 443 | // for(int yc = 0; yc < TY; yc++) |
dicarloj | 9:2a47b9ff8911 | 444 | // { |
dicarloj | 9:2a47b9ff8911 | 445 | // for(int xc = 0; xc < TX; xc++) |
dicarloj | 9:2a47b9ff8911 | 446 | // { |
dicarloj | 9:2a47b9ff8911 | 447 | // draw_vincent(X0 + 10 + 8*xc, Y0 + 10 + 8*yc, |
dicarloj | 9:2a47b9ff8911 | 448 | // text_buffer[TX*yc + xc]%128); |
dicarloj | 9:2a47b9ff8911 | 449 | // } |
dicarloj | 9:2a47b9ff8911 | 450 | // } |
dicarloj | 9:2a47b9ff8911 | 451 | //} |
dicarloj | 9:2a47b9ff8911 | 452 | |
dicarloj | 9:2a47b9ff8911 | 453 | // should the lisp interpreter run? |
dicarloj | 9:2a47b9ff8911 | 454 | int want_lisp = 0; |
dicarloj | 9:2a47b9ff8911 | 455 | |
dicarloj | 9:2a47b9ff8911 | 456 | void backspace() |
dicarloj | 9:2a47b9ff8911 | 457 | { |
dicarloj | 9:2a47b9ff8911 | 458 | text_buffer[text_buffer_counter] = 0; |
dicarloj | 9:2a47b9ff8911 | 459 | if(text_buffer_counter > 0) |
dicarloj | 9:2a47b9ff8911 | 460 | text_buffer_counter--; |
dicarloj | 9:2a47b9ff8911 | 461 | |
dicarloj | 9:2a47b9ff8911 | 462 | draw_vincent(X0 +2 + 8*char_col, Y0 + 14 + 8*char_row, ' '); |
dicarloj | 9:2a47b9ff8911 | 463 | if(char_col > 0) |
dicarloj | 9:2a47b9ff8911 | 464 | char_col--; |
dicarloj | 9:2a47b9ff8911 | 465 | else |
bwang | 1:24fd07a24094 | 466 | { |
dicarloj | 9:2a47b9ff8911 | 467 | char_row--; |
dicarloj | 9:2a47b9ff8911 | 468 | char_col = TX - 1; |
bwang | 3:d9edc0575aa3 | 469 | } |
bwang | 3:d9edc0575aa3 | 470 | } |
bwang | 3:d9edc0575aa3 | 471 | |
dicarloj | 9:2a47b9ff8911 | 472 | void clear_all_text() |
dicarloj | 9:2a47b9ff8911 | 473 | { |
dicarloj | 9:2a47b9ff8911 | 474 | char_col = 0; |
dicarloj | 9:2a47b9ff8911 | 475 | char_row = 0; |
dicarloj | 9:2a47b9ff8911 | 476 | clr_text_buff(); |
dicarloj | 9:2a47b9ff8911 | 477 | clr(); |
dicarloj | 9:2a47b9ff8911 | 478 | // startup animation |
dicarloj | 9:2a47b9ff8911 | 479 | int miter_x_final = XL/2 + 20*cos(.11f*MAX(XL,YL)) + 80; |
dicarloj | 9:2a47b9ff8911 | 480 | int miter_y_final = YL/2 + 20*sin(.11f*MAX(XL,YL)) + 80; |
dicarloj | 9:2a47b9ff8911 | 481 | |
dicarloj | 9:2a47b9ff8911 | 482 | int x_correct = -miter_x_final + X0 + 6; |
dicarloj | 9:2a47b9ff8911 | 483 | int y_correct = -miter_y_final + Y0; |
dicarloj | 9:2a47b9ff8911 | 484 | for(int i = MAX(XL,YL) - 1; i < MAX(XL,YL); i++) |
bwang | 4:02e3ae7a3aea | 485 | { |
dicarloj | 9:2a47b9ff8911 | 486 | wait_us(10000); |
dicarloj | 9:2a47b9ff8911 | 487 | clr(); |
dicarloj | 9:2a47b9ff8911 | 488 | int xp = MIN(XL,i); |
dicarloj | 9:2a47b9ff8911 | 489 | int yp = MIN(YL,i); |
dicarloj | 9:2a47b9ff8911 | 490 | draw_line(X0, Y0, X0 + xp, Y0); |
dicarloj | 9:2a47b9ff8911 | 491 | draw_line(X0+xp,Y0,X0+xp,Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 492 | |
dicarloj | 9:2a47b9ff8911 | 493 | draw_line(X0, Y0+yp, X0 +xp, Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 494 | draw_line(X0,Y0,X0,Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 495 | float phase = (float)(i) / (float)MAX(XL,YL); |
dicarloj | 9:2a47b9ff8911 | 496 | draw_miters_at(xp/2 + 20*cos(.11f*i) + 80 + (x_correct * phase),yp/2 + 20*sin(.11f*i) + 80 + (y_correct * phase)); |
dicarloj | 9:2a47b9ff8911 | 497 | //draw_vincent(100,100,15); |
dicarloj | 9:2a47b9ff8911 | 498 | } |
dicarloj | 9:2a47b9ff8911 | 499 | |
dicarloj | 9:2a47b9ff8911 | 500 | // draw prompt |
dicarloj | 9:2a47b9ff8911 | 501 | draw_vincent_string(">"); |
dicarloj | 9:2a47b9ff8911 | 502 | } |
dicarloj | 9:2a47b9ff8911 | 503 | |
dicarloj | 9:2a47b9ff8911 | 504 | void set_status_string(char* str) |
dicarloj | 9:2a47b9ff8911 | 505 | { |
dicarloj | 9:2a47b9ff8911 | 506 | uint8_t char_col_backup = char_col; |
dicarloj | 9:2a47b9ff8911 | 507 | uint8_t char_row_backup = char_row; |
dicarloj | 9:2a47b9ff8911 | 508 | char_col = 0; |
dicarloj | 9:2a47b9ff8911 | 509 | char_row = TY - 1; |
dicarloj | 9:2a47b9ff8911 | 510 | |
dicarloj | 9:2a47b9ff8911 | 511 | draw_vincent_string(str); |
dicarloj | 9:2a47b9ff8911 | 512 | |
dicarloj | 9:2a47b9ff8911 | 513 | char_col = char_col_backup; |
dicarloj | 9:2a47b9ff8911 | 514 | char_row = char_row_backup; |
dicarloj | 9:2a47b9ff8911 | 515 | } |
dicarloj | 9:2a47b9ff8911 | 516 | |
dicarloj | 9:2a47b9ff8911 | 517 | // on each serial char received |
dicarloj | 9:2a47b9ff8911 | 518 | void serial_callback() |
dicarloj | 9:2a47b9ff8911 | 519 | { |
dicarloj | 9:2a47b9ff8911 | 520 | // get characeter and store in text_buffer |
dicarloj | 9:2a47b9ff8911 | 521 | char new_char = pc.getc(); |
dicarloj | 9:2a47b9ff8911 | 522 | most_recent_char = new_char; |
dicarloj | 9:2a47b9ff8911 | 523 | |
dicarloj | 9:2a47b9ff8911 | 524 | if(new_char == '^') |
dicarloj | 9:2a47b9ff8911 | 525 | { |
dicarloj | 9:2a47b9ff8911 | 526 | want_gfx = 1; |
dicarloj | 9:2a47b9ff8911 | 527 | return; |
dicarloj | 9:2a47b9ff8911 | 528 | } |
dicarloj | 9:2a47b9ff8911 | 529 | //char cn[8]; |
dicarloj | 9:2a47b9ff8911 | 530 | //sprintf(cn,"[%d]",new_char); |
dicarloj | 9:2a47b9ff8911 | 531 | //draw_vincent_string(cn); |
dicarloj | 9:2a47b9ff8911 | 532 | if(new_char == 127) |
dicarloj | 9:2a47b9ff8911 | 533 | { |
dicarloj | 9:2a47b9ff8911 | 534 | backspace(); |
dicarloj | 9:2a47b9ff8911 | 535 | return; |
dicarloj | 9:2a47b9ff8911 | 536 | } |
dicarloj | 9:2a47b9ff8911 | 537 | |
dicarloj | 9:2a47b9ff8911 | 538 | text_buffer[text_buffer_counter++] = new_char; |
dicarloj | 9:2a47b9ff8911 | 539 | |
dicarloj | 9:2a47b9ff8911 | 540 | // if it's <enter>, request lisp |
dicarloj | 9:2a47b9ff8911 | 541 | if(new_char == 13) |
dicarloj | 9:2a47b9ff8911 | 542 | { |
dicarloj | 9:2a47b9ff8911 | 543 | want_lisp = 1; |
dicarloj | 9:2a47b9ff8911 | 544 | return; |
dicarloj | 9:2a47b9ff8911 | 545 | } |
dicarloj | 9:2a47b9ff8911 | 546 | |
dicarloj | 9:2a47b9ff8911 | 547 | |
dicarloj | 9:2a47b9ff8911 | 548 | // increment rows/cols as needed |
dicarloj | 9:2a47b9ff8911 | 549 | char_col++; |
dicarloj | 9:2a47b9ff8911 | 550 | if(char_col >= TX) |
dicarloj | 9:2a47b9ff8911 | 551 | { |
dicarloj | 9:2a47b9ff8911 | 552 | char_col = 0; |
dicarloj | 9:2a47b9ff8911 | 553 | char_row++; |
dicarloj | 9:2a47b9ff8911 | 554 | } |
dicarloj | 9:2a47b9ff8911 | 555 | if(char_row >= TY) |
dicarloj | 9:2a47b9ff8911 | 556 | { |
dicarloj | 9:2a47b9ff8911 | 557 | char_row = 0; |
dicarloj | 9:2a47b9ff8911 | 558 | } |
dicarloj | 9:2a47b9ff8911 | 559 | |
dicarloj | 9:2a47b9ff8911 | 560 | // draw new character |
dicarloj | 9:2a47b9ff8911 | 561 | draw_vincent(X0 +2 + 8*char_col, Y0 + 14 + 8*char_row, |
dicarloj | 9:2a47b9ff8911 | 562 | new_char%128); |
dicarloj | 9:2a47b9ff8911 | 563 | |
dicarloj | 9:2a47b9ff8911 | 564 | } |
dicarloj | 9:2a47b9ff8911 | 565 | |
dicarloj | 9:2a47b9ff8911 | 566 | void spin_for_a_while(volatile int a) |
dicarloj | 9:2a47b9ff8911 | 567 | { |
dicarloj | 9:2a47b9ff8911 | 568 | volatile int k = a; |
dicarloj | 9:2a47b9ff8911 | 569 | for(int i = 0; i < k; i++) |
dicarloj | 9:2a47b9ff8911 | 570 | { |
dicarloj | 9:2a47b9ff8911 | 571 | for(int j = 0; j < k; j++) |
bwang | 4:02e3ae7a3aea | 572 | { |
dicarloj | 9:2a47b9ff8911 | 573 | a++; |
bwang | 4:02e3ae7a3aea | 574 | } |
bwang | 4:02e3ae7a3aea | 575 | } |
bwang | 4:02e3ae7a3aea | 576 | } |
bwang | 4:02e3ae7a3aea | 577 | |
dicarloj | 9:2a47b9ff8911 | 578 | uint8_t gfx_is_init = 0; |
dicarloj | 9:2a47b9ff8911 | 579 | |
dicarloj | 9:2a47b9ff8911 | 580 | // screen goes from -.5 to .5 on both axes |
dicarloj | 9:2a47b9ff8911 | 581 | void draw_gfx_line(float x0, float y0, float x1, float y1) |
dicarloj | 9:2a47b9ff8911 | 582 | { |
dicarloj | 9:2a47b9ff8911 | 583 | float x_width = (XL); |
dicarloj | 9:2a47b9ff8911 | 584 | float y_height = (YL); |
dicarloj | 9:2a47b9ff8911 | 585 | |
dicarloj | 9:2a47b9ff8911 | 586 | // want to rescale to 0 to 1 |
dicarloj | 9:2a47b9ff8911 | 587 | x0 += 0.5f; |
dicarloj | 9:2a47b9ff8911 | 588 | y0 += 0.5f; |
dicarloj | 9:2a47b9ff8911 | 589 | |
dicarloj | 9:2a47b9ff8911 | 590 | x1 += 0.5f; |
dicarloj | 9:2a47b9ff8911 | 591 | y1 += 0.5f; |
dicarloj | 9:2a47b9ff8911 | 592 | //printf("x0: %.3f, y0: %.3f\r\n",x0,y0); |
dicarloj | 9:2a47b9ff8911 | 593 | int xx = x0 * x_width + X0; |
dicarloj | 9:2a47b9ff8911 | 594 | if(xx > (X0 + XL)) xx = (X0 + XL); |
dicarloj | 9:2a47b9ff8911 | 595 | if(xx < X0) xx = X0; |
dicarloj | 9:2a47b9ff8911 | 596 | int yy = y0 * y_height + Y0; |
dicarloj | 9:2a47b9ff8911 | 597 | if(yy > (Y0 + YL)) yy = (Y0 + YL); |
dicarloj | 9:2a47b9ff8911 | 598 | if(yy < Y0) yy = Y0; |
dicarloj | 9:2a47b9ff8911 | 599 | |
dicarloj | 9:2a47b9ff8911 | 600 | int xx1 = x1 * x_width + X0; |
dicarloj | 9:2a47b9ff8911 | 601 | if(xx1 > (X0 + XL)) xx1 = (X0 + XL); |
dicarloj | 9:2a47b9ff8911 | 602 | if(xx1 < X0) xx1 = X0; |
dicarloj | 9:2a47b9ff8911 | 603 | int yy1 = y1 * y_height + Y0; |
dicarloj | 9:2a47b9ff8911 | 604 | if(yy1 > (Y0 + YL)) yy1 = (Y0 + YL); |
dicarloj | 9:2a47b9ff8911 | 605 | if(yy1 < Y0) yy1 = Y0; |
dicarloj | 9:2a47b9ff8911 | 606 | |
dicarloj | 9:2a47b9ff8911 | 607 | draw_line(xx,yy,xx1,yy1); |
dicarloj | 9:2a47b9ff8911 | 608 | |
bwang | 4:02e3ae7a3aea | 609 | } |
dicarloj | 9:2a47b9ff8911 | 610 | //void swap_buffers() |
dicarloj | 9:2a47b9ff8911 | 611 | //{ |
dicarloj | 9:2a47b9ff8911 | 612 | // if(im_line_va == im_line_va_1) |
dicarloj | 9:2a47b9ff8911 | 613 | // im_line_va = im_line_va_2; |
dicarloj | 9:2a47b9ff8911 | 614 | // else |
dicarloj | 9:2a47b9ff8911 | 615 | // im_line_va = im_line_va_1; |
dicarloj | 9:2a47b9ff8911 | 616 | //} |
dicarloj | 9:2a47b9ff8911 | 617 | int main() |
dicarloj | 9:2a47b9ff8911 | 618 | { |
dicarloj | 9:2a47b9ff8911 | 619 | im_line_va = im_line_va_1; |
dicarloj | 9:2a47b9ff8911 | 620 | // init serial |
dicarloj | 9:2a47b9ff8911 | 621 | pc.baud(115200); |
dicarloj | 9:2a47b9ff8911 | 622 | pc.attach(&serial_callback); |
dicarloj | 9:2a47b9ff8911 | 623 | pc.printf("derp!\r\n"); |
dicarloj | 9:2a47b9ff8911 | 624 | |
dicarloj | 9:2a47b9ff8911 | 625 | // init buffers |
dicarloj | 9:2a47b9ff8911 | 626 | init_buffers(); |
dicarloj | 9:2a47b9ff8911 | 627 | // init timer |
dicarloj | 9:2a47b9ff8911 | 628 | t.attach_us(&isr,64); |
bwang | 4:02e3ae7a3aea | 629 | |
dicarloj | 9:2a47b9ff8911 | 630 | wait_us(200000); |
dicarloj | 9:2a47b9ff8911 | 631 | int miter_x_final = XL/2 + 20*cos(.11f*MAX(XL,YL)) + 80; |
dicarloj | 9:2a47b9ff8911 | 632 | int miter_y_final = YL/2 + 20*sin(.11f*MAX(XL,YL)) + 80; |
dicarloj | 9:2a47b9ff8911 | 633 | int x_correct = -miter_x_final + X0 + 6; |
dicarloj | 9:2a47b9ff8911 | 634 | int y_correct = -miter_y_final + Y0; |
bwang | 4:02e3ae7a3aea | 635 | |
dicarloj | 9:2a47b9ff8911 | 636 | for(int i = 0; i < MAX(XL,YL); i+=3) |
bwang | 4:02e3ae7a3aea | 637 | { |
dicarloj | 9:2a47b9ff8911 | 638 | char stat_buff[30]; |
dicarloj | 9:2a47b9ff8911 | 639 | sprintf(stat_buff,"f: %d",i); |
dicarloj | 9:2a47b9ff8911 | 640 | set_status_string(stat_buff); |
dicarloj | 9:2a47b9ff8911 | 641 | //wait_us(10000); |
dicarloj | 9:2a47b9ff8911 | 642 | |
dicarloj | 9:2a47b9ff8911 | 643 | spin_for_a_while(200); |
dicarloj | 9:2a47b9ff8911 | 644 | clr(); |
dicarloj | 9:2a47b9ff8911 | 645 | int xp = MIN(XL,i); |
dicarloj | 9:2a47b9ff8911 | 646 | int yp = MIN(YL,i); |
dicarloj | 9:2a47b9ff8911 | 647 | draw_line(X0, Y0, X0 + xp, Y0); |
dicarloj | 9:2a47b9ff8911 | 648 | draw_line(X0+xp,Y0,X0+xp,Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 649 | |
dicarloj | 9:2a47b9ff8911 | 650 | draw_line(X0, Y0+yp, X0 +xp, Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 651 | draw_line(X0,Y0,X0,Y0+yp); |
dicarloj | 9:2a47b9ff8911 | 652 | float phase = (float)(i) / (float)MAX(XL,YL); |
dicarloj | 9:2a47b9ff8911 | 653 | draw_miters_at(xp/2 + 20*cos(.11f*i) + 80 + (x_correct * phase),yp/2 + 20*sin(.11f*i) + 80 + (y_correct * phase)); |
dicarloj | 9:2a47b9ff8911 | 654 | //draw_vincent(100,100,15); |
bwang | 4:02e3ae7a3aea | 655 | } |
bwang | 4:02e3ae7a3aea | 656 | |
dicarloj | 9:2a47b9ff8911 | 657 | clear_all_text(); |
dicarloj | 9:2a47b9ff8911 | 658 | draw_vincent_string("Welcome to LISP MACHINE"); |
dicarloj | 9:2a47b9ff8911 | 659 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 660 | draw_vincent_string("Connect over USB serial"); |
dicarloj | 9:2a47b9ff8911 | 661 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 662 | draw_vincent_string("115200 baud"); |
dicarloj | 9:2a47b9ff8911 | 663 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 664 | draw_vincent_string("use 'clear' to clear"); |
dicarloj | 9:2a47b9ff8911 | 665 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 666 | draw_vincent_string("use '^' to use 3D MODE"); |
dicarloj | 9:2a47b9ff8911 | 667 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 668 | draw_vincent_string(">"); |
dicarloj | 9:2a47b9ff8911 | 669 | // main loop |
dicarloj | 10:1163fb31b0a7 | 670 | want_gfx = 1; |
dicarloj | 11:537cde55b27f | 671 | |
dicarloj | 9:2a47b9ff8911 | 672 | for(;;) |
dicarloj | 9:2a47b9ff8911 | 673 | { |
dicarloj | 9:2a47b9ff8911 | 674 | if(want_lisp) |
dicarloj | 9:2a47b9ff8911 | 675 | { |
dicarloj | 9:2a47b9ff8911 | 676 | new_line(); |
dicarloj | 9:2a47b9ff8911 | 677 | // runs interpreter and prints answer |
dicarloj | 10:1163fb31b0a7 | 678 | run_lisp(text_buffer); |
dicarloj | 10:1163fb31b0a7 | 679 | want_lisp = 0; |
dicarloj | 10:1163fb31b0a7 | 680 | new_line(); |
dicarloj | 10:1163fb31b0a7 | 681 | clr_text_buff(); |
dicarloj | 9:2a47b9ff8911 | 682 | //draw_vincent_string(">"); |
bwang | 6:0a34891a82c7 | 683 | } |
bwang | 6:0a34891a82c7 | 684 | |
dicarloj | 9:2a47b9ff8911 | 685 | if(want_gfx) |
bwang | 6:0a34891a82c7 | 686 | { |
dicarloj | 10:1163fb31b0a7 | 687 | if(!vsync) continue; |
dicarloj | 9:2a47b9ff8911 | 688 | if(!gfx_is_init) |
bwang | 6:0a34891a82c7 | 689 | { |
dicarloj | 9:2a47b9ff8911 | 690 | init_gfx(); |
dicarloj | 9:2a47b9ff8911 | 691 | gfx_is_init = 1; |
dicarloj | 9:2a47b9ff8911 | 692 | } |
dicarloj | 10:1163fb31b0a7 | 693 | clr(); |
dicarloj | 11:537cde55b27f | 694 | float j2 = joy1.read() - .5f;; |
dicarloj | 11:537cde55b27f | 695 | float j1 = joy2.read() - .5f; |
dicarloj | 11:537cde55b27f | 696 | new_frame(j1,j2); |
dicarloj | 9:2a47b9ff8911 | 697 | draw_line(X0, Y0, X0 + XL, Y0); |
dicarloj | 9:2a47b9ff8911 | 698 | draw_line(X0+XL,Y0,X0+XL,Y0+YL); |
dicarloj | 9:2a47b9ff8911 | 699 | draw_line(X0, Y0+YL, X0 +XL, Y0+YL); |
dicarloj | 9:2a47b9ff8911 | 700 | draw_line(X0,Y0,X0,Y0+YL); |
dicarloj | 10:1163fb31b0a7 | 701 | most_recent_char = '0'; |
dicarloj | 10:1163fb31b0a7 | 702 | //spin_for_a_while(400); |
dicarloj | 10:1163fb31b0a7 | 703 | |
dicarloj | 11:537cde55b27f | 704 | |
dicarloj | 11:537cde55b27f | 705 | |
dicarloj | 11:537cde55b27f | 706 | // if(color) |
dicarloj | 11:537cde55b27f | 707 | // { |
dicarloj | 11:537cde55b27f | 708 | // for(int i = 0; i < XL; i++) |
dicarloj | 11:537cde55b27f | 709 | // draw_line(X0+i,Y0,X0+i,Y0+YL); |
dicarloj | 11:537cde55b27f | 710 | // color = 0; |
dicarloj | 11:537cde55b27f | 711 | // } |
dicarloj | 11:537cde55b27f | 712 | // else |
dicarloj | 11:537cde55b27f | 713 | // color = 1; |
dicarloj | 11:537cde55b27f | 714 | |
dicarloj | 11:537cde55b27f | 715 | //color = !color; |
dicarloj | 9:2a47b9ff8911 | 716 | //draw_gfx_line(-0.01,-0.01,0.01,0.01); |
dicarloj | 11:537cde55b27f | 717 | char joy_string[20]; |
dicarloj | 11:537cde55b27f | 718 | sprintf(joy_string,"1: %.2f 2: %.2f",joy1.read(),joy2.read()); |
dicarloj | 11:537cde55b27f | 719 | //set_status_string(joy_string); |
dicarloj | 9:2a47b9ff8911 | 720 | set_status_string(get_gfx_stat()); |
dicarloj | 10:1163fb31b0a7 | 721 | vsync = 0; |
dicarloj | 9:2a47b9ff8911 | 722 | //swap_buffers(); |
dicarloj | 9:2a47b9ff8911 | 723 | |
bwang | 6:0a34891a82c7 | 724 | } |
bwang | 6:0a34891a82c7 | 725 | } |
bwang | 6:0a34891a82c7 | 726 | } |
bwang | 6:0a34891a82c7 | 727 | |
dicarloj | 9:2a47b9ff8911 | 728 |