1 /* 2 * Example screen-updating task. 3 * 4 * Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "board.h" 21 #include "lcd.h" 22 #include "jzlcd.h" 23 #include "tasks.h" 24 25 extern vidinfo_t panel_info; 26 27 void next_pixel(uint16_t *x, uint16_t *y) 28 { 29 (*x)++; 30 if (*x >= panel_info.vl_col) { 31 *x = 0; 32 (*y)++; 33 if (*y >= panel_info.vl_row) 34 *y = 0; 35 } 36 } 37 38 /* Tasks. */ 39 40 void plot_pattern(uint16_t pixel_type, uint16_t x, uint16_t y) 41 { 42 int i; 43 44 while (1) { 45 test_pixel(x, y, pixel_type); 46 next_pixel(&x, &y); 47 for (i = 0; i < 10000; i++); 48 } 49 } 50 51 void start_plot_pattern(uint8_t task) 52 { 53 uint32_t args[] = {task, 0, (task * (panel_info.vl_row / 4)) % panel_info.vl_row}; 54 55 start_task(task, (void (*)()) plot_pattern, args, 3); 56 }