]> git.karo-electronics.de Git - oswald.git/blobdiff - ui/LcdDisplay.c
Lot's of stuff...
[oswald.git] / ui / LcdDisplay.c
index f889bbc4ba7b7b118f95ff2212fd5379a090831d..f4e26c951479ec5052496419d36243d83bb0f40f 100644 (file)
@@ -5,7 +5,23 @@
 
 #include "LcdDisplay.h"
 
-void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
+
+void oswald_draw_bitmap(const uint8_t xstart, const uint8_t ystart, const uint8_t width, const uint8_t height, const void *bmp)
+{
+       uint8_t x, y;
+       uint8_t *cb;
+
+       // we only draw set pixel, unset pixel remain as they are
+       for (y=0; y<height; y++) {
+               for (x=0; x<width; x++) {
+                       cb = (uint8_t *)(bmp + (y * ((width / 8)+((width % 8) ? 1:0))) + (x / 8));
+                       if (*cb & (1 << (x % 8)))
+                               hal_lcd_set_pixel(xstart + x, ystart + y, TRUE);
+               }
+       }
+}
+
+void DrawLcdLineBresenham(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend)
 {
        int x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
@@ -50,7 +66,7 @@ void DrawLcdLineBresenham(u8t xstart, u8t ystart, u8t xend, u8t yend)
        // lcd_update_display();
 }
 
-void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thickness)
+void DrawLcdLineBresenhamWW(const uint8_t xstart, const uint8_t ystart, const uint8_t xend, const uint8_t yend, const uint8_t thickness)
 {
        int i, x, y, t, dx, dy, incx, incy, pdx, pdy, ddx, ddy, es, el, err;
  
@@ -107,7 +123,7 @@ void DrawLcdLineBresenhamWW(u8t xstart, u8t ystart, u8t xend, u8t yend, u8t thic
        // lcd_update_display();
 }
 
-u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
+u8t WriteLcdCharacter(const uint8_t x, const uint8_t y, const uint8_t Character)
 {
        u8t CharacterHeight = GetCharacterHeight();
        u8t CharacterWidth = GetCharacterWidth(Character);
@@ -122,10 +138,10 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
                        if (bitmap[ly] & (1<<lx)) {
                                hal_lcd_set_pixel(lx+x, ly+y, TRUE);
                                // printf(".");
-                       } else {
+                       } /*else {
                                hal_lcd_set_pixel(lx+x, ly+y, FALSE);
                                // printf(" ");
-                       }
+                       }*/
                }
                // printf("\n");
        }
@@ -133,11 +149,11 @@ u8t WriteLcdCharacter(u8t x, u8t y, u8t Character)
        return CharacterWidth + GetFontSpacing();
 }
 
-u8t WriteLcdString(u8t x, u8t y, char *str)
+u8t WriteLcdString(const uint8_t x, const uint8_t y, const char *str)
 {
        int lx, i, strl;
 
-       strl = oswald_strlen(str);
+       strl = oswald_strlen((char *)str);
        if (strl == 0)
                return 0;
 
@@ -149,7 +165,7 @@ u8t WriteLcdString(u8t x, u8t y, char *str)
 }
 
 
-void WriteLcdNumber(u8t x, u8t y, s16t number)
+void WriteLcdNumber(const uint8_t x, const uint8_t y, const int16_t number)
 {
        int lx, i, strl;
        char str[8];