rmi/fuze+: add product info in the debug screen

Change-Id: Id06dbe0909e37587a45a2ebf5b0beab93cd44f61
This commit is contained in:
Amaury Pouly 2013-12-08 11:12:39 +01:00
parent b69ea1873d
commit b163fb9eac
3 changed files with 13 additions and 7 deletions

View file

@ -26,6 +26,8 @@
#define RMI_DEVICE_CONTROL 0x0 /* $0000 */ #define RMI_DEVICE_CONTROL 0x0 /* $0000 */
#define RMI_INTERRUPT_ENABLE 0x1 /* $0001 */ #define RMI_INTERRUPT_ENABLE 0x1 /* $0001 */
#define RMI_INTERRUPT_REQUEST 0x3 /* $0003 */ #define RMI_INTERRUPT_REQUEST 0x3 /* $0003 */
#define RMI_PRODUCT_INFO 0x204 /* $0204 */
#define RMI_PRODUCT_INFO_LEN 4
#define RMI_PRODUCT_ID 0x210 /* $0210 */ #define RMI_PRODUCT_ID 0x210 /* $0210 */
#define RMI_PRODUCT_ID_LEN 16 #define RMI_PRODUCT_ID_LEN 16
#define RMI_2D_TOUCHPAD_FUNCTION 0x10 #define RMI_2D_TOUCHPAD_FUNCTION 0x10

View file

@ -947,6 +947,7 @@ bool dbg_hw_info(void)
lcd_update(); lcd_update();
yield(); yield();
} }
return false;
} }
bool dbg_ports(void) bool dbg_ports(void)

View file

@ -36,10 +36,13 @@ bool button_debug_screen(void)
{ {
char product_id[RMI_PRODUCT_ID_LEN]; char product_id[RMI_PRODUCT_ID_LEN];
rmi_read(RMI_PRODUCT_ID, RMI_PRODUCT_ID_LEN, product_id); rmi_read(RMI_PRODUCT_ID, RMI_PRODUCT_ID_LEN, product_id);
uint8_t product_info[RMI_PRODUCT_INFO_LEN];
rmi_read(RMI_PRODUCT_INFO, RMI_PRODUCT_INFO_LEN, product_info);
char product_info_str[RMI_PRODUCT_INFO_LEN * 2 + 1];
for(int i = 0; i < RMI_PRODUCT_INFO_LEN; i++)
snprintf(product_info_str + 2 * i, 3, "%02x", product_info[i]);
int x_max = rmi_read_single(RMI_2D_SENSOR_XMAX_MSB(0)) << 8 | rmi_read_single(RMI_2D_SENSOR_XMAX_LSB(0)); int x_max = rmi_read_single(RMI_2D_SENSOR_XMAX_MSB(0)) << 8 | rmi_read_single(RMI_2D_SENSOR_XMAX_LSB(0));
int y_max = rmi_read_single(RMI_2D_SENSOR_YMAX_MSB(0)) << 8 | rmi_read_single(RMI_2D_SENSOR_YMAX_LSB(0)); int y_max = rmi_read_single(RMI_2D_SENSOR_YMAX_MSB(0)) << 8 | rmi_read_single(RMI_2D_SENSOR_YMAX_LSB(0));
int func_presence = rmi_read_single(RMI_FUNCTION_PRESENCE(RMI_2D_TOUCHPAD_FUNCTION));
int sensor_prop = rmi_read_single(RMI_2D_SENSOR_PROP2(0));
int sensor_resol = rmi_read_single(RMI_2D_SENSOR_RESOLUTION(0)); int sensor_resol = rmi_read_single(RMI_2D_SENSOR_RESOLUTION(0));
int min_dist = rmi_read_single(RMI_2D_MIN_DIST); int min_dist = rmi_read_single(RMI_2D_MIN_DIST);
int gesture_settings = rmi_read_single(RMI_2D_GESTURE_SETTINGS); int gesture_settings = rmi_read_single(RMI_2D_GESTURE_SETTINGS);
@ -70,7 +73,7 @@ bool button_debug_screen(void)
gesture_vp.y = zone_y - 80; gesture_vp.y = zone_y - 80;
gesture_vp.width = LCD_WIDTH / 2; gesture_vp.width = LCD_WIDTH / 2;
gesture_vp.height = 80; gesture_vp.height = 80;
while(1) while(1)
{ {
unsigned char sleep_mode = rmi_read_single(RMI_DEVICE_CONTROL) & RMI_SLEEP_MODE_BM; unsigned char sleep_mode = rmi_read_single(RMI_DEVICE_CONTROL) & RMI_SLEEP_MODE_BM;
@ -78,7 +81,7 @@ bool button_debug_screen(void)
lcd_clear_display(); lcd_clear_display();
int btns = button_read_device(); int btns = button_read_device();
lcd_putsf(0, 0, "button bitmap: %x", btns); lcd_putsf(0, 0, "button bitmap: %x", btns);
lcd_putsf(0, 1, "RMI: id=%s p=%x s=%x", product_id, func_presence, sensor_prop); lcd_putsf(0, 1, "RMI: id=%s info=%s", product_id, product_info_str);
lcd_putsf(0, 2, "xmax=%d ymax=%d res=%d", x_max, y_max, sensor_resol); lcd_putsf(0, 2, "xmax=%d ymax=%d res=%d", x_max, y_max, sensor_resol);
lcd_putsf(0, 3, "attn=%d ctl=%x int=%x", lcd_putsf(0, 3, "attn=%d ctl=%x int=%x",
imx233_pinctrl_get_gpio(0, 27) ? 0 : 1, imx233_pinctrl_get_gpio(0, 27) ? 0 : 1,
@ -139,7 +142,7 @@ bool button_debug_screen(void)
break; break;
default: break; default: break;
} }
if(u.s.gesture.misc & RMI_2D_GEST_MISC_FLICK) if(u.s.gesture.misc & RMI_2D_GEST_MISC_FLICK)
{ {
lcd_putsf(0, 1, "FLICK!"); lcd_putsf(0, 1, "FLICK!");
@ -149,7 +152,7 @@ bool button_debug_screen(void)
if(a & 8) a = -((a ^ 0xf) + 1); if(a & 8) a = -((a ^ 0xf) + 1);
SIGN4EXT(flick_x); SIGN4EXT(flick_x);
SIGN4EXT(flick_y); SIGN4EXT(flick_y);
int center_x = (LCD_WIDTH * 2) / 3; int center_x = (LCD_WIDTH * 2) / 3;
int center_y = 40; int center_y = 40;
lcd_drawline(center_x, center_y, center_x + flick_x * 5, center_y - flick_y * 5); lcd_drawline(center_x, center_y, center_x + flick_x * 5, center_y - flick_y * 5);
@ -173,7 +176,7 @@ bool button_debug_screen(void)
volkeys_delay_counter = 0; volkeys_delay_counter = 0;
} }
} }
yield(); yield();
} }