Exemple #1
0
void ShellService::executeCommand(std::string command) {

	if (std::strcmp("exit", command.c_str()) == 0) {
		echo('x');
		//echo("can't shut down the one and only shell.");
	} else if (std::strcmp("help", command.c_str()) == 0) {
	   echo('h');
		//echo("if you're using BOSS you should be a fkn geek and wouldn't need any help.");
	} else if (std::strcmp("led toggle 1", command.c_str()) == 0) {
        toggleLED(LED1);
    } else if (std::strcmp("led toggle 2", command.c_str()) == 0) {
        toggleLED(LED2);
    } else if (std::strcmp("led on 1", command.c_str()) == 0) {
        switchLEDOn(LED1);
    } else if (std::strcmp("led on 2", command.c_str()) == 0) {
        switchLEDOn(LED2);
    } else if (std::strcmp("led off 1", command.c_str()) == 0) {
        switchLEDOff(LED1);
    } else if (std::strcmp("led off 2", command.c_str()) == 0) {
        switchLEDOff(LED2);
    } else if (std::strcmp("led read 1", command.c_str()) == 0) {
        echo((char)(getLEDState(LED1) + '0'));
    } else if (std::strcmp("led read 2", command.c_str()) == 0) {
        echo((char)(getLEDState(LED2) + '0'));
    } else if (std::strcmp("launch test", command.c_str()) == 0) {
        int params[] = {0};
        performSystemCall(EXEC, 1, params);
    } else if (std::strcmp("launch test1", command.c_str()) == 0) {
        int params[] = {1};
        performSystemCall(EXEC, 1, params);
    }
}
Exemple #2
0
static void blinkScrollLockLED(void) {
	static int counter = 0;
	const int countMAX = 100;
	//on off on off
	if (ledBlinkScrollLockCount > 0) {
		counter++;
		if (counter > countMAX) {
			if (ledBlinkScrollLockCount == 5 || ledBlinkScrollLockCount == 3) {
				turnOnLED(LEDCAPS); //PORTLEDS |= (1 << LEDCAPS);
			} else if (ledBlinkScrollLockCount == 4
					|| ledBlinkScrollLockCount == 2) {
				turnOffLED(LEDCAPS); //PORTLEDS &= ~(1 << LEDCAPS);
			} else {
				if ((getLEDState() & LED_STATE_CAPS)) {
					turnOnLED(LEDCAPS);
				}
			}
			counter = 0;

			ledBlinkScrollLockCount--;
		}
	} else {
		counter = 0;
	}
}
Exemple #3
0
static void blinkNumLockLED(void) {
	static int counter = 0;
	const int countMAX = 100;
	//on off on off
	if(ledBlinkNumLockCount > 0){
		counter++;
		if(counter > countMAX){
			if(ledBlinkNumLockCount == 5 || ledBlinkNumLockCount == 3){ 
				turnOnLED(LEDNUM); //PORTLEDS |= (1 << LEDCAPS);
			}else if(ledBlinkNumLockCount == 4 || ledBlinkNumLockCount == 2){ 
				turnOffLED(LEDNUM); //PORTLEDS &= ~(1 << LEDCAPS);
			}else{
				if(isBeyondFnLedEnabled()){
					if(isBeyondFN()){
						turnOnLED(LEDNUM);
					}
				}else{
					if((getLEDState() & LED_STATE_NUM)){
						turnOnLED(LEDNUM);
					}
				}
			}
			counter = 0;

			ledBlinkNumLockCount--;
		}
	}else{
		counter = 0;
	}
}
Exemple #4
0
int main_Test() {

	switchLEDOff(LED1);
	int i=0;
	
	while (1)  {
		i = 0;
		while (i < 800000)  {
			i++;
		}
		
		if (getLEDState(LED2))  {
			switchLEDOff(LED2);
			switchLEDOn(LED1);
			
			
			if (hasScreen()) {
                // Set LED1 On
                setColor(0x0000FF);
			    moveTo(580, 200);
                drawChar('1', 5);
            
			     // Set LED2 Off
    			setColor(0xFF0000);
    			moveTo(640, 200);
                drawChar('2', 5);
            }
		} else {
			switchLEDOn(LED2);
			switchLEDOff(LED1);
			
            if (hasScreen()) {
                
    			// Set LED1 On
    			setColor(0xFF0000);
    			moveTo(580, 200);
                drawChar('1', 5);
    			
    			// Set LED2 On
    			setColor(0x0000FF);
    			moveTo(640, 200);
                drawChar('2', 5);
            }
			
		}
	}
}
Exemple #5
0
static void blinkCapsLockLED(void) {
	static int gCounter = 0;
	static int gDelayCounter = 0;
	static uint8_t gLEDState = 1;
	const uint8_t gCountMAX = 200;
	uint8_t led = LEDCAPS;
	uint8_t gIsOn = 0;

#ifdef ENABLE_BOOTMAPPER
	if(isBootMapper()){
		gIsOn = 1;
	}
#endif	

	if(gIsOn == 1){
		++gDelayCounter;
		if(gDelayCounter > blinkLedCountDelay){
			gCounter++;
			if(gCounter > gCountMAX){
				if(getLEDState() & LED_STATE_CAPS){	// Caps Lock이 켜져 있을때는 커졌다 켜지고;
					if(gLEDState == 1){
						turnOffLED(led);
					}else{
						turnOnLED(led);
						gDelayCounter = 0;
					}
				}else{	// Caps Lock이 꺼져 있을 때는 켜졌다 꺼진다.
					if(gLEDState == 1){
						turnOnLED(led);
					}else{
						turnOffLED(led);
						gDelayCounter = 0;
					}
				}
				gLEDState ^= 1;
				gCounter = 0;
			}
		}
	}else{
		gCounter = 0;
		gLEDState = 1;
	}
}