2 #include "oswald_hal.h"
3 #include "oswald_strings.h"
6 #include "LcdDisplay.h"
8 void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
10 int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
15 incx = (dx >= 0) ? 1 : -1;
16 incy = (dy >= 0) ? 1 : -1;
36 hal_lcd_set_pixel(x, y, TRUE);
38 for (t = 0; t < el; ++t) {
48 hal_lcd_set_pixel(x, y, TRUE);
50 // lcd_update_display();
53 void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
55 int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
60 incx = (dx >= 0) ? 1 : -1;
61 incy = (dy >= 0) ? 1 : -1;
81 hal_lcd_set_pixel(x, y, TRUE);
82 for (i=1; i<thickness; i++) {
83 hal_lcd_set_pixel(x-i, y, TRUE);
84 hal_lcd_set_pixel(x+i, y, TRUE);
85 hal_lcd_set_pixel(x, y-i, TRUE);
86 hal_lcd_set_pixel(x, y+i, TRUE);
89 for (t = 0; t < el; ++t) {
99 hal_lcd_set_pixel(x, y, TRUE);
100 for (i=1; i<thickness; i++) {
101 hal_lcd_set_pixel(x-i, y, TRUE);
102 hal_lcd_set_pixel(x+i, y, TRUE);
103 hal_lcd_set_pixel(x, y-i, TRUE);
104 hal_lcd_set_pixel(x, y+i, TRUE);
107 // lcd_update_display();
110 u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
112 u8t CharacterHeight = GetCharacterHeight();
113 u8t CharacterWidth = GetCharacterWidth(Character);
114 u16t bitmap[MAX_FONT_ROWS];
117 GetCharacterBitmap(Character, bitmap);
119 // printf("cw=%d ch=%d\n", CharacterWidth, CharacterHeight);
120 for (ly=0; ly<CharacterHeight; ly++) {
121 for (lx=0; lx<CharacterWidth; lx++) {
122 if (bitmap[ly] & (1<<lx)) {
123 hal_lcd_set_pixel(lx+x, ly+y, TRUE);
126 hal_lcd_set_pixel(lx+x, ly+y, FALSE);
132 // lcd_update_display();
133 return CharacterWidth + GetFontSpacing();
136 u8t WriteLcdString(u8t x, u8t y, char *str)
140 strl = oswald_strlen(str);
145 for (i=0; i<strl; i++) {
146 lx += WriteLcdCharacter(lx, y, str[i]);
152 void WriteLcdNumber(u8t x, u8t y, s16t number)
157 itoa(number, str, 10);
158 strl = oswald_strlen(str);
163 for (i=0; i<strl; i++) {
164 lx += WriteLcdCharacter(lx, y, str[i]);