Exemple #1
0
void MusicPlayer::AvailableProcessorTime()
{
  if(!Key_Disable)scanKey();
  if(Analog_Enable)scanAnalogSensor();
  if(Digital_Enable)scanDigitalSensor();
  controlLED();
}
Exemple #2
0
uint8_t _keyPressed()
{
  uint8_t temp=0;
  static uint8_t oldKey=0;
  temp=scanKey();
  switch(KeyState)
  {
    case KEYRELEASED:{
      oldKey=NOKEY;
      if(temp!=NOKEY) {
        KeyValue=temp;
        KeyState=KEYPRESSED;  // ==> KEYPRESSED
      }
    }break;

    case KEYPRESSED:{
      if(temp==NOKEY) KeyState=KEYRELEASED;  // ==> KEYPRESSED
      else if(temp!=oldKey){
        oldKey=temp;
      }
    }break;
  }

  if(temp==NOKEY)return 0;
  else return 1;
}
void GameStateConfigDesktop::logic() {
	if (inpt->window_resized)
		refreshWidgets();

	if (defaults_confirm->visible) {
		// reset defaults confirmation
		logicDefaults();
		return;
	}
	else if (input_confirm->visible) {
		// assign a keybind
		input_confirm->logic();
		scanKey(input_key);
		input_confirm_ticks--;
		if (input_confirm_ticks == 0) input_confirm->visible = false;
		return;
	}
	else {
		if (!logicMain())
			return;
	}

	// tab contents
	active_tab = tab_control->getActiveTab();

	if (active_tab == VIDEO_TAB)
		logicVideo();
	else if (active_tab == AUDIO_TAB)
		logicAudio();
	else if (active_tab == INTERFACE_TAB)
		logicInterface();
	else if (active_tab == INPUT_TAB)
		logicInput();
	else if (active_tab == KEYBINDS_TAB)
		logicKeybinds();
	else if (active_tab == MODS_TAB)
		logicMods();
}
Exemple #4
0
void VBIRute() {
	int msg=PMSG_LoseScr;
	int ctrl,ch;
	
	
	stopRaster();
	cli();
	if (needup) {
		DeleteStars();
	} 
	CalcStars();
	needup=1; 
	
	if (check) {
		ch = scanKey(&ctrl);
		if (ch == 27 && (ctrl & 2)) {
			sendPulse(chan,&msg);
			check=0;
		}
	} 
	sei();
	setRaster(NULL,250);
}
void loop() {

    static int8_t value=0;
    uint8_t n;

    // blink LED
    for(n=0; n<3; n++)
    {
        ledOn();
        delay(200);
        ledOff();
        delay(200);
    }
    uint8_t row,col;

    // display row an colun test
    initDisplay();
    for(row=0; row<5; row++)
    {
        for(col=0; col<7; col++)
        {

            setRow(row);
            setCol(col);
            delay(100);
        }
    }

    // show hello
    _putchar('H');
    showMatrix(200);
    _putchar('E');
    showMatrix(200);
    _putchar('L');
    showMatrix(400);
    _putchar('O');
    showMatrix(200);


    //**************** key display example ***************************
    do
    {
        n=_getchar();
        value=getKey();
        _putchar(n);
        showLeds(value);
    }
    while(n!='i');

    //**************** key sound display example ***************************
    tone(CH2_SPEAKERPIN, frequencyTable[0],50);
    do
    {
        n=_getchar();
        value=getKey();
        tone(CH2_SPEAKERPIN, frequencyTable[value],50);
        delay(50);
        _putchar(n);
        showLeds(value);
    }
    while(n!='i');

    // key code test
    do
    {
        n=scanKey();
        //initDisplay();
        //setCol(0);
        //setRowPattern(n);
        if(n<0x10)	hex1(n);
        else _putchar('n');
        showLeds(n);
        showMatrix(100);
        //delay(1000);
    } while(n!=HASHKEY);

}