Keypads

From Hackspire
Revision as of 06:32, 31 December 2010 by Goplat (talk | contribs) (Moving keypad-specific stuff to its own page. Documenting a bit about the touchpad)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Key maps

Each bit in the 900E0010-900E001F registers represents a key. If the bit is cleared, the key is being pressed. Only bits 0 to 10 are used in each halfword. The mapping depends on the currently used keypad.

Clickpad keypad map:

offset bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 9 bit 10
0010 ret enter space (-) Z . Y 0 X on theta
0012 , + W 3 V 2 U 1 T e^x pi
0014 ? - S 6 R 5 Q 4 P 10^x EE
0016 : * O 9 N 8 M 7 L x^2 i
0018 " / K tan J cos I sin H ^ >
001A ' cat G ) F ( E var D caps <
001C flag click C home B menu A esc | tab
001E up u+r right r+d down d+l left l+u clear ctrl =

TI-84+ keypad map:

offset bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 9 bit 10
0010 down left right up
0012 enter + - * / ^ clear
0014 (-) 3 6 9 ) tan vars
0016 . 2 5 8 ( cos prgm stat
0018 0 1 4 7 , sin apps X
001A on sto ln log x^2 x^-1 math alpha
001C graph trace zoom wind y= 2nd mode del
001E

Touchpad keypad map:

offset bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 bit 8 bit 9 bit 10
0010 ret enter (-) space Z Y 0 ?!
0012 X W V 3 U T S 1 pi trig 10^x
0014 R Q P 6 O N M 4 EE x^2
0016 L K J 9 I H G 7 / e^x
0018 F E D C B A = * ^
001A var - ) . ( 5 cat frac del scratch
001C flag + doc 2 menu 8 esc tab
001E shift ctrl ,

Touchpad I²C

Communication with the actual touchpad is done with the I²C protocol: GPIO 1 is the Serial Clock (SCL) and GPIO 3 is the Serial Data Line (SDA). The touchpad responds to messages with address 0x20. A write message consists of the first port to write to, followed by the values to write: the port number auto-increments, so a message of 00 de ad writes de to port 00 and ad to port 01. A read message reads from whatever port was set by the previous write message, so it generally has to be preceded by an empty write to set the port.

A list of the touchpad's ports follows. All 16-bit numbers are big-endian.

  • Any page:
    • FF: Page number
  • Page 04 (default):
    • 00: Contact (usually is 01 if proximity >= 0x2F, 00 otherwise)
    • 01: Proximity
    • 02-03: X position
    • 04-05: Y position
    • 06: X velocity
    • 07: Y velocity
    • 0A: 1 if touchpad pressed down, 0 if not
    • 0B: Status (reading this clears the low bits)
      • Bit 0 (0x01): Set when proximity is nonzero
      • Bit 1 (0x02): Set when velocity bytes are nonzero
      • Bit 2 (0x04): Set when unknown byte at 08 is nonzero
      • Bit 3 (0x08): Set when pressed byte has changed
      • Bit 6 (0x40): Always set? (If it's not set, the OS's interrupt handler overflows the stack and crashes)
    • E4-E7: Firmware version
  • Page 10:
    • 04-05: Maximum X coordinate (0x0918)
    • 06-07: Maximum Y coordinate (0x069B)