/*! \fn     guiDisplayInsertSmartCardScreenAndWait(void)
*   \brief  Ask for the user to insert his smart card
*   \return RETURN_OK if the user inserted and unlocked his smartcard
*/
RET_TYPE guiDisplayInsertSmartCardScreenAndWait(void)
{
    RET_TYPE card_detect_ret = RETURN_JRELEASED;
        
    //#define KEYBOARD_LAYOUT_TEST
    #ifdef KEYBOARD_LAYOUT_TEST
    for (uint8_t i = ' '; i <= '~'; i++)
    {
        usbKeybPutChar(i);
        usbKeybPutChar(i);
    }
    //setMooltipassParameterInEeprom(KEYBOARD_LAYOUT_PARAM, getMooltipassParameterInEeprom(KEYBOARD_LAYOUT_PARAM)+1);
    //if (getMooltipassParameterInEeprom(KEYBOARD_LAYOUT_PARAM) > LAST_KEYB_LUT)
    //{
    //    setMooltipassParameterInEeprom(KEYBOARD_LAYOUT_PARAM, FIRST_KEYB_LUT);
    //}        
    #endif
    
    // Switch on lights
    activityDetectedRoutine();

    // Draw insert bitmap
    oledClear();
    oledBitmapDrawFlash(0, 0, BITMAP_INSERT, 0);
    oledFlipBuffers(0,0);
    
    // Wait for either timeout or for the user to insert his smartcard
    while ((hasTimerExpired(TIMER_USERINT, TRUE) == TIMER_RUNNING) && (card_detect_ret != RETURN_JDETECT))
    {
        card_detect_ret = isCardPlugged();
        touchDetectionRoutine(0);
    }
    
    // If the user didn't insert his smart card
    if (card_detect_ret != RETURN_JDETECT)
    {
        // Get back to other screen
        guiGetBackToCurrentScreen();
        return RETURN_NOK;
    }
    else
    {
        return handleSmartcardInserted();
    }
}
Exemple #2
0
void afterHadLogoDisplayTests(void)
{
    //#define TEST_PWM
    #ifdef TEST_PWM
    uint8_t toto = 0;
    switchOnLeftButonLed();
    switchOnRightButonLed();
    switchOnTopLeftWheelLed();
    switchOnTopRightWheelLed();
    switchOnBotLeftWheelLed();
    switchOnBotRightWheelLed();
    oledWriteActiveBuffer();
    while(1)
    {
        oledSetXY(2,0);
        printf("%02X", MAX_PWM_VAL >> toto);
        setPwmDc(MAX_PWM_VAL >> toto);
        _delay_ms(1000);
        if(toto++ == 11)
            toto = 0;
    }
    #endif
    
    //#define TEST_HID
    #ifdef TEST_HID
    uint8_t i;
    while(1)
    {
        if (getKeyboardLeds() & HID_CAPS_MASK)
        {
            usbPutstr("NOPE!\r\n");
            while(getKeyboardLeds() & HID_CAPS_MASK)
            {
                usbKeyboardPress(KEY_CAPS_LOCK, 0);
                _delay_ms(30);
            }
            for(i = ' '; i < 0x7F; i++)
            {
                usbKeybPutChar(i);
            }
            usbKeybPutStr("\rBonjour oh grand dieu!\n");
        }
    }
    #endif
    
    //#define TEST_PLUGIN
    #ifdef TEST_PLUGIN    
    printf_P(PSTR("Plugin test\n"));
    oledFlipBuffers(OLED_SCROLL_UP,5);
    oledClear();    // clear inactive buffer
    oledWriteActiveBuffer();
    #endif
}