00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef DISPLAY_H
00019 #define DISPLAY_H
00020
00021 #ifdef HAVE_STDDEF_H
00022 #include <stddef.h>
00023 #endif
00024 #ifdef HAVE_STDINT_H
00025 #include <stdint.h>
00026 #endif
00027 #include <avr/pgmspace.h>
00028 #include "../../font/font.h"
00029
00042 typedef enum {
00043 op_clear = 0b00,
00044 op_invert = 0b01,
00045 op_keep = 0b10,
00046 op_set = 0b11,
00047 } hl_blt_1op;
00048
00049
00050 typedef enum {
00051 op2_clearall = 0b0000,
00052 op2_notand = 0b0001,
00053 op2_0010 = 0b0010,
00054 op2_notsrc = 0b0011,
00055 op2_clearnot = 0b0100,
00056 op2_invert = 0b0101,
00057 op2_xor = 0b0110,
00058 op2_notor = 0b0111,
00059 op2_and = 0b1000,
00060 op2_1001 = 0b1001,
00061 op2_keep = 0b1010,
00062 op2_1011 = 0b1011,
00063 op2_copysrc = 0b1100,
00064 op2_1101 = 0b1101,
00065 op2_or = 0b1110,
00066 op2_setall = 0b1111,
00067 } hl_blt_2op;
00068
00077 void hl_lcd_op_pixel (uint8_t x, uint8_t y, hl_blt_1op op);
00078
00083 void hl_lcd_setall (uint8_t fill);
00084
00087 void hl_lcd_set_font (const font_t * f);
00088
00090 void hl_lcd_get_current_font (font_t * f);
00096 void hl_lcd_set_current_font (const font_t * f);
00097
00107 void hl_lcd_drawchar (uint8_t x, uint8_t y, char c);
00108
00118 void hl_lcd_drawchar_font (uint8_t x, uint8_t y, char c, const font_t * f);
00119
00122 uint8_t hl_lcd_get_charwidth (void) __attribute__((pure));
00125 uint8_t hl_lcd_get_charheight (void) __attribute__((pure));
00126
00133 void hl_lcd_drawstr (uint8_t x, uint8_t y, const char * s);
00136 void hl_lcd_drawstr_P (uint8_t x, uint8_t y, PGM_P s);
00139 void hl_lcd_drawstrn (uint8_t x, uint8_t y, const char * s, size_t len);
00142 void hl_lcd_drawstrn_P (uint8_t x, uint8_t y, PGM_P s, size_t len);
00143
00146 inline void hl_lcd_clear (void) { hl_lcd_setall (0); }
00147
00150 typedef struct rectangle_s {
00151 uint8_t x0, y0;
00152 uint8_t x1, y1;
00153 } rectangle_t;
00154
00162 void hl_lcd_scroll_up (rectangle_t win, uint8_t lines);
00163
00168 void hl_lcd_set_rectangle (uint8_t x0,uint8_t y0, uint8_t x1,uint8_t y1,
00169 hl_blt_1op op);
00170
00175 inline void hl_lcd_set_line_horiz (uint8_t x0, uint8_t y, uint8_t x1,
00176 hl_blt_1op op)
00177 {
00178 hl_lcd_set_rectangle (x0,y, x1,y+1, op);
00179 }
00180
00185 inline void hl_lcd_set_line_vert (uint8_t x, uint8_t y0, uint8_t y1,
00186 hl_blt_1op op)
00187 {
00188 hl_lcd_set_rectangle (x,y0, x+1,y1, op);
00189 }
00190
00191
00200 size_t hl_lcd_save (uint8_t x0,uint8_t y0, uint8_t x1,uint8_t y1,
00201 uint8_t * save, size_t size);
00204 size_t hl_lcd_restore (uint8_t x0,uint8_t y0, uint8_t x1,uint8_t y1,
00205 const uint8_t * save, size_t size);
00207 size_t hl_lcd_save_size (uint8_t x0,uint8_t y0, uint8_t x1,uint8_t y1)
00208 __attribute__((const));
00210 #define HL_LCD_SAVE_SIZE(X0,Y0, X1,Y1) \
00211 ((((X1+7)/8)-(X0/8))*(Y1-Y0))
00212
00213
00214 #endif