Rockbox mail archive
Subject: More port pins revealed
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2002-01-06
Now with working lcd code (at least for me ;) I have been able to find which
port pins the keys are connected to:
ON: PA5
MENU: PC1
PLAY: PC4
STOP: PA11
NEXT: PC3
PREV: PC0
Other interesting pins:
PA14: goes low on every key press except ON
PA15: USB cable connected
PA0: DC adapter connected
Note: All of the above are active low.
Idle values for the ports are:
Port A: FF7F
Port B: 7BEB
Port C: 7AFF (note: upper 8 bits of register PCDR are undefined)
The code used for this experiment:
-----
void hex16( unsigned char* buf, unsigned short value )
{
static char* hexcode = "0123456789ABCDEF";
buf[0] = hexcode[(value & 0xf000) >> 12];
buf[1] = hexcode[(value & 0x0f00) >> 8];
buf[2] = hexcode[(value & 0x00f0) >> 4];
buf[3] = hexcode[value & 0x000f];
buf[4] = 0;
}
int main(void)
{
char buf[5];
int i;
/* clear screen */
lcd_printxy(0,0," ",11);
lcd_printxy(0,1," ",11);
while (1) {
hex16(buf,PADR);
lcd_printxy(0,0,buf,4);
hex16(buf,PBDR);
lcd_printxy(6,0,buf,4);
hex16(buf,PCDR);
lcd_printxy(0,1,buf,4);
PBDR ^= 0x40; /* toggle LED (PB6) */
for ( i=0; i<1000000; i++ );
}
}
-----
/Björn
Page was last modified "Jan 10 2012" The Rockbox Crew
|