Test
Dependencies: mbed LCD_DISCO_F469NI BSP_DISCO_F469NI
main.cpp@1:23e3deac03b1, 2022-03-05 (annotated)
- Committer:
- dkm1978
- Date:
- Sat Mar 05 17:29:25 2022 +0000
- Revision:
- 1:23e3deac03b1
- Parent:
- 0:dc8fbcb55376
q
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dkm1978 | 1:23e3deac03b1 | 1 | /*******************************************************************************/ |
dkm1978 | 1:23e3deac03b1 | 2 | |
dkm1978 | 0:dc8fbcb55376 | 3 | #include "mbed.h" |
dkm1978 | 0:dc8fbcb55376 | 4 | #include "LCD_DISCO_F469NI.h" |
dkm1978 | 1:23e3deac03b1 | 5 | #include "table.h" |
dkm1978 | 1:23e3deac03b1 | 6 | |
dkm1978 | 1:23e3deac03b1 | 7 | /*******************************************************************************/ |
dkm1978 | 0:dc8fbcb55376 | 8 | |
dkm1978 | 0:dc8fbcb55376 | 9 | LCD_DISCO_F469NI lcd; |
dkm1978 | 1:23e3deac03b1 | 10 | DigitalOut led1(LED1); |
dkm1978 | 0:dc8fbcb55376 | 11 | |
dkm1978 | 1:23e3deac03b1 | 12 | /*******************************************************************************/ |
dkm1978 | 1:23e3deac03b1 | 13 | |
dkm1978 | 1:23e3deac03b1 | 14 | volatile uint8_t mat_A, mat_B, mat_C, mat_D, mat_E, mat_F ; |
dkm1978 | 1:23e3deac03b1 | 15 | |
dkm1978 | 1:23e3deac03b1 | 16 | uint8_t tb_fact1[4]; // circle prescale factors 4 circles top and 4 mirroring to bottom |
dkm1978 | 1:23e3deac03b1 | 17 | uint8_t tb_fact2[4]; // |
dkm1978 | 1:23e3deac03b1 | 18 | |
dkm1978 | 1:23e3deac03b1 | 19 | uint8_t multable[128][256]; // a prescale table |
dkm1978 | 1:23e3deac03b1 | 20 | |
dkm1978 | 1:23e3deac03b1 | 21 | uint8_t wynik_X[8]; // X poss first 8 plots |
dkm1978 | 1:23e3deac03b1 | 22 | uint8_t wynik_Y[8]; // Y poss first 8 plots |
dkm1978 | 1:23e3deac03b1 | 23 | |
dkm1978 | 1:23e3deac03b1 | 24 | uint8_t plot_1X[128]; // first buffer 128 plot X values |
dkm1978 | 1:23e3deac03b1 | 25 | uint8_t plot_1Y[128]; // first buffer 128 plot Y values |
dkm1978 | 1:23e3deac03b1 | 26 | uint8_t plot_2X[128]; // 2nd buffer 128 plot X values |
dkm1978 | 1:23e3deac03b1 | 27 | uint8_t plot_2Y[128]; // 2nd buffer 128 plot Y values |
dkm1978 | 1:23e3deac03b1 | 28 | |
dkm1978 | 1:23e3deac03b1 | 29 | void calculate_matrix() |
dkm1978 | 1:23e3deac03b1 | 30 | { |
dkm1978 | 1:23e3deac03b1 | 31 | volatile uint8_t t1, t2, t3, t4, t5, t6, t7, t8, t9, t10 ; |
dkm1978 | 1:23e3deac03b1 | 32 | static volatile uint16_t delta_x = 0x0100; |
dkm1978 | 1:23e3deac03b1 | 33 | static volatile uint16_t delta_y = 0xff00; |
dkm1978 | 1:23e3deac03b1 | 34 | static volatile uint16_t delta_z = 0xff00; |
dkm1978 | 1:23e3deac03b1 | 35 | |
dkm1978 | 1:23e3deac03b1 | 36 | static volatile uint16_t angle_x = 0x00; |
dkm1978 | 1:23e3deac03b1 | 37 | static volatile uint16_t angle_y = 0x00; |
dkm1978 | 1:23e3deac03b1 | 38 | static volatile uint16_t angle_z = 0x00; |
dkm1978 | 1:23e3deac03b1 | 39 | |
dkm1978 | 1:23e3deac03b1 | 40 | static volatile uint8_t sx; |
dkm1978 | 1:23e3deac03b1 | 41 | static volatile uint8_t sy; |
dkm1978 | 1:23e3deac03b1 | 42 | static volatile uint8_t sz; |
dkm1978 | 1:23e3deac03b1 | 43 | |
dkm1978 | 1:23e3deac03b1 | 44 | |
dkm1978 | 1:23e3deac03b1 | 45 | |
dkm1978 | 1:23e3deac03b1 | 46 | /* update_angles */ |
dkm1978 | 1:23e3deac03b1 | 47 | angle_x = angle_x + delta_x; |
dkm1978 | 1:23e3deac03b1 | 48 | angle_y = angle_y + delta_y; |
dkm1978 | 1:23e3deac03b1 | 49 | angle_z = angle_z + delta_z; |
dkm1978 | 1:23e3deac03b1 | 50 | |
dkm1978 | 1:23e3deac03b1 | 51 | sx = (uint8_t) ((angle_x)>>8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 52 | sy = (uint8_t) ((angle_y)>>8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 53 | sz = (uint8_t) ((angle_z)>>8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 54 | |
dkm1978 | 1:23e3deac03b1 | 55 | t1 = sy-sz; |
dkm1978 | 1:23e3deac03b1 | 56 | t2 = sy+sz; |
dkm1978 | 1:23e3deac03b1 | 57 | t3 = sx+sz; |
dkm1978 | 1:23e3deac03b1 | 58 | t4 = sx-sz; |
dkm1978 | 1:23e3deac03b1 | 59 | t5 = sx+sy+sz; |
dkm1978 | 1:23e3deac03b1 | 60 | t6 = sx-sy+sz; |
dkm1978 | 1:23e3deac03b1 | 61 | t7 = sx+sy-sz; |
dkm1978 | 1:23e3deac03b1 | 62 | t8 = sy+sz-sx; |
dkm1978 | 1:23e3deac03b1 | 63 | t9 = sy-sx; |
dkm1978 | 1:23e3deac03b1 | 64 | t10 = sy+sx; |
dkm1978 | 1:23e3deac03b1 | 65 | |
dkm1978 | 1:23e3deac03b1 | 66 | |
dkm1978 | 1:23e3deac03b1 | 67 | |
dkm1978 | 1:23e3deac03b1 | 68 | |
dkm1978 | 1:23e3deac03b1 | 69 | mat_A = (uint8_t) ((sinus[64 + t1] + sinus[64 + t2]) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 70 | mat_B = (uint8_t) ((sinus[t1] - sinus[t2]) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 71 | mat_C = (uint8_t) ((sinus[128+sy] + sinus[128+sy]) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 72 | mat_D = (uint8_t) ((sinus[t3] - sinus[t4] + ((sinus[64+t6] - sinus[64+t5] + sinus[64+t8] - sinus[64+t7]) / 2)) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 73 | mat_E = (uint8_t) ((sinus[64+t3] + sinus[64+t4] + ((sinus[t5] - sinus[t6] - sinus[t7] - sinus[t8]) / 2)) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 74 | mat_F = (uint8_t) ((sinus[128 + t9] - sinus[128 + t10]) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 75 | |
dkm1978 | 1:23e3deac03b1 | 76 | |
dkm1978 | 1:23e3deac03b1 | 77 | |
dkm1978 | 1:23e3deac03b1 | 78 | } |
dkm1978 | 1:23e3deac03b1 | 79 | //==================================================================================================== |
dkm1978 | 1:23e3deac03b1 | 80 | void insert_dots() |
dkm1978 | 1:23e3deac03b1 | 81 | { |
dkm1978 | 1:23e3deac03b1 | 82 | volatile uint8_t i, i2, i3, dana, t9, t10, sx, sy, sz; |
dkm1978 | 1:23e3deac03b1 | 83 | volatile uint8_t t_x; |
dkm1978 | 1:23e3deac03b1 | 84 | volatile uint16_t wynik; |
dkm1978 | 1:23e3deac03b1 | 85 | |
dkm1978 | 1:23e3deac03b1 | 86 | |
dkm1978 | 1:23e3deac03b1 | 87 | t_x = 0x48; |
dkm1978 | 1:23e3deac03b1 | 88 | i2 = 0; |
dkm1978 | 1:23e3deac03b1 | 89 | for(i=3 ; i!=0xff ; i--) |
dkm1978 | 1:23e3deac03b1 | 90 | { |
dkm1978 | 1:23e3deac03b1 | 91 | t_x = t_x - 0x10; |
dkm1978 | 1:23e3deac03b1 | 92 | sx = t_x & 0x3F; |
dkm1978 | 1:23e3deac03b1 | 93 | sy = 0; |
dkm1978 | 1:23e3deac03b1 | 94 | sz = 0; |
dkm1978 | 1:23e3deac03b1 | 95 | |
dkm1978 | 1:23e3deac03b1 | 96 | //;--------------------- |
dkm1978 | 1:23e3deac03b1 | 97 | //; F = invsin(t9)-invsin(t10) |
dkm1978 | 1:23e3deac03b1 | 98 | //;--------------------- |
dkm1978 | 1:23e3deac03b1 | 99 | t9 = sy-sx; |
dkm1978 | 1:23e3deac03b1 | 100 | t10 = sy+sx; |
dkm1978 | 1:23e3deac03b1 | 101 | mat_F = (uint8_t) ((sinus[128 + t9] - sinus[128 + t10]) >> 8) & 0xFF; |
dkm1978 | 1:23e3deac03b1 | 102 | |
dkm1978 | 1:23e3deac03b1 | 103 | #ifdef debug_matrix |
dkm1978 | 1:23e3deac03b1 | 104 | printf("mat_F = 0x%X \n", mat_F); |
dkm1978 | 1:23e3deac03b1 | 105 | #endif |
dkm1978 | 1:23e3deac03b1 | 106 | |
dkm1978 | 1:23e3deac03b1 | 107 | tb_fact1[i] = mat_F; |
dkm1978 | 1:23e3deac03b1 | 108 | tb_fact2[i2] = tb_fact1[i]; |
dkm1978 | 1:23e3deac03b1 | 109 | i2++; |
dkm1978 | 1:23e3deac03b1 | 110 | }; |
dkm1978 | 1:23e3deac03b1 | 111 | for(i=0 ; i<128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 112 | { |
dkm1978 | 1:23e3deac03b1 | 113 | plot_1X[i]; |
dkm1978 | 1:23e3deac03b1 | 114 | plot_1Y[i]; |
dkm1978 | 1:23e3deac03b1 | 115 | plot_2X[i]; |
dkm1978 | 1:23e3deac03b1 | 116 | plot_2Y[i]; |
dkm1978 | 1:23e3deac03b1 | 117 | } |
dkm1978 | 1:23e3deac03b1 | 118 | dana = 0; |
dkm1978 | 1:23e3deac03b1 | 119 | for(i=0 ; i<128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 120 | { |
dkm1978 | 1:23e3deac03b1 | 121 | wynik = 0; |
dkm1978 | 1:23e3deac03b1 | 122 | i3 = 0; |
dkm1978 | 1:23e3deac03b1 | 123 | for(i2=0 ; i2<128 ; i2++) |
dkm1978 | 1:23e3deac03b1 | 124 | { |
dkm1978 | 1:23e3deac03b1 | 125 | multable[i][i2] = (uint8_t) (((wynik) >> 8) & 0xFF); |
dkm1978 | 1:23e3deac03b1 | 126 | wynik = wynik + dana; |
dkm1978 | 1:23e3deac03b1 | 127 | i3--; |
dkm1978 | 1:23e3deac03b1 | 128 | multable[i][i3] = (uint8_t) (0 - multable[i][i2]); |
dkm1978 | 1:23e3deac03b1 | 129 | } |
dkm1978 | 1:23e3deac03b1 | 130 | dana = dana +2; |
dkm1978 | 1:23e3deac03b1 | 131 | }; |
dkm1978 | 1:23e3deac03b1 | 132 | } |
dkm1978 | 1:23e3deac03b1 | 133 | //=========================================================================== |
dkm1978 | 1:23e3deac03b1 | 134 | void calc_all_dots_01() |
dkm1978 | 1:23e3deac03b1 | 135 | { |
dkm1978 | 1:23e3deac03b1 | 136 | volatile uint8_t row1, row2, i, i2, i3; |
dkm1978 | 1:23e3deac03b1 | 137 | volatile uint8_t add_x , add_y ; |
dkm1978 | 1:23e3deac03b1 | 138 | |
dkm1978 | 1:23e3deac03b1 | 139 | i2 = 0; |
dkm1978 | 1:23e3deac03b1 | 140 | for(i3 = 0; i3 < 4 ; i3++) |
dkm1978 | 1:23e3deac03b1 | 141 | { |
dkm1978 | 1:23e3deac03b1 | 142 | row1 = tb_fact1[i3]; |
dkm1978 | 1:23e3deac03b1 | 143 | |
dkm1978 | 1:23e3deac03b1 | 144 | add_x = multable[row1][mat_C]; |
dkm1978 | 1:23e3deac03b1 | 145 | add_y = multable[row1][mat_F]; |
dkm1978 | 1:23e3deac03b1 | 146 | |
dkm1978 | 1:23e3deac03b1 | 147 | row2 = tb_fact2[i3]; |
dkm1978 | 1:23e3deac03b1 | 148 | |
dkm1978 | 1:23e3deac03b1 | 149 | |
dkm1978 | 1:23e3deac03b1 | 150 | for(i = 0; i < 8 ; i++) |
dkm1978 | 1:23e3deac03b1 | 151 | { |
dkm1978 | 1:23e3deac03b1 | 152 | plot_1X[i2] = ((multable[row2][wynik_X[i]] + add_x) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 153 | plot_1X[i2+1] = (plot_1X[i2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 154 | plot_1Y[i2] = ((multable[row2][wynik_Y[i]] + add_y) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 155 | plot_1Y[i2+1] = (plot_1Y[i2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 156 | |
dkm1978 | 1:23e3deac03b1 | 157 | plot_1X[i2+2] = ((multable[row2][wynik_X[i]] - add_x) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 158 | plot_1X[i2+3] = (plot_1X[i2+2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 159 | plot_1Y[i2+2] = ((multable[row2][wynik_Y[i]] - add_y) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 160 | plot_1Y[i2+3] = (plot_1Y[i2+2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 161 | |
dkm1978 | 1:23e3deac03b1 | 162 | i2 = i2 + 4; |
dkm1978 | 1:23e3deac03b1 | 163 | } |
dkm1978 | 1:23e3deac03b1 | 164 | } |
dkm1978 | 1:23e3deac03b1 | 165 | } |
dkm1978 | 1:23e3deac03b1 | 166 | //================================================================================ |
dkm1978 | 1:23e3deac03b1 | 167 | void calc_all_dots_02() |
dkm1978 | 1:23e3deac03b1 | 168 | { |
dkm1978 | 1:23e3deac03b1 | 169 | volatile uint8_t row1, row2, i, i2, i3; |
dkm1978 | 1:23e3deac03b1 | 170 | volatile uint8_t add_x , add_y ; |
dkm1978 | 1:23e3deac03b1 | 171 | |
dkm1978 | 1:23e3deac03b1 | 172 | i2 = 0; |
dkm1978 | 1:23e3deac03b1 | 173 | // 4 times calculate and mirroring circles = 4*16*2 = 128 vectordots |
dkm1978 | 1:23e3deac03b1 | 174 | for(i3 = 0; i3 < 4 ; i3++) |
dkm1978 | 1:23e3deac03b1 | 175 | { |
dkm1978 | 1:23e3deac03b1 | 176 | row1 = tb_fact1[i3]; // prescale factor for X/Y offset data (add_x;add_y) |
dkm1978 | 1:23e3deac03b1 | 177 | |
dkm1978 | 1:23e3deac03b1 | 178 | add_x = multable[row1][mat_C]; // X offset after prescale circle = possitoin X;Y 0;0 |
dkm1978 | 1:23e3deac03b1 | 179 | add_y = multable[row1][mat_F]; // Y offset after prescale circle |
dkm1978 | 1:23e3deac03b1 | 180 | |
dkm1978 | 1:23e3deac03b1 | 181 | row2 = tb_fact2[i3]; // prescale factor for actual circle |
dkm1978 | 1:23e3deac03b1 | 182 | |
dkm1978 | 1:23e3deac03b1 | 183 | // calculate 32 X;Y values of plots in mirroring 2nd circles |
dkm1978 | 1:23e3deac03b1 | 184 | for(i = 0; i < 8 ; i++) |
dkm1978 | 1:23e3deac03b1 | 185 | { |
dkm1978 | 1:23e3deac03b1 | 186 | plot_2X[i2] = ((multable[row2][wynik_X[i]] + add_x) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 187 | plot_2X[i2+1] = (plot_2X[i2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 188 | plot_2Y[i2] = ((multable[row2][wynik_Y[i]] + add_y) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 189 | plot_2Y[i2+1] = (plot_2Y[i2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 190 | |
dkm1978 | 1:23e3deac03b1 | 191 | plot_2X[i2+2] = ((multable[row2][wynik_X[i]] - add_x) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 192 | plot_2X[i2+3] = (plot_2X[i2+2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 193 | plot_2Y[i2+2] = ((multable[row2][wynik_Y[i]] - add_y) ^ 128); |
dkm1978 | 1:23e3deac03b1 | 194 | plot_2Y[i2+3] = (plot_2Y[i2+2] ^ 255); |
dkm1978 | 1:23e3deac03b1 | 195 | |
dkm1978 | 1:23e3deac03b1 | 196 | i2 = i2 + 4; |
dkm1978 | 1:23e3deac03b1 | 197 | } |
dkm1978 | 1:23e3deac03b1 | 198 | } |
dkm1978 | 1:23e3deac03b1 | 199 | } |
dkm1978 | 1:23e3deac03b1 | 200 | //================================================================================== |
dkm1978 | 1:23e3deac03b1 | 201 | void calculate_8_dots() |
dkm1978 | 1:23e3deac03b1 | 202 | { |
dkm1978 | 1:23e3deac03b1 | 203 | volatile uint8_t row1, row2; |
dkm1978 | 1:23e3deac03b1 | 204 | volatile uint8_t v1, v2, v4, v5; |
dkm1978 | 1:23e3deac03b1 | 205 | volatile uint8_t i, i2; |
dkm1978 | 1:23e3deac03b1 | 206 | |
dkm1978 | 1:23e3deac03b1 | 207 | // calculate first 8 dots to following prescale and mirroring |
dkm1978 | 1:23e3deac03b1 | 208 | |
dkm1978 | 1:23e3deac03b1 | 209 | i2 = 0; |
dkm1978 | 1:23e3deac03b1 | 210 | for(i = 0 ; i < 4 ; i++) |
dkm1978 | 1:23e3deac03b1 | 211 | { |
dkm1978 | 1:23e3deac03b1 | 212 | |
dkm1978 | 1:23e3deac03b1 | 213 | row1 = tb_fact1[i]; |
dkm1978 | 1:23e3deac03b1 | 214 | row2 = tb_fact2[i]; |
dkm1978 | 1:23e3deac03b1 | 215 | |
dkm1978 | 1:23e3deac03b1 | 216 | v5 = multable[row1][mat_E]; |
dkm1978 | 1:23e3deac03b1 | 217 | v2 = multable[row1][mat_B]; |
dkm1978 | 1:23e3deac03b1 | 218 | v4 = multable[row2][mat_D]; |
dkm1978 | 1:23e3deac03b1 | 219 | v1 = multable[row2][mat_A]; |
dkm1978 | 1:23e3deac03b1 | 220 | |
dkm1978 | 1:23e3deac03b1 | 221 | wynik_X[i2] = v1 + v2; |
dkm1978 | 1:23e3deac03b1 | 222 | wynik_Y[i2] = v4 + v5; |
dkm1978 | 1:23e3deac03b1 | 223 | wynik_X[i2+1] = v1 - v2; |
dkm1978 | 1:23e3deac03b1 | 224 | wynik_Y[i2+1] = v4 - v5; |
dkm1978 | 1:23e3deac03b1 | 225 | |
dkm1978 | 1:23e3deac03b1 | 226 | #ifdef debug_matrix |
dkm1978 | 1:23e3deac03b1 | 227 | printf("wynik_X[%d] = 0x%X \n", i2 , wynik_X[i2]); |
dkm1978 | 1:23e3deac03b1 | 228 | printf("wynik_Y[%d] = 0x%X \n", i2 , wynik_Y[i2]); |
dkm1978 | 1:23e3deac03b1 | 229 | printf("wynik_X[%d] = 0x%X \n", i2+1 , wynik_X[i2+1]); |
dkm1978 | 1:23e3deac03b1 | 230 | printf("wynik_Y[%d] = 0x%X \n", i2+1 , wynik_Y[i2+1]); |
dkm1978 | 1:23e3deac03b1 | 231 | #endif |
dkm1978 | 1:23e3deac03b1 | 232 | |
dkm1978 | 1:23e3deac03b1 | 233 | #ifdef show_first_pixels |
dkm1978 | 1:23e3deac03b1 | 234 | putpixel(wynik_X[i2] ^ 128 , wynik_Y[i2] ^ 128 , WHITE); |
dkm1978 | 1:23e3deac03b1 | 235 | putpixel(wynik_X[i2+1] ^ 128 , wynik_Y[i2+1] ^ 128 , WHITE); |
dkm1978 | 1:23e3deac03b1 | 236 | #endif |
dkm1978 | 1:23e3deac03b1 | 237 | /* |
dkm1978 | 1:23e3deac03b1 | 238 | $7A $15 ; $7A $E7 ; $68 $42 ; $66 $BA |
dkm1978 | 1:23e3deac03b1 | 239 | $46 $66 ; $42 $98 ; $19 $7A ; $15 $86 |
dkm1978 | 1:23e3deac03b1 | 240 | */ |
dkm1978 | 1:23e3deac03b1 | 241 | i2 = i2 +2; |
dkm1978 | 1:23e3deac03b1 | 242 | |
dkm1978 | 1:23e3deac03b1 | 243 | } |
dkm1978 | 1:23e3deac03b1 | 244 | } |
dkm1978 | 1:23e3deac03b1 | 245 | |
dkm1978 | 1:23e3deac03b1 | 246 | |
dkm1978 | 0:dc8fbcb55376 | 247 | |
dkm1978 | 0:dc8fbcb55376 | 248 | int main() |
dkm1978 | 0:dc8fbcb55376 | 249 | { |
dkm1978 | 0:dc8fbcb55376 | 250 | led1 = 1; |
dkm1978 | 1:23e3deac03b1 | 251 | lcd.Clear(0); |
dkm1978 | 1:23e3deac03b1 | 252 | lcd.SetTextColor(LCD_COLOR_WHITE); |
dkm1978 | 1:23e3deac03b1 | 253 | int x, y, color, angle = 0; |
dkm1978 | 1:23e3deac03b1 | 254 | uint8_t i, wait=10; |
dkm1978 | 1:23e3deac03b1 | 255 | insert_dots(); |
dkm1978 | 1:23e3deac03b1 | 256 | |
dkm1978 | 0:dc8fbcb55376 | 257 | |
dkm1978 | 1:23e3deac03b1 | 258 | |
dkm1978 | 0:dc8fbcb55376 | 259 | |
dkm1978 | 0:dc8fbcb55376 | 260 | while(1) |
dkm1978 | 0:dc8fbcb55376 | 261 | { |
dkm1978 | 1:23e3deac03b1 | 262 | |
dkm1978 | 1:23e3deac03b1 | 263 | calculate_matrix(); |
dkm1978 | 1:23e3deac03b1 | 264 | calculate_8_dots(); |
dkm1978 | 1:23e3deac03b1 | 265 | calc_all_dots_01(); // store plots values in first buffer |
dkm1978 | 1:23e3deac03b1 | 266 | |
dkm1978 | 1:23e3deac03b1 | 267 | |
dkm1978 | 1:23e3deac03b1 | 268 | // clear old plots |
dkm1978 | 1:23e3deac03b1 | 269 | for(i = 0; i < 128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 270 | { |
dkm1978 | 1:23e3deac03b1 | 271 | lcd.DrawPixel(plot_2X[i] +272 , plot_2Y[i]+112 , 0); |
dkm1978 | 1:23e3deac03b1 | 272 | } |
dkm1978 | 1:23e3deac03b1 | 273 | // set the new plots |
dkm1978 | 1:23e3deac03b1 | 274 | for(i = 0; i < 128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 275 | { |
dkm1978 | 1:23e3deac03b1 | 276 | lcd.DrawPixel(plot_1X[i] +272 , plot_1Y[i]+112, LCD_COLOR_WHITE); |
dkm1978 | 1:23e3deac03b1 | 277 | } |
dkm1978 | 1:23e3deac03b1 | 278 | |
dkm1978 | 1:23e3deac03b1 | 279 | calculate_matrix(); |
dkm1978 | 1:23e3deac03b1 | 280 | calculate_8_dots(); |
dkm1978 | 1:23e3deac03b1 | 281 | calc_all_dots_02(); // store plots values in 2nd buffer |
dkm1978 | 1:23e3deac03b1 | 282 | wait_ms(10); |
dkm1978 | 1:23e3deac03b1 | 283 | |
dkm1978 | 1:23e3deac03b1 | 284 | // clear old plots |
dkm1978 | 1:23e3deac03b1 | 285 | for(i = 0; i < 128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 286 | { |
dkm1978 | 1:23e3deac03b1 | 287 | lcd.DrawPixel(plot_1X[i]+272 , plot_1Y[i]+112 , 0); |
dkm1978 | 1:23e3deac03b1 | 288 | } |
dkm1978 | 1:23e3deac03b1 | 289 | // set the new plots |
dkm1978 | 1:23e3deac03b1 | 290 | for(i = 0; i < 128 ; i++) |
dkm1978 | 1:23e3deac03b1 | 291 | { |
dkm1978 | 1:23e3deac03b1 | 292 | lcd.DrawPixel(plot_2X[i]+272 , plot_2Y[i]+112 , LCD_COLOR_WHITE); |
dkm1978 | 1:23e3deac03b1 | 293 | } |
dkm1978 | 1:23e3deac03b1 | 294 | |
dkm1978 | 1:23e3deac03b1 | 295 | while (!(LTDC->CDSR & LTDC_CDSR_VSYNCS)); |
dkm1978 | 0:dc8fbcb55376 | 296 | |
dkm1978 | 1:23e3deac03b1 | 297 | |
dkm1978 | 0:dc8fbcb55376 | 298 | |
dkm1978 | 0:dc8fbcb55376 | 299 | led1 = !led1; |
dkm1978 | 1:23e3deac03b1 | 300 | wait_ms(25); |
dkm1978 | 1:23e3deac03b1 | 301 | |
dkm1978 | 0:dc8fbcb55376 | 302 | } |
dkm1978 | 0:dc8fbcb55376 | 303 | } |
dkm1978 | 0:dc8fbcb55376 | 304 |