Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
#define R_HORIZ_RAM_ADDR_POS 0x44 #define R_VERT_RAM_ADDR_POS 0x45 -/* Flip Flag */ #define R_ENTRY_MODE_HORZ_NORMAL 0x7030 -#define R_ENTRY_MODE_HORZ_FLIPPED 0x7000 -static unsigned short r_entry_mode = R_ENTRY_MODE_HORZ_NORMAL; #define R_ENTRY_MODE_VERT 0x7038 #define R_ENTRY_MODE_SOLID_VERT 0x1038 #define R_ENTRY_MODE_VIDEO_NORMAL 0x7020 #define R_ENTRY_MODE_VIDEO_FLIPPED 0x7010 - /* Reverse Flag */ #define R_DISP_CONTROL_NORMAL 0x0004 #define R_DISP_CONTROL_REV 0x0000 } -static bool display_flipped = false; - /* turn the display upside down */ void lcd_set_flip(bool yesno) { - display_flipped = yesno; - - r_entry_mode = yesno ? R_ENTRY_MODE_HORZ_FLIPPED : - R_ENTRY_MODE_HORZ_NORMAL; + lcd_write_reg(R_DRV_OUTPUT_CONTROL, yesno ? 0x21b : 0x11b); } static void lcd_window(int xmin, int ymin, int xmax, int ymax) { - if (!display_flipped) - { - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); - lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); - lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); - } - else - { - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, - ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); - lcd_write_reg(R_VERT_RAM_ADDR_POS, - ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_HEIGHT-1 - ymax)); - lcd_write_reg(R_RAM_ADDR_SET, - ((LCD_HEIGHT-1 - ymin) << 8) | (LCD_WIDTH-1 - xmin)); - } + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); + lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); + lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | xmin); } static void _display_on(void) /* Address counter updated in horizontal direction; left to right; * vertical increment horizontal increment. * data format for 8bit transfer or spi = 65k (5,6,5) */ - lcd_write_reg(R_ENTRY_MODE, r_entry_mode); + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); /* Replace data on writing to GRAM */ lcd_write_reg(R_COMPARE_REG1, 0); #ifndef BOOTLOADER static void lcd_window_blit(int xmin, int ymin, int xmax, int ymax) { - if (!display_flipped) - { - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, - ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); - lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); - lcd_write_reg(R_RAM_ADDR_SET, - (ymin << 8) | (LCD_WIDTH-1 - xmin)); - } - else - { - lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (xmax << 8) | xmin); - lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); - lcd_write_reg(R_RAM_ADDR_SET, (ymax << 8) | xmin); - } + lcd_write_reg(R_HORIZ_RAM_ADDR_POS, + ((LCD_WIDTH-1 - xmin) << 8) | (LCD_WIDTH-1 - xmax)); + lcd_write_reg(R_VERT_RAM_ADDR_POS, (ymax << 8) | ymin); + lcd_write_reg(R_RAM_ADDR_SET, (ymin << 8) | (LCD_WIDTH-1 - xmin)); } /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); yuv_src[2] = src[2] + (yuv_src[1] - src[1]); - lcd_write_reg(R_ENTRY_MODE, - display_flipped ? R_ENTRY_MODE_VIDEO_FLIPPED : R_ENTRY_MODE_VIDEO_NORMAL - ); - if (lcd_yuv_options & LCD_YUV_DITHER) { do if (!display_on) return; - lcd_write_reg(R_ENTRY_MODE, r_entry_mode); + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); /* Set start position and window */ lcd_window(0, 0, LCD_WIDTH-1, LCD_HEIGHT-1); if (y + height > LCD_HEIGHT) height = LCD_HEIGHT - y; /* clip bottom */ - lcd_write_reg(R_ENTRY_MODE, r_entry_mode); + lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_HORZ_NORMAL); /* we need to make x and width even to enable 32bit transfers */ width = (width + (x & 1) + 1) & ~1; |