예제 #1
0
파일: application.cpp 프로젝트: albal/spark
void benchMark() {

    Serial.print(F("Text                     "));
    Serial.println(testRandomRects());
    delay(500);

    Serial.println(F("Benchmark                Time (microseconds)"));

    Serial.print(F("Screen fill              "));
    Serial.println(testFillScreen());
    delay(500);

    Serial.print(F("Text                     "));
    Serial.println(testText());
    delay(3000);


    Serial.print(F("Lines                    "));
    Serial.println(testLines(ILI9341_CYAN));
    delay(500);

    Serial.print(F("Horiz/Vert Lines         "));
    Serial.println(testFastLines(ILI9341_RED, ILI9341_BLUE));
    delay(500);

    Serial.print(F("Rectangles (outline)     "));
    Serial.println(testRects(ILI9341_GREEN));
    delay(500);

    Serial.print(F("Rectangles (filled)      "));
    Serial.println(testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
    delay(500);

    Serial.print(F("Circles (filled)         "));
    Serial.println(testFilledCircles(10, ILI9341_MAGENTA));

    Serial.print(F("Circles (outline)        "));
    Serial.println(testCircles(10, ILI9341_WHITE));
    delay(500);

    Serial.print(F("Triangles (outline)      "));
    Serial.println(testTriangles());
    delay(500);

    Serial.print(F("Triangles (filled)       "));
    Serial.println(testFilledTriangles());
    delay(500);

    Serial.print(F("Rounded rects (outline)  "));
    Serial.println(testRoundRects());
    delay(500);

    Serial.print(F("Rounded rects (filled)   "));
    Serial.println(testFilledRoundRects());
    delay(500);

    Serial.println(F("Done!"));

}
예제 #2
0
파일: a.cpp 프로젝트: Joan10/arducub
void setup(void) {
  Serial.begin(9600);
  progmemPrintln(PSTR("TFT LCD test"));

#ifdef USE_ADAFRUIT_SHIELD_PINOUT
  progmemPrintln(PSTR("Using Adafruit 2.8\" TFT Arduino Shield Pinout"));
#else
  progmemPrintln(PSTR("Using Adafruit 2.8\" TFT Breakout Board Pinout"));
#endif

  tft.reset();

  uint16_t identifier = tft.readID();

  if(identifier == 0x9325) {
    progmemPrintln(PSTR("Found ILI9325 LCD driver"));
  } else if(identifier == 0x9328) {
    progmemPrintln(PSTR("Found ILI9328 LCD driver"));
  } else if(identifier == 0x7575) {
    progmemPrintln(PSTR("Found HX8347G LCD driver"));
  } else {
    progmemPrint(PSTR("Unknown LCD driver chip: "));
    Serial.println(identifier, HEX);
    progmemPrintln(PSTR("If using the Adafruit 2.8\" TFT Arduino shield, the line:"));
    progmemPrintln(PSTR("  #define USE_ADAFRUIT_SHIELD_PINOUT"));
    progmemPrintln(PSTR("should appear in the library header (Adafruit_TFT.h)."));
    progmemPrintln(PSTR("If using the breakout board, it should NOT be #defined!"));
    progmemPrintln(PSTR("Also if using the breakout, double-check that all wiring"));
    progmemPrintln(PSTR("matches the tutorial."));
    return;
  }

  tft.begin(identifier);

  progmemPrintln(PSTR("Benchmark                Time (microseconds)"));

  progmemPrint(PSTR("Screen fill              "));
  Serial.println(testFillScreen());
  delay(500);

  progmemPrint(PSTR("Text                     "));
  Serial.println(testText());
  delay(3000);

  progmemPrint(PSTR("Lines                    "));
  Serial.println(testLines(CYAN));
  delay(500);

  progmemPrint(PSTR("Horiz/Vert Lines         "));
  Serial.println(testFastLines(RED, BLUE));
  delay(500);

  progmemPrint(PSTR("Rectangles (outline)     "));
  Serial.println(testRects(GREEN));
  delay(500);

  progmemPrint(PSTR("Rectangles (filled)      "));
  Serial.println(testFilledRects(YELLOW, MAGENTA));
  delay(500);

  progmemPrint(PSTR("Circles (filled)         "));
  Serial.println(testFilledCircles(10, MAGENTA));

  progmemPrint(PSTR("Circles (outline)        "));
  Serial.println(testCircles(10, WHITE));
  delay(500);

  progmemPrint(PSTR("Triangles (outline)      "));
  Serial.println(testTriangles());
  delay(500);

  progmemPrint(PSTR("Triangles (filled)       "));
  Serial.println(testFilledTriangles());
  delay(500);

  progmemPrint(PSTR("Rounded rects (outline)  "));
  Serial.println(testRoundRects());
  delay(500);

  progmemPrint(PSTR("Rounded rects (filled)   "));
  Serial.println(testFilledRoundRects());
  delay(500);

  progmemPrintln(PSTR("Done!"));
}
예제 #3
0
int main(int argc, char *argv[])
{
#ifdef __XENO__
	struct sched_param param = { 99 };
	mlockall(MCL_CURRENT | MCL_FUTURE);
	pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
#endif

	if (!raspi_map_hw()) {
		perror("Could not map hardware registers");
		exit(1);
	}

#ifdef __XENO__
	pthread_set_mode_np(0, PTHREAD_WARNSW|PTHREAD_PRIMARY);
#endif

	//	ILI9341(int8_t _CS, int8_t _DC, int8_t _RST, int8_t _BL, int8_t _MOSI, int8_t _SCLK, int8_t _MISO);
	ILI9341 tft = ILI9341(PIN_CS, PIN_DC, PIN_RESET, PIN_BL, PIN_MOSI, PIN_SCLK, PIN_MISO);

	printf("Setting up TFT...\n");
	tft.begin();
	
	g_HWSPI=0;
	if (argc > 1)
	{
		g_HWSPI=1;
	}

	if (g_HWSPI)
	{
		printf("Setup HW SPI parameters...\n");
	}
	else
	{
		printf("Setup SW SPI (Bit-Banger) parameters...\n");
	}

	printf("HWReset done, initializing display\n") ;
	int i, colors[8] = { ILI9341_BLACK, ILI9341_BLUE, ILI9341_RED, ILI9341_GREEN, ILI9341_CYAN, ILI9341_MAGENTA, ILI9341_WHITE, ILI9341_YELLOW }; 
	begin();
	printf("Done intializing, now fill screens...\n");
	for (i=0;i<8 ;i++ )
	{
		fillScreen(ILI9341_BLACK);
		//sleep(1);
		fillScreen(colors[i]);
		//sleep (2);
	}
	printf("Setting up for HWreset\n");

	printf("Benchmark\tTime (microseconds)\n");

	printf("Screen fill\t%f\n", testFillScreen());
	sl_delay(500);

	printf("Text\t%f\n",testText());
	sl_delay(3000);

	printf("Lines\t%f\n",testLines(ILI9341_CYAN));
	sl_delay(500);

	printf("Horiz/Vert Lines\t%f\n", testFastLines(ILI9341_RED, ILI9341_BLUE));
	sl_delay(500);

	printf("Rectangles (outline)\t%f",testRects(ILI9341_GREEN));
	sl_delay(500);

	printf("Rectangles (filled)\t%f\n", testFilledRects(ILI9341_YELLOW, ILI9341_MAGENTA));
	sl_delay(500);

	printf("Circles (filled)\t%f\n", testFilledCircles(10, ILI9341_MAGENTA));

	printf("Circles (outline)\t%f\n", testCircles(10, ILI9341_WHITE));
	sl_delay(500);

	printf("Triangles (outline)\t%f\n", testTriangles());
	sl_delay(500);

	printf("Triangles (filled)\t%f\n", testFilledTriangles());
	sl_delay(500);

	printf("Rounded rects (outline)\t%f\n", testRoundRects());
	sl_delay(500);

	printf("Rounded rects (filled)\t%f\n", testFilledRoundRects());
	sl_delay(500);

	printf("Done!\n");

	for(uint8_t rotation=0; rotation<4; rotation++) 
	{
		tft.setRotation(rotation);
		testText();
		sl_delay(1000);
	}

#ifdef __XENO__
	pthread_set_mode_np(PTHREAD_WARNSW, 0);
#endif

	return 1;
}