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