Rockbox Development > New Ports

Sandisk C100 series

<< < (8/10) > >>

LambdaCalculus:

--- Quote from: MarcGuay on June 17, 2008, 08:41:13 PM ---Or perhaps it would make more sense to explore the ADC and get the button specifics down?

--- End quote ---

Sure, the ADC should hold what you're looking for. I'm going to do the same for the m200 (although I'm swapping with shotofadds so he can have my NAND one :)).

I might pick up a c100 if I can find one for dirt cheap and start pitching in a little bit here as well.

MarcGuay:
Unfortunately, I couldn't see any significant changes in the ADC readings while pressing buttons.  But I just remembered that Production Test Mode is triggered on boot when the volume-down and circle-down buttons are held, so the boot sequence must have a button check which would uncover the difference between vol-up and vol-down.

lowlight:
I have a c100, but never got around the messing with it. However, MarcGuay's recent success gave me some motivation.  Here's what I found during lunch: in the OF, there's a key test that goes something like this...


--- Code: ---GPIOA |= 0x4;
GPIOA &= ~0x8;
i=20; while (i--);
if (GPIOA & 0x10) btn |= BUTTON_PLAY; /* up */
if (GPIOA & 0x20) btn |= BUTTON_RIGHT;
if (GPIOA & 0x40) btn |= BUTTON_LEFT;

GPIOA |= 0x8;
GPIOA &= ~0x4;
i=20; while (i--);
if (GPIOA & 0x10) btn |= BUTTON_VOL_UP;
if (GPIOA & 0x20) btn |= BUTTON_VOL_DN;
if (GPIOA & 0x40) btn |= BUTTON_AB; /* down */

if (GPIOA & 0x100) btn |= BUTTON_MENU; /* power */
if (GPIOA & 0x80) btn |= BUTTON_STOP; /* select */
if (GPIOA & 0x2) btn |= BUTTON_HOLD;

--- End code ---

MarcGuay:
Wow, nothing like working with bits to make you feel dumb.

So my GPIOA testing showed this:

1111000000000100 (F004) 0x4 - Volume Up/Down & A-B Repeat/Down Button
1111000000001000 (F008) 0x8 - Left/Up/Right Directions

And it seems that the key test is checking the bits in bold, which as far as I can tell never change.  There's a line in the OF before the first 2 IF chunks that goes like this:


--- Code: ---AND     R0, R0, #0x70
--- End code ---

Which I believe is just saying "throw out all the bits except those we're about to check", again, the ones that never change.  So where is the OF deriving the uniqueness from?

lowlight:
I'm guessing that the key lies in setting/clearing those two bits

--- Code: ---GPIOA |= 0x4;
GPIOA &= ~0x8;

--- End code ---
and

--- Code: ---GPIOA |= 0x8;
GPIOA &= ~0x4;

--- End code ---

before checking the other bits.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version