Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: View a reverse screen
From: Hardeep Sidhu (hardeeps_at_pobox.com)
Date: 2003-08-12


Obi-Wan Kannabis wrote:

>I want to know if it's possible to reverse (upside down) the screen, So I can read the screen when my Archos is
>on my pocket (moreover, is it possible to reverse the buttons...) ??
>

Interesting idea. It's definitely possible as the attached (kludgy and
inefficient) patch shows (both screen and buttons reversed). You should
file a feature request for this.

-Hardeep


? rockbox-devel/build
Index: rockbox-devel//firmware/drivers/button.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/button.c,v
retrieving revision 1.37
diff -u -r1.37 button.c
--- rockbox-devel//firmware/drivers/button.c 27 May 2003 18:37:22 -0000 1.37
+++ rockbox-devel//firmware/drivers/button.c 12 Aug 2003 05:28:01 -0000
@@ -34,6 +34,7 @@
 struct event_queue button_queue;
 
 long last_keypress;
+extern bool rot180;
 
 /* how often we check to see if a button is pressed */
 #define POLL_FREQUENCY HZ/20
@@ -252,14 +253,26 @@
 
     /* Check F1-3 and UP */
     data = adc_read(ADC_BUTTON_ROW1);
- if (data >= LEVEL4)
- btn |= BUTTON_F3;
- else if (data >= LEVEL3)
- btn |= BUTTON_UP;
+ if (data >= LEVEL4) {
+ if (rot180)
+ btn |= BUTTON_F1;
+ else
+ btn |= BUTTON_F3;
+ }
+ else if (data >= LEVEL3) {
+ if (rot180)
+ btn |= BUTTON_DOWN;
+ else
+ btn |= BUTTON_UP;
+ }
     else if (data >= LEVEL2)
         btn |= BUTTON_F2;
- else if (data >= LEVEL1)
- btn |= BUTTON_F1;
+ else if (data >= LEVEL1) {
+ if (rot180)
+ btn |= BUTTON_F3;
+ else
+ btn |= BUTTON_F1;
+ }
 
     /* Some units have mushy keypads, so pressing UP also activates
        the Left/Right buttons. Let's combat that by skipping the AN5
@@ -268,22 +281,36 @@
     {
         /* Check DOWN, PLAY, LEFT, RIGHT */
         data = adc_read(ADC_BUTTON_ROW2);
- if (data >= LEVEL4)
- btn |= BUTTON_DOWN;
+ if (data >= LEVEL4) {
+ if (rot180)
+ btn |= BUTTON_UP;
+ else
+ btn |= BUTTON_DOWN;
+ }
         else if (data >= LEVEL3) {
 #ifdef HAVE_FMADC
- btn |= BUTTON_RIGHT;
+ if (rot180)
+ btn |= BUTTON_LEFT;
+ else
+ btn |= BUTTON_RIGHT;
 #else
             btn |= BUTTON_PLAY;
 #endif
         }
- else if (data >= LEVEL2)
- btn |= BUTTON_LEFT;
+ else if (data >= LEVEL2) {
+ if (rot180)
+ btn |= BUTTON_RIGHT;
+ else
+ btn |= BUTTON_LEFT;
+ }
         else if (data >= LEVEL1) {
 #ifdef HAVE_FMADC
             btn |= BUTTON_PLAY;
 #else
- btn |= BUTTON_RIGHT;
+ if (rot180)
+ btn |= BUTTON_LEFT;
+ else
+ btn |= BUTTON_RIGHT;
 #endif
         }
     }
Index: rockbox-devel//firmware/drivers/lcd-recorder.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/drivers/lcd-recorder.c,v
retrieving revision 1.20
diff -u -r1.20 lcd-recorder.c
--- rockbox-devel//firmware/drivers/lcd-recorder.c 9 Jul 2003 23:07:49 -0000 1.20
+++ rockbox-devel//firmware/drivers/lcd-recorder.c 12 Aug 2003 05:28:01 -0000
@@ -114,6 +114,10 @@
 static unsigned char ones[8] = { 0xff, 0xff, 0xff, 0xff,
                                   0xff, 0xff, 0xff, 0xff};
 
+bool rot180 = true;
+
+extern void bitswap(unsigned char *data, int length);
+
 int lcd_default_contrast(void)
 {
 #ifdef SIMULATOR
@@ -180,7 +184,16 @@
         lcd_write (true, LCD_CNTL_LOWCOL);
 
         for (x = 0; x < LCD_WIDTH; x++)
- lcd_write (false, lcd_framebuffer[x][y]);
+ {
+ if (rot180)
+ {
+ char c = lcd_framebuffer[LCD_WIDTH-x-1][LCD_HEIGHT/8-y-1];
+ bitswap(&c, 1);
+ lcd_write (false, c);
+ }
+ else
+ lcd_write (false, lcd_framebuffer[x][y]);
+ }
     }
 }
 
@@ -214,7 +227,16 @@
         lcd_write (true, LCD_CNTL_LOWCOL | (x_start & 0xf));
 
         for (x = x_start; x < xmax; x++)
- lcd_write (false, lcd_framebuffer[x][y]);
+ {
+ if (rot180)
+ {
+ char c = lcd_framebuffer[LCD_WIDTH-x-1][LCD_HEIGHT/8-y-1];
+ bitswap(&c, 1);
+ lcd_write (false, c);
+ }
+ else
+ lcd_write (false, lcd_framebuffer[x][y]);
+ }
     }
 }
 



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa