All pastes #498396 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-20 11:41 UTC
rendered paste body
//
// Simpad card voltage detect
// Return: 50 -> 5V; 33-> 3,3V 
//
static int
detect_cardvoltage()
{
    int vs_state = *SA1110_LATCH_CONTROL;  // Read out latch

    vs_state&=(SA1110_INLATCH_PCMCIA_VS1|SA1110_INLATCH_PCMCIA_VS2);
    if(vs_state==(SA1110_INLATCH_PCMCIA_VS1|SA1110_INLATCH_PCMCIA_VS2)) {
        return 50; // 5V card
    } else {
        return 33; // 3,3V card
    }
}