]> git.defcon.no Git - avrfbosd/blobdiff - fbosd.c
Added support for drawing characters and strings, updated font with "limited ascii...
[avrfbosd] / fbosd.c
diff --git a/fbosd.c b/fbosd.c
index 075fa8042f86d55aef59278286aa5ba28abf56c0..3fe199163b461e1ff216608cfc92987f08ef293c 100644 (file)
--- a/fbosd.c
+++ b/fbosd.c
@@ -8,7 +8,6 @@
 #include "render.h"
 #include "draw.h"
 
-//#include "font.h"
 #include "testimage.h"
 
 void (*line_handler)( void );
@@ -141,37 +140,56 @@ int main(void)
        // Enable interrupts globally.
        sei();
 
-       int counter;
-       
-       // Do some static drawing :P
-       set_pixel(28, 8, 1);
-       set_pixel(92, 82, 1);
+       // Switch ON status LED
+       PORTD |= (uint8_t)(1 << PD6);
 
-       set_pixel(92, 8, 1);
-       set_pixel(28, 82, 1);
+       for (;;)
+       {
+               fill(c_BLACK);
+               Delay_ms(100);
+               
+               draw_string( 2, 2,  "!\"#$%&'()*+-./");
+               draw_string( 2, 10, "01234567890");
+               draw_string( 2, 18, ":;<=>?@");
+               draw_string( 2, 26, "ABCDEFGHIJKLM");
+               draw_string( 2, 34, "NOPQRSTUVWXYZ");
+               draw_string( 2, 42, "[\\]^_`");
+               draw_string( 2, 50, "ABCDEFGHIJKLM");
+               draw_string( 2, 58, "NOPQRSTUVWXYZ");
+               draw_string( 2, 66, "{|}~");
 
-       draw_line(0, 0, 128, 92, c_WHITE);
-       draw_line(128, 0, 0, 92, c_WHITE);
+               draw_char( 10, 80, 127);
+               draw_char( 20, 80, 128);
+               draw_char( 30, 80, 129);
+               draw_char( 40, 80, 130);
 
-       draw_rect( 0, 1, 127, 91, c_WHITE);
+               Delay_ms(500);
+               fill(c_BLACK);
 
-       draw_rect( 34, 21, 60, 50, c_WHITE);
-       _draw_rect( 24, 11, 80, 70, 1, c_NONE);
-       draw_rect( 34, 21, 60, 50, c_WHITE);
+               // Do some static drawing :P
+               set_pixel(28, 8, 1);
+               set_pixel(92, 82, 1);
 
-       fill_circle( 64,46, 45, c_WHITE );
-       fill_circle( 64,46, 40, c_BLACK );
+               set_pixel(92, 8, 1);
+               set_pixel(28, 82, 1);
 
-       _draw_circle( 64,46, 35, 1, c_NONE );
-       draw_circle( 64,46, 30, c_WHITE );
-       fill_rect( 38, 25, 52, 42, c_WHITE);
-       fill_rect( 41, 28, 46, 36, c_BLACK);
+               draw_line(0, 0, 128, 92, c_WHITE);
+               draw_line(128, 0, 0, 92, c_WHITE);
+
+               draw_rect( 0, 1, 127, 91, c_WHITE);
+
+               draw_rect( 34, 21, 60, 50, c_WHITE);
+               _draw_rect( 24, 11, 80, 70, 1, c_NONE);
+               draw_rect( 34, 21, 60, 50, c_WHITE);
+
+               fill_circle( 64,46, 45, c_WHITE );
+               fill_circle( 64,46, 40, c_BLACK );
+
+               _draw_circle( 64,46, 35, 1, c_NONE );
+               draw_circle( 64,46, 30, c_WHITE );
+               fill_rect( 38, 25, 52, 42, c_WHITE);
+               fill_rect( 41, 28, 46, 36, c_BLACK);
 
-       for (counter = 0; counter < 3; counter++)
-       {
-               // Toggle status LED
-               PORTD ^= (uint8_t)(1 << PD6);
-               
                for ( int j = 0; j < 92; j++ )
                {
                        draw_line(0,0,128,j, c_INVERT);
@@ -193,27 +211,25 @@ int main(void)
 
                }
                Delay_ms(250);
-       }
-       fill(c_BLACK);
-       
-       int8_t hp = 10;
-       int8_t vp = 10;
-       
-       for (counter = 0; counter < 100; counter++)
-       {
-               hp += 2;
-               vp += 1;
+               fill(c_BLACK);
                
-               if ( hp > 125 ) hp = 10;
-               if ( vp > VRES ) vp = 10;
+               int8_t hp = 10;
+               int8_t vp = 10;
 
-               pgm_draw_8bpp_bitmap(hp, vp, testimage_width, testimage_height, testimage);
-               Delay_ms(10);
-               fill_rect(hp, vp, testimage_width, testimage_height, 0);
-       }
-       for (;;)
-       {
+               int counter = 0;
+               for (counter = 0; counter < 60; counter++)
+               {
+                       hp += 2;
+                       vp += 1;
+                       
+                       if ( hp > 125 ) hp = 10;
+                       if ( vp > VRES ) vp = 10;
+
+                       pgm_draw_8bpp_bitmap(hp, vp, testimage_width, testimage_height, testimage);
+                       Delay_ms(10);
+                       fill_rect(hp, vp, testimage_width, testimage_height, 0);
+               }
+               
        }
-       
 }