zongqiang.zhang | 0c6a088 | 2019-08-07 14:48:21 +0800 | [diff] [blame] | 1 | /** |
| 2 | * \file unit_tests.c |
| 3 | * \brief Various test functions to demonstrate features of the library |
| 4 | * \author Andy Gock |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | Copyright (c) 2012, Andy Gock |
| 9 | |
| 10 | All rights reserved. |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions are met: |
| 14 | * Redistributions of source code must retain the above copyright |
| 15 | notice, this list of conditions and the following disclaimer. |
| 16 | * Redistributions in binary form must reproduce the above copyright |
| 17 | notice, this list of conditions and the following disclaimer in the |
| 18 | documentation and/or other materials provided with the distribution. |
| 19 | * Neither the name of Andy Gock nor the |
| 20 | names of its contributors may be used to endorse or promote products |
| 21 | derived from this software without specific prior written permission. |
| 22 | |
| 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 26 | DISCLAIMED. IN NO EVENT SHALL ANDY GOCK BE LIABLE FOR ANY |
| 27 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 28 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 29 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 30 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 32 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 | */ |
| 34 | |
| 35 | #include <stdio.h> |
| 36 | #include <stdlib.h> |
| 37 | #include "glcd.h" |
| 38 | #include "unit_tests.h" |
| 39 | |
| 40 | /** Fonts */ |
| 41 | #include "font5x7.h" |
| 42 | #include "Liberation_Sans11x14_Numbers.h" |
| 43 | #include "Liberation_Sans15x21_Numbers.h" |
| 44 | #include "Liberation_Sans17x17_Alpha.h" |
| 45 | #include "Liberation_Sans27x36_Numbers.h" |
| 46 | #include "Bebas_Neue20x36_Bold_Numbers.h" |
| 47 | |
| 48 | volatile uint8_t unit_test_return = 0; |
| 49 | |
| 50 | /** |
| 51 | * Return from test procedure. Global var \p unit_test_return is set to 1 elsewhere, |
| 52 | * to signal function to return. |
| 53 | */ |
| 54 | #define DEMO_RETURN() if (unit_test_return) { unit_test_return = 0; return; } |
| 55 | |
| 56 | #if defined(GLCD_UNIT_TEST_BITMAP_ENABLE) |
| 57 | /* Open Source logo -- Size: 128x64 */ |
| 58 | #if defined(GLCD_DEVICE_AVR8) |
| 59 | const unsigned char bmp_oslogo[] PROGMEM = { |
| 60 | #else |
| 61 | const unsigned char bmp_oslogo[] = { |
| 62 | #endif /* GLCD_DEVICE_AVR8 */ |
| 63 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, 0xc0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf0, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
| 64 | 0xff, 0xfe, 0xfc, 0xf0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x07, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf0, 0xe0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xc0, 0xf0, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x1f, 0x7f, |
| 65 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x1f, 0x0f, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 66 | 0x00 |
| 67 | , 0x00 // |
| 68 | }; |
| 69 | #endif /* GLCD_UNIT_TEST_BITMAP_ENABLE */ |
| 70 | |
| 71 | void glcd_test_circles(void) |
| 72 | { |
| 73 | uint8_t x,y,radius; |
| 74 | |
| 75 | unit_test_return = 0; |
| 76 | while (1) { |
| 77 | uint8_t i; |
| 78 | |
| 79 | glcd_clear(); |
| 80 | |
| 81 | // generate random(ish) position on display |
| 82 | x = rand() % GLCD_LCD_WIDTH; |
| 83 | y = rand() % GLCD_LCD_HEIGHT; |
| 84 | radius = rand() % 50; |
| 85 | |
| 86 | //x = 70; y=25; radius=50; // for debugging |
| 87 | |
| 88 | // fill circle with black |
| 89 | |
| 90 | for (i=0; i<=radius; i++) { |
| 91 | glcd_fill_circle(x,y,i,BLACK); |
| 92 | glcd_write(); |
| 93 | delay_ms(2); |
| 94 | } |
| 95 | |
| 96 | // fill the same circle above but with white |
| 97 | for (i=0; i<=radius; i++) { |
| 98 | glcd_fill_circle(x,y,i,WHITE); |
| 99 | glcd_write(); |
| 100 | delay_ms(1); |
| 101 | } |
| 102 | DEMO_RETURN(); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void glcd_test_counter_and_graph(void) |
| 107 | { |
| 108 | uint8_t count = 0; |
| 109 | char string[8] = ""; |
| 110 | |
| 111 | unit_test_return = 0; |
| 112 | while(1) { |
| 113 | glcd_clear_buffer(); |
| 114 | |
| 115 | //glcd_tiny_set_font(Font5x7,5,7,32,127); |
| 116 | //glcd_draw_string_xy(0,40,(char *)utoa(count,string,10)); |
| 117 | |
| 118 | glcd_set_font(Liberation_Sans15x21_Numbers,15,21,46,57); |
| 119 | //glcd_set_font(Liberation_Sans27x36_Numbers,27,36,46,57); |
| 120 | //glcd_set_font(Bebas_Neue20x36_Bold_Numbers,20,36,46,57); |
| 121 | //glcd_set_font(Bebas_Neue18x36_Numbers,18,36,46,57); |
| 122 | //glcd_set_font(HelveticaNeueLT_Com_57_Cn23x35_Numbers,23,35,46,57); // commercial font - not for public distribution |
| 123 | |
| 124 | sprintf(string,"%d",count); |
| 125 | glcd_draw_string_xy(0,0,string); |
| 126 | glcd_bar_graph_horizontal(10,38,30,6,count*4); |
| 127 | glcd_bar_graph_vertical(70,0,8,30,count*2); |
| 128 | |
| 129 | glcd_write(); |
| 130 | count += 1; |
| 131 | |
| 132 | DEMO_RETURN(); |
| 133 | } |
| 134 | |
| 135 | } |
| 136 | |
| 137 | /* Test glcd-utils font table type, increments and display a 16-bit number over and over */ |
| 138 | #include "Earthbound_12x19_48to57.h" |
| 139 | void glcd_test_glcdutils(void) |
| 140 | { |
| 141 | uint16_t count = 0; |
| 142 | char string[8] = ""; |
| 143 | |
| 144 | unit_test_return = 0; |
| 145 | while(1) { |
| 146 | glcd_clear_buffer(); |
| 147 | |
| 148 | /* Set the font */ |
| 149 | glcd_font(font_Earthbound_12x19_48to57,12,19,48,57,GLCD_UTILS); |
| 150 | |
| 151 | sprintf(string,"%d",count); |
| 152 | glcd_draw_string_xy(0,0,string); |
| 153 | glcd_write(); |
| 154 | |
| 155 | count += 1; |
| 156 | |
| 157 | DEMO_RETURN(); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | void glcd_test_text_up_down(void) |
| 162 | { |
| 163 | // moves some text up and down the display |
| 164 | |
| 165 | uint8_t y; |
| 166 | uint8_t max_y; |
| 167 | |
| 168 | //glcd_set_font(Liberation_Sans11x14_Numbers,11,14,46,57); |
| 169 | glcd_set_font(Liberation_Sans15x21_Numbers,15,21,46,57); |
| 170 | //glcd_set_font(Liberation_Sans27x36_Numbers,27,36,46,57); |
| 171 | //glcd_set_font(Liberation_Sans17x17_Alpha,17,17,46,90); |
| 172 | |
| 173 | max_y = GLCD_LCD_HEIGHT - font_current.height - 2; // max y start position for draw_string |
| 174 | |
| 175 | unit_test_return = 0; |
| 176 | while(1) { |
| 177 | // move top to bottom |
| 178 | for (y=0; y<max_y; y++) { |
| 179 | DEMO_RETURN(); |
| 180 | glcd_clear_buffer(); |
| 181 | glcd_draw_string_xy(0,y,"123"); |
| 182 | glcd_write(); |
| 183 | delay_ms(80); |
| 184 | } |
| 185 | |
| 186 | // move bottom to top |
| 187 | for (y=(max_y); y>0; y--) { |
| 188 | DEMO_RETURN(); |
| 189 | glcd_clear_buffer(); |
| 190 | glcd_draw_string_xy(0,y,"456"); |
| 191 | glcd_write(); |
| 192 | delay_ms(80); |
| 193 | } |
| 194 | |
| 195 | } |
| 196 | |
| 197 | } |
| 198 | |
| 199 | void glcd_test_tiny_text(void) |
| 200 | { |
| 201 | /* Write tiny text on display, all chars, scrolling up every second */ |
| 202 | |
| 203 | char string[GLCD_LCD_WIDTH / 6 + 1]; |
| 204 | |
| 205 | uint8_t c = 32; |
| 206 | uint8_t len = GLCD_LCD_WIDTH / 6; |
| 207 | |
| 208 | GLCD_TEXT_INIT(); |
| 209 | |
| 210 | unit_test_return = 0; |
| 211 | while(1) { |
| 212 | // write chars to string from 32 to 127 ASCII |
| 213 | uint8_t i; |
| 214 | for (i=0; i<len; i++) { |
| 215 | string[i] = c; |
| 216 | c++; |
| 217 | if (c > 127) { |
| 218 | c = 32; |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | // write null terminator |
| 223 | string[len] = '\0'; |
| 224 | |
| 225 | GLCD_WRITE(string); |
| 226 | |
| 227 | DEMO_RETURN(); |
| 228 | |
| 229 | delay_ms(1000); |
| 230 | } |
| 231 | |
| 232 | } |
| 233 | |
| 234 | void glcd_test_hello_world(void) |
| 235 | { |
| 236 | glcd_tiny_set_font(Font5x7,5,7,32,127); |
| 237 | glcd_clear_buffer(); |
| 238 | glcd_tiny_draw_string(0,0,"Hello World!"); |
| 239 | glcd_write(); |
| 240 | |
| 241 | unit_test_return = 0; |
| 242 | while(1) { |
| 243 | DEMO_RETURN(); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | void glcd_test_rectangles(void) |
| 248 | { |
| 249 | glcd_tiny_set_font(Font5x7,5,7,32,127); |
| 250 | glcd_clear_buffer(); |
| 251 | glcd_tiny_draw_string(0,0,"RECTANGLE DEMO"); |
| 252 | glcd_write(); |
| 253 | delay_ms(200); |
| 254 | |
| 255 | unit_test_return = 0; |
| 256 | while(1) { |
| 257 | |
| 258 | //glcd_clear(); |
| 259 | glcd_draw_rect(0,0,100,50,BLACK); |
| 260 | glcd_tiny_draw_string(0,GLCD_NUMBER_OF_BANKS-1,"glcd_draw_rect"); |
| 261 | glcd_write(); |
| 262 | delay_ms(500); |
| 263 | DEMO_RETURN(); |
| 264 | |
| 265 | glcd_clear(); |
| 266 | glcd_tiny_draw_string(0,GLCD_NUMBER_OF_BANKS-1,"glcd_draw_rect_thick"); |
| 267 | glcd_write(); |
| 268 | |
| 269 | glcd_draw_rect_thick(5,5,80,30,3,6,BLACK); |
| 270 | glcd_write(); |
| 271 | delay_ms(500); |
| 272 | DEMO_RETURN(); |
| 273 | |
| 274 | glcd_draw_rect_thick(0,0,20,20,2,2,BLACK); |
| 275 | glcd_write(); |
| 276 | delay_ms(500); |
| 277 | DEMO_RETURN(); |
| 278 | |
| 279 | glcd_draw_rect_thick(100,10,20,20,5,5,BLACK); |
| 280 | glcd_write(); |
| 281 | delay_ms(500); |
| 282 | DEMO_RETURN(); |
| 283 | |
| 284 | glcd_clear(); |
| 285 | glcd_tiny_draw_string(0,GLCD_NUMBER_OF_BANKS-1,"glcd_draw_rect_shadow"); |
| 286 | glcd_draw_rect_shadow(0,0,45,30,BLACK); |
| 287 | glcd_write(); |
| 288 | delay_ms(500); |
| 289 | DEMO_RETURN(); |
| 290 | |
| 291 | glcd_draw_rect_shadow(95,5,30,30,BLACK); |
| 292 | glcd_write(); |
| 293 | delay_ms(500); |
| 294 | DEMO_RETURN(); |
| 295 | |
| 296 | } |
| 297 | |
| 298 | } |
| 299 | |
| 300 | void glcd_test_scrolling_graph(void) |
| 301 | { |
| 302 | glcd_clear(); |
| 303 | glcd_write(); |
| 304 | |
| 305 | unit_test_return = 0; |
| 306 | while(1) { |
| 307 | uint16_t n; |
| 308 | for (n=0; n<=255; n += 20) { |
| 309 | glcd_scrolling_bar_graph(0,0,50,50,n); |
| 310 | glcd_scrolling_bar_graph(60,0,50,30,n); |
| 311 | glcd_scrolling_bar_graph(60,35,60,20,n); |
| 312 | DEMO_RETURN(); |
| 313 | } |
| 314 | for (n=0; n<=255; n += 20) { |
| 315 | glcd_scrolling_bar_graph(0,0,50,50,255-n); |
| 316 | glcd_scrolling_bar_graph(60,0,50,30,n); |
| 317 | glcd_scrolling_bar_graph(60,35,60,20,n); |
| 318 | DEMO_RETURN(); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | #if defined (GLCD_UNIT_TEST_BITMAP_ENABLE) |
| 324 | void glcd_test_bitmap_128x64(void) |
| 325 | { |
| 326 | glcd_draw_bitmap(bmp_oslogo); |
| 327 | |
| 328 | unit_test_return = 0; |
| 329 | glcd_write(); |
| 330 | while (1) { |
| 331 | DEMO_RETURN(); |
| 332 | } |
| 333 | } |
| 334 | #endif |