void delegateLedUsb(uint8_t xState){ setLEDState(xState); // Get the state of all LEDs setLEDIndicate(); if(_ledInitState == INIT_LED_INDEX_NOT_INIT){ _ledInitState = INIT_LED_INDEX_INITED; } }
void delegateLedUsb(uint8_t xState){ DBG1(0x3A, (uchar *)&xState, 1); setLEDState(xState); // Get the state of all LEDs setLEDIndicate(); if(_ledInitState == INIT_INDEX_NOT_INIT){ _ledInitState = INIT_INDEX_INITED; } }
void wakeUpLED(void) { _ledOff = false; // DEBUG_PRINT(("wakeUpLED \n")); setLEDIndicate(); setFullLEDState(); }
static void processRxPs2(void){ // check that every key code for single keys are transmitted if (kbd_flags & FLA_RX_BAD) { // pokud je nastaveny flag spatneho prijmu, zrus ho // pokud flag is set back income withdrawn cli(); kbd_flags &= ~FLA_RX_BAD; sei(); } if ( isReadyForRx() && (keyval==SPLIT || isEmpty())) { // pokud nastaveny flag prijmu bytu, vezmi ho a zanalyzuj // pokud law, the flag setting apart, take it and zanalyzuj rxed = kbd_get_rx_char(); setWaitingRx(false); switch(m_state) { default: switch(rxed) { case 0xEE: /* echo */ // DEBUG_PRINT((" echo \n")); DBG1(0xd0, (uchar *)&rxed, 1); tx_state(0xEE, m_state); return; case 0xF2: /* read id */ // DEBUG_PRINT((" read id \n")); DBG1(0xd1, (uchar *)&rxed, 1); tx_state(0xFA, STA_WAIT_ID); return; case 0xFF: /* reset */ // DEBUG_PRINT((" reset \n")); DBG1(0xd2, (uchar *)&rxed, 1); tx_state(0xFA, STA_WAIT_RESET); return; case 0xFE: /* resend */ // DEBUG_PRINT((" resend \n")); DBG1(0xd3, (uchar *)&rxed, 1); tx_state(lastSent, m_state); return; case 0xF0: /* scan code set */ // DEBUG_PRINT((" scan code set \n")); DBG1(0xd4, (uchar *)&rxed, 1); // 2 tx_state(0xFA, STA_WAIT_SCAN_SET); return; case 0xED: /* led indicators */ // DEBUG_PRINT((" led indicators \n")); DBG1(0xd5, (uchar *)&rxed, 1); // 4 tx_state(0xFA, STA_WAIT_LEDS); return; case 0xF3: // DEBUG_PRINT((" STA_WAIT_AUTOREP \n")); DBG1(0xd6, (uchar *)&rxed, 1); // 3 tx_state(0xFA, STA_WAIT_AUTOREP); return; case 0xF4: // enable // DEBUG_PRINT((" enable \n")); DBG1(0xd7, (uchar *)&rxed, 1); // 5 tx_state(0xFA, STA_NORMAL); initPs2(); return; case 0xF5: // disable // DEBUG_PRINT((" disable \n")); DBG1(0xd8, (uchar *)&rxed, 1); tx_state(0xFA, STA_NORMAL); return; case 0xF6: // Set Default // DEBUG_PRINT((" Set Default \n")); DBG1(0xd9, (uchar *)&rxed, 1); // 1 TYPEMATIC_DELAY=1; TYPEMATIC_REPEAT=5; clear(); tx_state(0xFA, STA_NORMAL); return; default: // DEBUG_PRINT((" default \n")); DBG1(0xda, (uchar *)&rxed, 1); tx_state(0xFA, STA_NORMAL); break; } return; case STA_RXCHAR: // DEBUG_PRINT((" STA_RXCHAR \n")); if (rxed == 0xF5) tx_state(0xFA, STA_NORMAL); else { tx_state(0xFA, STA_RXCHAR); } return; case STA_WAIT_SCAN_SET: // DEBUG_PRINT((" STA_WAIT_SCAN_SET \n")); clear(); tx_state(0xFA, rxed == 0 ? STA_WAIT_SCAN_REPLY : STA_NORMAL); return; case STA_WAIT_AUTOREP: // DEBUG_PRINT((" STA_WAIT_AUTOREP STA_WAIT_AUTOREP \n")); TYPEMATIC_DELAY = (rxed&0b01100000)/0b00100000; temp_a = (rxed&0b00000111); temp_b = (rxed&0b00011000)/(0b000001000); j=1; for(i=0;i<temp_b;i++) { j = j*2; } TYPEMATIC_REPEAT = temp_a*j; tx_state(0xFA, STA_NORMAL); return; case STA_WAIT_LEDS: DBG1(0xdb, (uchar *)&rxed, 1); initPs2(); uint8_t ledstate = 0; // scroll lock if(rxed&0x01) ledstate |= LED_STATE_SCROLL; // num lock if(rxed&0x02) ledstate |= LED_STATE_NUM; // capslock if(rxed&0x04) ledstate |= LED_STATE_CAPS; setLEDState(ledstate); setLEDIndicate(); tx_state(0xFA, STA_NORMAL); return; } } }
static void toggleBeyondFnLedEnabled(void){ _isBeyondFnLedEnabled ^= true; setToggleOption(EEPROM_ENABLED_OPTION, TOGGLE_BEYOND_FN_LED, _isBeyondFnLedEnabled); setLEDIndicate(); }
void wakeUpLED(void){ // DEBUG_PRINT(("wakeUpLED \n")); setLEDIndicate(); setFullLEDState(); }
// 키를 누르거나 땔때 FN 및 LED등 을 컨트롤한다. bool applyFN(uint8_t xKeyidx, uint8_t xCol, uint8_t xRow, bool xIsDown) { // dual action key를 기본키 (caps lock 등)으로 반환; xKeyidx = getDualActionDefaultKey(xKeyidx); if(isFnKey(xKeyidx)) return false; if(xIsDown) { if((xKeyidx == KEY_BEYOND_FN || xKeyidx == KEY_BEYOND_FN3) || (_isDownExtraFN && xKeyidx == BEYOND_FN_CANCEL_KEY)){ // beyond_fn을 활성화; _prevBeyondFnIndex = _beyondFnIndex; if( xKeyidx == BEYOND_FN_CANCEL_KEY ) { // 취소만 가능한 키 _beyondFnIndex = LAYER_NORMAL; }else{ if(_beyondFnIndex == LAYER_NORMAL){ if(xKeyidx == KEY_BEYOND_FN){ _beyondFnIndex = LAYER_FN2; }else{ _beyondFnIndex = LAYER_FN3; } }else{ if(xKeyidx == KEY_BEYOND_FN && !(_beyondFnIndex == LAYER_FN2)){ _beyondFnIndex = LAYER_FN2; }else if(xKeyidx == KEY_BEYOND_FN3 && !(_beyondFnIndex == LAYER_FN3)){ _beyondFnIndex = LAYER_FN3; }else{ _beyondFnIndex = LAYER_NORMAL; } } } setLEDIndicate(); _prevBeyondFnIndex = _beyondFnIndex; // 더이상 변화가 없도록; if( xKeyidx == BEYOND_FN_CANCEL_KEY ) { // 키가 작동하도록 1 리턴; return 1; } return 0; }else if(_isDownQuickMacro && isEepromMacroKey(xKeyidx)){ _quickMacroIndex = xKeyidx - KEY_MAC1; _isReadyQuickMacro = true; return 0; }else if(xKeyidx == EXTRA_FN){ _isDownExtraFN = true; }else if(xKeyidx == KEY_LED_ON_OFF){ _ledOff ^= true; if(_ledOff == false){ turnOnLedAll(); }else{ turnOffLedAll(); } return 0; }else if(xKeyidx == KEY_QUICK_MACRO){ if(isQuickMacro()){ stopQuickMacro(); }else{ _isDownQuickMacro = true; } return 0; }else{ return delegateFnControl(xKeyidx, _isDownExtraFN); } }else{ // up if(xKeyidx == KEY_BEYOND_FN){ // beyond_fn return 0; }else if(xKeyidx == EXTRA_FN){ _isDownExtraFN = false; }else if(xKeyidx == KEY_QUICK_MACRO){ _isDownQuickMacro = false; return 0; } } return 1; }