void main() {

  Start_TP();

  Init_GPIO();
  Init_SDIO();
  Init_Ext_Mem();
  Init_FAT();
  RTC_Init();
  
  I2C2_Init_Advanced(400000, &_GPIO_MODULE_I2C2_PF01);
  UART2_Init_Advanced(9600, _UART_8_BIT_DATA, _UART_NOPARITY, _UART_ONE_STOPBIT, &_GPIO_MODULE_USART2_PD5_PA3);
  MPU9150A_FSY = 0;
  MPU9150A_Init();
  MPU9150A_Detect();
  MAG_Detect();
  tmrTicks = 0;
  initTimer2();
  Timer2_On();
  MPU9150A_Read(); //initial read
  delay_ms(10);

  while (1) {
    DisableInterrupts();
    Check_TP();
    EnableInterrupts();
    //DrawScreen(&Boot);
    //DrawScreen(&Speedometer_graphics);
    Run_logger();

  }
}
示例#2
0
void main() {
  int x0, y0;
  int i = 0, j = 0;
  
  int receive_block;
  int image_to_draw;
  
  receive_block = -1;

  USBIP0_bit = 1;
  USBIP1_bit = 1;
  USBIP2_bit = 1;

  USBIE_bit = 1;

  EnableInterrupts();

  Start_TP();
  
  TFT_Fill_Screen(CL_WHITE);
  TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);
  
  ClearBuffer(ReadBuffer, USB_LENGTH);
  ClearBuffer(WriteBuffer, USB_LENGTH);
  HID_Enable(ReadBuffer, &WriteBuffer);

  for(i=0; i<2; i++) {
      for(j=0; j<4; j++) {
               DrawIcon(j, i);
      }
  }
  
  while (1) {
    Check_TP();
    if (HID_Read()) {
       ClearBuffer(WriteBuffer, USB_LENGTH);
       if (strstr(ReadBuffer, "AT+SEND_IMAGE")) {
            strcpy(WriteBuffer, "READY");
            HID_Write(WriteBuffer,USB_LENGTH);
           receive_block = 0;
       }

       else if ((receive_block>=0)&&(receive_block<2048)) {
            memcpy((char *)Image_icon+receive_block, ReadBuffer, USB_LENGTH);
            strcpy(WriteBuffer, "OK");
            HID_Write(WriteBuffer,USB_LENGTH);
            receive_block+=USB_LENGTH;
       }
       
       else if (strstr(&ReadBuffer, "AT+DRAW_IMAGE=")) {
            image_to_draw = ReadBuffer[strlen("AT+DRAW_IMAGE=")]-'0';
            DrawIcon(image_to_draw%4, image_to_draw/4);
            strcpy(WriteBuffer, "OK");
            HID_Write(WriteBuffer,USB_LENGTH);
       }
    }
    ClearBuffer(&ReadBuffer, USB_LENGTH);
    if(receive_block > 2048-USB_LENGTH) receive_block = -1;
  }
}
示例#3
0
void main()
{
    Start_TP();
    Initialize_Game();

    while (1)
    {
        Check_TP();
        Update_Game();
    }
}
void main() {

  Start_TP();
  InitGameShield();    //Setup the gameshield inputs and outputs
  

  while (1) {
    Check_TP(); //Check the Mikromedia Touch Panel
    Check_GS(); //Check for Game Shield input
    
    frame_counter++;  //Increment the frame counter

  }

}
//******************************************************************************
// Main function
//******************************************************************************
void main() {
  Start_TP();

  Init_GPIO();
  Init_SDIO();
  Init_FAT();
  RTC_Init();

  while (1) {
    DisableInterrupts();
    Check_TP();
    EnableInterrupts();
    Run_Example();
  }
}
void main() {

Start_TP();

//initalize variables on startup
initVariables();

//translate.z = 10.0;

scale.x = 95.0;  //x scale
scale.y = 95.0;  //y scale
scale.z = 95.0;  //z scale


bg_color = TFT_RGBToColor16bit(92, 92, 92);

//Clear the screen
//TFT_Fill_Screen(CL_BLACK);
TFT_Fill_Screen(bg_color);


  ACCEL_Start(&cACCEL_test_status);
  while (1){

  //read the accelerometer
  ACCEL_Test();

  //Check for user input
  GetInput();

  //animate the objects in the frame
  //AnimateFrame();

  //Draw the graphics
  RenderScreen();

  frame_counter++;
  
  }

}