1 /* 2 * Example tasks. 3 * 4 * Copyright (C) 2015, 2016 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(unsigned short *x, unsigned short *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 void plot_value(u32 value) 39 { 40 unsigned short x, y; 41 42 while (1) 43 { 44 for (y = 0; y < panel_info.vl_row; y++) 45 { 46 for (x = 0; x < panel_info.vl_col; x++) 47 { 48 set_pixel(x, y, get_bitmap_value(x, value)); 49 } 50 } 51 } 52 } 53 54 /* Tasks. */ 55 56 void plot_pattern(unsigned short pixel_type, unsigned short x, unsigned short y) 57 { 58 int i; 59 60 while (1) { 61 test_pixel(x, y, pixel_type); 62 next_pixel(&x, &y); 63 for (i = 0; i < 10000; i++); 64 } 65 } 66 67 void start_plot_pattern(unsigned short task) 68 { 69 u32 args[] = {task, 0, (task * (panel_info.vl_row / 4)) % panel_info.vl_row}; 70 71 start_task(task, (void (*)()) plot_pattern, args, 3); 72 }