diff options
-rwxr-xr-x | bootloader/mrobe500.c | 23 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/debug-dm320.c | 34 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | 53 |
3 files changed, 72 insertions, 38 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c index ede05aa25c..1dbe7b8edb 100755 --- a/bootloader/mrobe500.c +++ b/bootloader/mrobe500.c | |||
@@ -103,7 +103,7 @@ int brightness = 0; | |||
103 | 103 | ||
104 | void mrdebug(void) | 104 | void mrdebug(void) |
105 | { | 105 | { |
106 | int button=0, *address=0x0; | 106 | int button=0; |
107 | #if 0 | 107 | #if 0 |
108 | use_calibration(false); | 108 | use_calibration(false); |
109 | touchpad_calibrate_screen(); | 109 | touchpad_calibrate_screen(); |
@@ -123,19 +123,14 @@ void mrdebug(void) | |||
123 | printf("reset"); | 123 | printf("reset"); |
124 | IO_GIO_BITSET1|=1<<10; | 124 | IO_GIO_BITSET1|=1<<10; |
125 | } | 125 | } |
126 | if(button==BUTTON_RC_PLAY) | 126 | if (button==BUTTON_RC_VOL_DOWN) |
127 | address+=0x02; | 127 | { |
128 | else if (button==BUTTON_RC_DOWN) | ||
129 | address-=0x02; | ||
130 | else if (button==BUTTON_RC_FF) | ||
131 | address+=0x1000; | ||
132 | else if (button==BUTTON_RC_REW) | ||
133 | address-=0x1000; | ||
134 | else if (button==BUTTON_RC_VOL_DOWN) { | ||
135 | brightness = (brightness - 5) & 0x7f; | 128 | brightness = (brightness - 5) & 0x7f; |
136 | bl_command[2] = brightness; | 129 | bl_command[2] = brightness; |
137 | spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); | 130 | spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); |
138 | } else if (button==BUTTON_RC_VOL_UP) { | 131 | } |
132 | else if (button==BUTTON_RC_VOL_UP) | ||
133 | { | ||
139 | brightness = (brightness + 5) & 0x7f; | 134 | brightness = (brightness + 5) & 0x7f; |
140 | bl_command[2] = brightness; | 135 | bl_command[2] = brightness; |
141 | spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); | 136 | spi_block_transfer(SPI_target_BACKLIGHT, bl_command, 4, 0, 0); |
@@ -145,14 +140,10 @@ void mrdebug(void) | |||
145 | // tsc2100_read_values(&x, &y, &z1, &z2); | 140 | // tsc2100_read_values(&x, &y, &z1, &z2); |
146 | // printf("x: %04x y: %04x z1: %04x z2: %04x", x, y, z1, z2); | 141 | // printf("x: %04x y: %04x z1: %04x z2: %04x", x, y, z1, z2); |
147 | // printf("tsadc: %4x", tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS)&0xffff); | 142 | // printf("tsadc: %4x", tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS)&0xffff); |
148 | printf("current tick: %04x", current_tick); | ||
149 | printf("Address: 0x%08x Data: 0x%08x", address, *address); | ||
150 | printf("Address: 0x%08x Data: 0x%08x", address+1, *(address+1)); | ||
151 | printf("Address: 0x%08x Data: 0x%08x", address+2, *(address+2)); | ||
152 | // // tsc2100_keyclick(); /* doesnt work :( */ | 143 | // // tsc2100_keyclick(); /* doesnt work :( */ |
153 | // line -= 6; | 144 | // line -= 6; |
154 | // } | 145 | // } |
155 | #if 0 | 146 | #if 1 |
156 | if (button&BUTTON_TOUCHPAD) | 147 | if (button&BUTTON_TOUCHPAD) |
157 | { | 148 | { |
158 | if (button&BUTTON_REL) | 149 | if (button&BUTTON_REL) |
diff --git a/firmware/target/arm/tms320dm320/debug-dm320.c b/firmware/target/arm/tms320dm320/debug-dm320.c index 417dfee961..e12d86a03d 100755 --- a/firmware/target/arm/tms320dm320/debug-dm320.c +++ b/firmware/target/arm/tms320dm320/debug-dm320.c | |||
@@ -35,7 +35,7 @@ bool __dbg_ports(void) | |||
35 | 35 | ||
36 | bool __dbg_hw_info(void) | 36 | bool __dbg_hw_info(void) |
37 | { | 37 | { |
38 | int line = 0, button; | 38 | int line = 0, button, oldline; |
39 | int *address=0x0; | 39 | int *address=0x0; |
40 | bool done=false; | 40 | bool done=false; |
41 | char buf[100]; | 41 | char buf[100]; |
@@ -43,11 +43,25 @@ bool __dbg_hw_info(void) | |||
43 | lcd_setmargins(0, 0); | 43 | lcd_setmargins(0, 0); |
44 | lcd_setfont(FONT_SYSFIXED); | 44 | lcd_setfont(FONT_SYSFIXED); |
45 | lcd_clear_display(); | 45 | lcd_clear_display(); |
46 | |||
47 | /* Put all the static text befor the while loop */ | ||
46 | lcd_puts(0, line++, "[Hardware info]"); | 48 | lcd_puts(0, line++, "[Hardware info]"); |
49 | |||
50 | lcd_puts(0, line++, "Clock info:"); | ||
51 | snprintf(buf, sizeof(buf), "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", | ||
52 | IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_puts(0, line++, buf); | ||
53 | snprintf(buf, sizeof(buf), "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", | ||
54 | IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_puts(0, line++, buf); | ||
55 | snprintf(buf, sizeof(buf), "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", | ||
56 | IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_puts(0, line++, buf); | ||
57 | snprintf(buf, sizeof(buf), "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", | ||
58 | IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); lcd_puts(0, line++, buf); | ||
47 | 59 | ||
60 | line++; | ||
61 | oldline=line; | ||
48 | while(!done) | 62 | while(!done) |
49 | { | 63 | { |
50 | line = 0; | 64 | line = oldline; |
51 | button = button_get(false); | 65 | button = button_get(false); |
52 | button&=~BUTTON_REPEAT; | 66 | button&=~BUTTON_REPEAT; |
53 | if (button == BUTTON_POWER) | 67 | if (button == BUTTON_POWER) |
@@ -61,14 +75,14 @@ bool __dbg_hw_info(void) | |||
61 | else if (button==BUTTON_RC_REW) | 75 | else if (button==BUTTON_RC_REW) |
62 | address-=0x800; | 76 | address-=0x800; |
63 | 77 | ||
64 | snprintf(buf, sizeof(buf), "current tick: %04x", (unsigned int)current_tick); | 78 | snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", |
65 | lcd_puts(0, line++, buf); | 79 | (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); |
66 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)address, *address); | 80 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
67 | lcd_puts(0, line++, buf); | 81 | (unsigned int)address, *address); lcd_puts(0, line++, buf); |
68 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+1), *(address+1)); | 82 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
69 | lcd_puts(0, line++, buf); | 83 | (unsigned int)(address+1), *(address+1)); lcd_puts(0, line++, buf); |
70 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+2), *(address+2)); | 84 | snprintf(buf, sizeof(buf), "Address: 0x%08x Data: 0x%08x", |
71 | lcd_puts(0, line++, buf); | 85 | (unsigned int)(address+2), *(address+2)); lcd_puts(0, line++, buf); |
72 | 86 | ||
73 | lcd_update(); | 87 | lcd_update(); |
74 | } | 88 | } |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c index 837677250f..5b20300594 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/button-mr500.c | |||
@@ -47,9 +47,13 @@ void use_calibration(bool enable) | |||
47 | using_calibration = enable; | 47 | using_calibration = enable; |
48 | } | 48 | } |
49 | /* Jd's tests.. These will hopefully work for everyone so we dont have to | 49 | /* Jd's tests.. These will hopefully work for everyone so we dont have to |
50 | create a calibration screen. and | 50 | * create a calibration screen. |
51 | (0,0) = 0x00c0, 0xf40 | 51 | * Portait: |
52 | (480,320) = 0x0f19, 0x00fc | 52 | * (0,0) = 200, 3900 |
53 | * (480,640) = 3880, 270 | ||
54 | * Landscape: | ||
55 | * (0,0) = 200, 270 | ||
56 | * (640,480) = 3880, 3900 | ||
53 | */ | 57 | */ |
54 | void set_calibration_points(struct touch_calibration_point *tl, | 58 | void set_calibration_points(struct touch_calibration_point *tl, |
55 | struct touch_calibration_point *br) | 59 | struct touch_calibration_point *br) |
@@ -57,16 +61,25 @@ void set_calibration_points(struct touch_calibration_point *tl, | |||
57 | memcpy(&topleft, tl, sizeof(struct touch_calibration_point)); | 61 | memcpy(&topleft, tl, sizeof(struct touch_calibration_point)); |
58 | memcpy(&bottomright, br, sizeof(struct touch_calibration_point)); | 62 | memcpy(&bottomright, br, sizeof(struct touch_calibration_point)); |
59 | } | 63 | } |
64 | |||
60 | static int touch_to_pixels(short val_x, short val_y) | 65 | static int touch_to_pixels(short val_x, short val_y) |
61 | { | 66 | { |
62 | short x,y; | 67 | short x,y; |
63 | int x1,x2; | 68 | |
69 | #ifdef SCREEN_ROTATE /* portait */ | ||
70 | x=val_x; | ||
71 | y=val_y; | ||
72 | #else | ||
73 | x=val_y; | ||
74 | y=val_x; | ||
75 | #endif | ||
76 | |||
64 | if (!using_calibration) | 77 | if (!using_calibration) |
65 | return (val_x<<16)|val_y; | 78 | return (val_x<<16)|val_y; |
66 | x1 = topleft.val_x; x2 = bottomright.val_x; | 79 | |
67 | x = (val_x-x1)*(bottomright.px_x - topleft.px_x) / (x2 - x1) + topleft.px_x; | 80 | x = (x-topleft.val_x)*(bottomright.px_x - topleft.px_x) / (bottomright.val_x - topleft.val_x) + topleft.px_x; |
68 | x1 = topleft.val_y; x2 = bottomright.val_y; | 81 | y = (y-topleft.val_y)*(bottomright.px_y - topleft.px_y) / (bottomright.val_y - topleft.val_y) + topleft.px_y; |
69 | y = (val_y-x1)*(bottomright.px_y - topleft.px_y) / (x2 - x1) + topleft.px_y; | 82 | |
70 | if (x < 0) | 83 | if (x < 0) |
71 | x = 0; | 84 | x = 0; |
72 | if (y < 0) | 85 | if (y < 0) |
@@ -79,11 +92,27 @@ void button_init_device(void) | |||
79 | touch_available = false; | 92 | touch_available = false; |
80 | /* GIO is the power button, set as input */ | 93 | /* GIO is the power button, set as input */ |
81 | IO_GIO_DIR0 |= 0x01; | 94 | IO_GIO_DIR0 |= 0x01; |
82 | topleft.px_x = 0; topleft.px_y = 0; | 95 | |
83 | topleft.val_x = 0x00c0; topleft.val_y = 0xf40; | 96 | #ifdef SCREEN_ROTATE /* portait */ |
97 | topleft.val_x = 200; | ||
98 | topleft.val_y = 3900; | ||
99 | |||
100 | bottomright.val_x = 3880; | ||
101 | bottomright.val_y = 270; | ||
102 | #else /* landscape */ | ||
103 | topleft.val_x = 270; | ||
104 | topleft.val_y = 200; | ||
105 | |||
106 | bottomright.val_x = 3900; | ||
107 | bottomright.val_y = 3880; | ||
108 | #endif | ||
109 | |||
110 | topleft.px_x = 0; | ||
111 | topleft.px_y = 0; | ||
84 | 112 | ||
85 | bottomright.px_x = LCD_WIDTH; bottomright.px_y = LCD_HEIGHT; | 113 | bottomright.px_x = LCD_WIDTH; |
86 | bottomright.val_x = 0x0f19; bottomright.val_y = 0x00fc; | 114 | bottomright.px_y = LCD_HEIGHT; |
115 | |||
87 | using_calibration = true; | 116 | using_calibration = true; |
88 | 117 | ||
89 | /* Enable the touchscreen interrupt */ | 118 | /* Enable the touchscreen interrupt */ |