本文整理汇总了C++中Adafruit_ST7735类的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ST7735类的具体用法?C++ Adafruit_ST7735怎么用?C++ Adafruit_ST7735使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Adafruit_ST7735类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testfillcircles
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);
}
}
}
示例2: drawGUI
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);
}
示例3: main_display
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();
}
示例4: init
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: setup
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: show_tunestep
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);
}
示例7: testdrawcircles
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);
}
}
}
示例8: setup
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);
}
示例9: screen13
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);
}
示例10: setup
void setup() {
Serial.begin(9600);
tft.initG();
tft.fillScreen(ST7735_BLACK);
}
示例11: setup
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);
}
}
示例12: countdown
// 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);
}
示例13: draw_path
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));
}
}
示例14: setup
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;
}
示例15: setup
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();
}