Ejemplo n.º 1
0
static portTASK_FUNCTION(PongTask, pvParameters) {
  (void)pvParameters; /* parameter not used */
  FRTOS1_vTaskDelay(1000/portTICK_RATE_MS); /* wait some time to mount sd card */
  PONG_gameState = PONG_GAME_STATE_INIT;
#if PL_HAS_MIDI
  VS1_LoadRealtimeMidiPlugin();
  //PlayMIDI();
  MM_Play();
#endif
  for(;;) {
#if PL_HAS_KEYS
    KEY1_ScanKeys();
#endif
    PONG_RunMachine();
    FRTOS1_vTaskDelay(5/portTICK_RATE_MS);
  }
}
Ejemplo n.º 2
0
static portTASK_FUNCTION(MainTask, pvParameters) {
  unsigned char lcdBuf[sizeof("1234")];
  uint16_t cntr;
  
  (void)pvParameters; /* parameter not used */
  TRACE_Init();
  MMA1_Init(); /* enable accelerometer, if not already enabled */
  MAG1_Enable(); /* enable magnetometer */
  SHELL_Init();
  cntr = 0;
  for(;;) {
    UTIL1_Num16uToStrFormatted(lcdBuf, sizeof(lcdBuf), cntr, '0', 4);
    vfnLCD_Write_Msg(lcdBuf);
    cntr++;
    if (cntr>9999) { /* can only display 4 digits */
      cntr = 0;
    }
#if APP_USE_KEY_COMPONENT
    KEY1_ScanKeys(); /* using component in polling mode: poll keys, this will create events as needed. */
    EVNT1_HandleEvent();
#else
    if (SW1_GetVal()==0) { /* button pressed */
      FRTOS1_vTaskDelay(50/portTICK_RATE_MS); /* wait to debounce */
      while (SW1_GetVal()==0) { /* still pressed? */
        LED1_On();
      }
    }
    if (SW3_GetVal()==0) { /* button pressed */
      FRTOS1_vTaskDelay(50/portTICK_RATE_MS); /* wait to debounce */
      while (SW3_GetVal()==0) { /* still pressed? */
        LED2_On();
      }
    }
#endif
    LED1_Neg();
    FRTOS1_vTaskDelay(50/portTICK_RATE_MS);
  }
}
Ejemplo n.º 3
0
static portTASK_FUNCTION(MainTask, pvParameters) {
#if PL_HAS_ACCELEROMETER
  int16_t xmg, ymg;
#endif

  (void)pvParameters; /* parameter not used */
#if PL_HAS_MINI_INI
  TestMiniIni();
#endif
  for(;;) {
#if PL_HAS_ACCELEROMETER
    xmg = FX1_GetXmg();
    ymg = FX1_GetYmg();
    LED1_Put(xmg>100||xmg<-100||ymg>100||ymg<-100);
    LED2_Put(xmg>500||xmg<-500||ymg>500||ymg<-500);
#endif
    LED3_Neg();
#if PL_HAS_KEYS
    KEY1_ScanKeys();
#endif
    FRTOS1_vTaskDelay(100/portTICK_RATE_MS);
  }
}