コード例 #1
0
ファイル: display.cpp プロジェクト: AgriVision/Teensy_SDR
void main_display(void) {
  tft.fillScreen(BLACK);
  tft.setFont(&FreeSans9pt7b);
  // Show mid screen tune position
  tft.drawFastVLine(80, 0, 60, RED);
  show_s_meter_layout();
}
コード例 #2
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testdrawcircles(uint8_t radius, uint16_t color) {
    for (int16_t x=0; x < tft.width()+radius; x+=radius*2) {
        for (int16_t y=0; y < tft.height()+radius; y+=radius*2) {
            tft.drawCircle(x, y, radius, color);
        }
    }
}
コード例 #3
0
ファイル: tron.cpp プロジェクト: tpavlek/arduitron
void drawGUI() {
    tft.fillScreen(ST7735_BLACK);
    tft.setCursor(0,70);
    dualPrint("Play a game?");
    dualPrint("<Press Joystick>");
    lcd_image_draw(&logoImage, &tft, 0, 0, 30, 10, 100, 50);
}
コード例 #4
0
void init()
{
	spiffs_mount(); // Mount file system, in order to work with files

	Serial.begin(SERIAL_BAUD_RATE); // 115200 by default
	Serial.systemDebugOutput(true); // Allow debug output to serial

	//WifiStation.config(WIFI_SSID, WIFI_PWD);
	WifiStation.enable(false);
//	WifiAccessPoint.enable(false);

	debugf("Display start");
	startTime = millis();

	// Use this initializer if you're using a 1.8" TFT
	// tft.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab

	// Use this initializer (uncomment) if you're using a 1.44" TFT
	tft.initR(INITR_144GREENTAB);   // initialize a ST7735S chip, black tab

	tft.fillScreen(ST7735_BLACK);
	startTime = millis() - startTime;

	debugf("Initialized in %d ms\n", startTime);

	DemoScreenTimer.initializeMs(500, screen1).start(FALSE);

}
コード例 #5
0
ファイル: tron.cpp プロジェクト: tpavlek/arduitron
void setup() {
    Serial.begin(9600);
    Serial1.begin(9600);
    tft.initR(INITR_REDTAB);
    randomSeed(analogRead(4));
    joystickXCentre = analogRead(JOYSTICK_MOVE_X_PIN) - 512;
    joystickYCentre = analogRead(JOYSTICK_MOVE_Y_PIN) - 512;
    pinMode(JOYSTICK_BUTTON_PIN, INPUT_PULLUP);
    pinMode(COUNTDOWN_START_RED_1, OUTPUT);
    pinMode(COUNTDOWN_START_RED_2, OUTPUT);
    pinMode(COUNTDOWN_MID_RED_1, OUTPUT);
    pinMode(COUNTDOWN_MID_RED_2, OUTPUT);
    pinMode(COUNTDOWN_GREEN, OUTPUT);
    tft.setRotation(1); //because our screen is nonstandard rotation
    player1.score = 0;
    player2.score = 0;
    if (!SD.begin(SD_CS)) {
        Serial.println("SD Init Failed");
        return;
    }
    if (!card.init(SPI_HALF_SPEED, SD_CS)) {
        Serial.println("Raw SD Init failed");
        while (1);
    }
    tft.fillScreen(ST7735_BLACK);
}
コード例 #6
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testfillcircles(uint8_t radius, uint16_t color) {
    for (int16_t x=radius; x < tft.width(); x+=radius*2) {
        for (int16_t y=radius; y < tft.height(); y+=radius*2) {
            tft.fillCircle(x, y, radius, color);
        }
    }
}
コード例 #7
0
void setup() {
// start the spi bus
#ifdef hal_spi
  SPI.begin();
#endif
#ifdef hal_tft
  lcd.initR(INITR_BLACKTAB);   // initialize a ST7735S chip, black tab
  lcd.fillScreen(ST7735_BLACK);
#endif
  // initialize serial port
  Serial.begin(9600);
  // leonardo - wait for connection
  while(!Serial) { }
#ifdef TwoWire_h
  // start the i2C bus
  Wire.begin();
#endif
#ifdef hal_raster
  Raster.start();
#endif
#ifdef hal_compass
  compass.start();
#endif
  // start the droid filesystem (now we have serial)
  droid.fs.start();
  // center the joystick
#ifdef hal_tft
  droid.joystick[0].center = 1024 - analogRead(A1);
  droid.joystick[1].center = analogRead(A2);
#endif
  // droid.joystick_center[0] = 1024 - analogRead(A1);
  // droid.joystick_center[1] = analogRead(A2);
}
コード例 #8
0
void screen13() {
	startTime = millis();
	debugf("screen13: bmpDraw rotaton %d ms", millis() - startTime);
	tft.fillScreen(ST7735_BLACK); // Clear display
	tft.setRotation(tft.getRotation() + 1); // Inc rotation 90 degrees
	for (uint8_t i = 0; i < 4; i++)    // Draw 4 parrots
		bmpDraw(tft, "sming.bmp", tft.width() / 4 * i, tft.height() / 4 * i);
}
コード例 #9
0
ファイル: example.cpp プロジェクト: Trekky12/Adafruit_ST7735
void setup() {
    
    Serial.begin(9600);

    tft.initG();
     
    tft.fillScreen(ST7735_BLACK);


}
コード例 #10
0
ファイル: readsd.cpp プロジェクト: adamjford/CMPUT296
void setup(void) {
    Serial.begin(9600);

    // If your TFT's plastic wrap has a Red Tab, use the following:
    tft.initR(INITR_REDTAB);   // initialize a ST7735R chip, red tab
    // If your TFT's plastic wrap has a Green Tab, use the following:
    //tft.initR(INITR_GREENTAB); // initialize a ST7735R chip, green tab

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);

    Serial.print("Initializing SD card...");
    if (!SD.begin(SD_CS)) {
      Serial.println("failed!");
      return;
    }
    Serial.println("OK!");

    // clear to yellow
    tft.fillScreen(tft.Color565(0xff, 0xff, 0x00));

    lcd_image_draw(&map_image, &tft, 0, 0, 0, 0, 128, 128);

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);

    // test out reading blocks from the SD card
    if (!card.init(SPI_HALF_SPEED, SD_CS)) {
        Serial.println("Raw SD Initialization has failed");
        while (1) {};  // Just wait, stuff exploded.
        }

    // how much memory have we got left at this point?
    Serial.print("Avail mem (bytes):");
    Serial.println(AVAIL_MEM);
 
    uint32_t block_num = 4000000;
    uint32_t start = millis();
    for (int l=0; l<135; l++) {
        card.readBlock( block_num, (uint8_t *) block_buf);
        // Serial.println(block_buf[1].name);
        }
    uint32_t stop = millis();
    //Serial.println(stop - start);
    
    //dump_block((uint8_t *) block_buf, BLOCK_LEN);
    // Serial.println(block_buf[1].name);

    for(int i = 0; i < 1066; i++) {
      printRest(i);
    }
}
コード例 #11
0
ファイル: game.cpp プロジェクト: Nessphoro/pong
// shows a countdown on the screen to the start of the game
void countdown()
{
    for(int i=0;i<5;i++)
    {
        tft.fillScreen(BLACK);
        tft.setTextSize(4);
        tft.setCursor(srcWidth/2 - 10, srcHeight/2-10);
        tft.print(5-i);
        delay(1000);
    }
    tft.setTextSize(1);
}
コード例 #12
0
void draw_path(uint16_t length, coord_t path[]) {
    for (int i = 0; i < length-1; ++i) {
        //get coords
        int x1 = longitude_to_x(current_map_num, path[ i ].lon) - screen_map_x;
        int y1 = latitude_to_y( current_map_num, path[ i ].lat) - screen_map_y;
        int x2 = longitude_to_x(current_map_num, path[i+1].lon) - screen_map_x;
        int y2 = latitude_to_y( current_map_num, path[i+1].lat) - screen_map_y;

        //clipping

        //draw
        tft.drawLine(x1, y1, x2, y2, tft.Color565(255,0,0));
        }
    }
コード例 #13
0
void setup()  
{
  Serial.begin(9600);

  menuState = TESTKEYPAD_MENU;

  tft.initR(INITR_REDTAB);

  tft.setTextSize(1);
  tft.fillScreen(ST7735_BLACK);
  tft.setCursor(0, 0);
  tft.setTextColor(ST7735_WHITE,ST7735_BLACK);
  sensNum = 0;
}
コード例 #14
0
ファイル: assignment2.cpp プロジェクト: adamjford/assignment2
void setup(void) {
  Serial.begin(9600);
  pinMode(JOYSTICK_BUTTON, INPUT);
  pinMode(RATING_LED_0, OUTPUT);
  pinMode(RATING_LED_1, OUTPUT);
  pinMode(RATING_LED_2, OUTPUT);
  pinMode(RATING_LED_3, OUTPUT);
  pinMode(RATING_LED_4, OUTPUT);

  digitalWrite(JOYSTICK_BUTTON, HIGH);

  tft.initR(INITR_REDTAB);

  Serial.print("Initializing SD card...");
  if (!SD.begin(SD_CS)) {
    Serial.println("failed!");
    return;
  }
  Serial.println("OK!");

  drawMap();

  // test out reading blocks from the SD card
  if (!card.init(SPI_HALF_SPEED, SD_CS)) {
      Serial.println("Raw SD Initialization has failed");
      while (1) {};  // Just wait, stuff exploded.
  }

  verticalMidpoint = getVertical();
}
コード例 #15
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testtriangles() {
    tft.fillScreen(ST7735_BLACK);
    int color = 0xF800;
    int t;
    int w = tft.width()/2;
    int x = tft.height()-1;
    int y = 0;
    int z = tft.width();
    for(t = 0 ; t <= 15; t+=1) {
        tft.drawTriangle(w, y, y, x, z, x, color);
        x-=4;
        y+=4;
        z-=4;
        color+=100;
    }
}
コード例 #16
0
void screen1() {
	startTime = millis();
    // large block of text
    tft.fillScreen(ST7735_BLACK);
    testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST7735_WHITE);
	debugf("screen1: testdrawtext %d ms", millis() - startTime);
	DemoScreenTimer.initializeMs(1000, screen2).start(FALSE);
}
コード例 #17
0
void screen8() {
	startTime = millis();
	tft.fillScreen(ST7735_BLACK);
	testfillcircles(10, ST7735_BLUE);
	testdrawcircles(10, ST7735_WHITE);
	debugf("screen8: testfillcircles %d ms", millis() - startTime);
	DemoScreenTimer.initializeMs(1000, screen9).start(FALSE);
}
コード例 #18
0
void displayGameOver() {
    tft.fillScreen(0x0000);    // clear the screen with black
    tft.setCursor(0,0);        // set the cursor, indicates where to display
    tft.setTextWrap(false);    // no wrap
    tft.setTextSize(3);
    tft.print("\n GAME     \n\n");
    tft.print(" OVER\n\n");
    tft.setTextSize(1);
    tft.print("     SCORE: ");
    tft.print(score);
    //~ tft.print("\n TOP 5 OF THE SCORE LIST ");
    // TO_DO: print out the score list, which needs to be saved in SD cardc
   
}
コード例 #19
0
ファイル: map.cpp プロジェクト: hammadj/Edmonton-Navigation
void draw_cursor() {
    // the current position of the cursor on the screen, if visible
    uint16_t cursor_screen_x;
    uint16_t cursor_screen_y;
    if (get_cursor_screen_x_y(&cursor_screen_x, &cursor_screen_y)) {
        cursor_screen_x = cursor_map_x - screen_map_x;
        cursor_screen_y = cursor_map_y - screen_map_y;
        tft.fillCircle(cursor_screen_x, cursor_screen_y, dot_radius, RED);
    }
}
コード例 #20
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testfastlines(uint16_t color1, uint16_t color2) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t y=0; y < tft.height(); y+=5) {
        tft.drawFastHLine(0, y, tft.width(), color1);
    }
    for (int16_t x=0; x < tft.width(); x+=5) {
        tft.drawFastVLine(x, 0, tft.height(), color2);
    }
}
コード例 #21
0
ファイル: display.cpp プロジェクト: AgriVision/Teensy_SDR
void show_spectrum(void) {
  static int startx = 0, endx;
  endx = startx + 16;
  int scale = 1;
  //digitalWrite(DEBUG_PIN,1); // for timing measurements

  for (int16_t x = startx; x < endx; x += 2)
  {
    int bar = abs(myFFT.output[x * 8 / 10]) / scale;
    if (bar > 60) bar = 60;
    if (x != 80)
    {
      tft.drawFastVLine(x, 60 - bar, bar, GREEN);
      tft.drawFastVLine(x, 0, 60 - bar, BLACK);
    }
  }
  startx += 16;
  if (startx >= 160) startx = 0;
  //digitalWrite(DEBUG_PIN,0); //
}
コード例 #22
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testroundrects() {
    tft.fillScreen(ST7735_BLACK);
    int color = 100;
    int i;
    int t;
    for(t = 0 ; t <= 4; t+=1) {
        int x = 0;
        int y = 0;
        int w = tft.width()-2;
        int h = tft.height()-2;
        for(i = 0 ; i <= 16; i+=1) {
            tft.drawRoundRect(x, y, w, h, 5, color);
            x+=2;
            y+=3;
            w-=4;
            h-=6;
            color+=1100;
        }
        color+=100;
    }
}
コード例 #23
0
ファイル: game.cpp プロジェクト: Nessphoro/pong
// initialize round
// place paddles in the middle and initialize ball
void start(Paddle * RedPaddle, Paddle * BluePaddle, Ball * ActiveBall)
{
    tft.fillScreen(BLACK);

    RedPaddle->horzPosition = srcWidth /2 - RedPaddle->size/2;
    BluePaddle->horzPosition = srcWidth /2 - RedPaddle->size/2;

    drawPaddle(RedPaddle);
    drawPaddle(BluePaddle);

    initializeBall(ActiveBall);
}
コード例 #24
0
ファイル: tft.cpp プロジェクト: ubirch/ubirch-thgs
void testfillrects(uint16_t color1, uint16_t color2) {
    tft.fillScreen(ST7735_BLACK);
    for (int16_t x=tft.width()-1; x > 6; x-=6) {
        tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1);
        tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2);
    }
}
コード例 #25
0
ファイル: snake.cpp プロジェクト: Mara2020/Snake
// Updating function to change highlighting of difficulty options
void update(int selection) {
  // Replace the old selection, so that it is not highlighted.
  // Need to set the cursor to the line old selection.
  // Since every line has 8 pixels, we skip 8 pixels for every line
  if (selection == 1) {
    tft.setTextColor(WHITE);
    easy(RED);
    tft.setTextColor(RED);
    medium(WHITE);
    hard(WHITE);
  }
  
  else if (selection == 2) {
    tft.setTextColor(WHITE);
    medium(RED);
    tft.setTextColor(RED);
    easy(WHITE);
    hard(WHITE);
  }
  
  else if (selection == 3) {
    tft.setTextColor(WHITE);
    hard(RED);
    tft.setTextColor(RED);
    easy(WHITE);
    medium(WHITE);
  }
}
コード例 #26
0
ファイル: snake.cpp プロジェクト: Mara2020/Snake
// Printing
// To print snake main display
void snake() {
  // printing to the screen
  tft.fillScreen(BLACK);
  
  tft.fillRoundRect(14,20,100,40,5,CYAN);
  // where the characters will be displayed
  tft.setCursor(20, 30); 
  tft.setTextColor(BLACK);
  tft.setTextSize(3);
  tft.setTextWrap(true);
  tft.print("SNAKE");
}
コード例 #27
0
ファイル: assignment2.cpp プロジェクト: adamjford/assignment2
/*
 * Writes out at most 20 restaurants on the screen,
 * starting at the index passed in
 */
void writeOutRestaurants(uint16_t startingIndex, RestDist *distances, uint16_t length) {
  tft.fillScreen(0);
  tft.setCursor(0, 0);
  tft.setTextColor(0xFFFF);
  tft.setTextWrap(false);
  
  for (int i = startingIndex; i < 20 + startingIndex; i++) {
    if(i >= length) {
      break;
    }
    Restaurant r;
    getRestaurant(distances[i].index, &r, &card);
    tft.print(i + 1);
    tft.print(". ");
    tft.print(r.name);
    tft.print("\n");
  }
  tft.print("\n");
}
コード例 #28
0
ファイル: display.cpp プロジェクト: AgriVision/Teensy_SDR
// indicate filter bandwidth on spectrum display
void show_bandwidth(int filtermode) {
  tft.drawFastHLine(0, 61, 160, BLACK); // erase old indicator
  tft.drawFastHLine(0, 62, 160, BLACK); // erase old indicator

  switch (filtermode)	{
    case LSB_NARROW:
      tft.drawFastHLine(72, 61, 6, RED);
      tft.drawFastHLine(72, 62, 6, RED);
      break;
    case LSB_WIDE:
      tft.drawFastHLine(61, 61, 20, RED);
      tft.drawFastHLine(61, 62, 20, RED);
      break;
    case USB_NARROW:
      tft.drawFastHLine(83, 61, 6, RED);
      tft.drawFastHLine(83, 62, 6, RED);
      break;
    case USB_WIDE:
      tft.drawFastHLine(80, 61, 20, RED);
      tft.drawFastHLine(80, 62, 20, RED);
      break;
  }
}
コード例 #29
0
ファイル: assignment2.cpp プロジェクト: adamjford/assignment2
void loop() {
  uint8_t ratingFilter = getRatingFilter();
  uint16_t horiz = getHorizontal();
  uint16_t vert = getVertical();
  lightUpRatingLEDs(ratingFilter);

  tft.drawPixel(horiz, vert, 0);
  if(isButtonPressed()) {
    // wait for button to be released
    while(isButtonPressed()) { }
    displayClosestRestaurants(horiz, vert, ratingFilter * 2);
    drawMap();
  }
  lcd_image_draw(&map_image, &tft, horiz, vert, horiz, vert, 1, 1);
}
コード例 #30
-1
ファイル: display.cpp プロジェクト: DD4WH/Teensy-SDR-Rx
void show_tunestep(String S) {  // show band
  char string[80]; 
  tft.fillRect(pos_x_tunestep, pos_y_tunestep, 60, 8, BLACK); // erase old string
  tft.setTextColor(WHITE);
  tft.setCursor(pos_x_tunestep, pos_y_tunestep);
  tft.print(S);
}