コード例 #1
0
ファイル: test_ballon_LPA.c プロジェクト: TomHartogs/School
void testLPABallon( void )
{
	initLCD(); 		 // Initialize the LC-Display (LCD)
	showScreenLCD("################", "################");
	mSleep(500);
	showScreenLCD("Tst LPA BallonLIB", "versie 29jun15");
	mSleep(500);
	// ---------------------------------------
	setLEDs(0b0000); // All LEDs off!

	// This text is fixed on the LCD. Only the
	// key and ADC values are changed later on!
	showScreenLCD("hoogte: ", "VS:       BS:");
	while(true) 
	{
      // read some simulations parameter values and display them on teh LCD
      showSimParams();
      // Check if a key is pressed:
      uint8_t key = getPressedKeyNumber(); 
      // This function returns a 0 if no key is pressed and the key number from 1 to 5 otherwise.
      if(key) // If a key is pressed... (key != 0)
      {
         // ... and depending on which key was pressed, we 
         // call some library functions related to the burner and the valve.

         switch(key)
         {
            case 1: 
               Balloon_set_burner(ON);
               break;
            case 2:
               Balloon_set_burner(OFF);
               break;
            case 3: 
               Balloon_set_valve(OPEN);
               break;
            case 4: 
               Balloon_set_valve(CLOSED);
               break;
            case 5: 
               break;
         }
         // ... wait until the key is released again...
         while(getPressedKeyNumber())
         {
            showSimParams(); // use busy waiting for polling keys
         }
      }
	}
}
コード例 #2
0
ファイル: ProcessKeys.c プロジェクト: grasmanek94/LPA
void ProcessKeys(void)
{
	if (!config.controlledByPC)
	{
		uint8_t key = getPressedKeyNumber();
		if (key > 0 && key < 5)
		{
			config.globalPressureBar = 2 * (key - 1);
		}
	}
}
コード例 #3
0
ファイル: hal.c プロジェクト: kokx/live-performance
void checkButtons(void)
{
    uint8_t key = getPressedKeyNumber();

    char message[10];

    if (key && key < 5) {
        if (!pressed) {
            sprintf(message, "1-%d", key - 1);
            sendMessage(message);

            pressed = true;
        }
    } else {
        pressed = false;
    }
}