Skip to content

Commit

Permalink
renamed screen rotation constants
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Dec 26, 2023
1 parent a0a80f0 commit 3f76f60
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions examples/TFT_Touch_Calibrator/TFT_Touch_Calibrator.ino
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ void setup() {
analogWrite(TFT_BL, 255); // start at full brightness

// ----- init TFT display
tft.begin(); // initialize TFT display
tft.setRotation(eSCREEN_ROTATE_0); // 1=landscape (default is 0=portrait)
tft.fillScreen(ILI9341_BLACK); // note that "begin()" does not clear screen
tft.begin(); // initialize TFT display
tft.setRotation(LANDSCAPE); // 1=landscape (default is 0=portrait)
tft.fillScreen(ILI9341_BLACK); // note that "begin()" does not clear screen

// ----- announce ourselves
startSplashScreen();
Expand Down Expand Up @@ -331,5 +331,5 @@ void loop() {

// small activity bar crawls along bottom edge to give
// a sense of how frequently the main loop is executing
showActivityBar(tft.height() - 1, ILI9341_RED, ILI9341_BLACK);
showActivityBar(tft.height() - 1, ILI9341_RED, cBACKGROUND);
}
6 changes: 2 additions & 4 deletions examples/TFT_Touch_Calibrator/TextField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
* File: TextField.cpp
*/

#include <Arduino.h>
//#include "Adafruit_GFX.h" // Core graphics display library
#include "Adafruit_ILI9341.h" // TFT color display library
#include "constants.h" // Griduino constants, colors and typedefs
#include "TextField.h" // Optimize TFT display text for proportional fonts

// ========== extern ==================================
extern Adafruit_ILI9341 tft; // Griduino.ino TODO: eliminate this global
extern void setFontSize(int font); // Griduino.ino TODO: eliminate this extern
extern Adafruit_ILI9341 tft; // Griduino.ino TODO: eliminate this global
// extern void setFontSize(int font); // Griduino.ino TODO: eliminate this extern

uint16_t TextField::cBackground; // background color

Expand Down
2 changes: 1 addition & 1 deletion examples/TFT_Touch_Calibrator/Touch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void mapTouchToScreen(TSPoint touchOhms, TSPoint *screenCoord, int orientation)
screenCoord->x = constrain(screenCoord->x, 0, gScreenWidth);
screenCoord->y = constrain(screenCoord->y, 0, gScreenHeight);

if (orientation == eSCREEN_ROTATE_180) {
if (orientation == FLIPPED_LANDSCAPE) {
// if display is flipped, then also flip both x,y touchscreen coords
screenCoord->x = gScreenWidth - screenCoord->x;
screenCoord->y = gScreenHeight - screenCoord->y;
Expand Down
10 changes: 6 additions & 4 deletions examples/TFT_Touch_Calibrator/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ------- Identity for splash screen and console --------
#define PROGRAM_TITLE "Griduino"
#if defined(ARDUINO_ADAFRUIT_FEATHER_RP2040)
#define PROGRAM_VERSION "v1.13 PCB v.7"
#define PROGRAM_VERSION "v1.14 PCB v.7"
#else
#define PROGRAM_VERSION "v1.14"
#endif
Expand Down Expand Up @@ -59,9 +59,11 @@ const double degreesPerRadian = 57.2957795; // conversion factor = (360 degree
#define CONFIG_FOLDER "/Griduino"

// ----- alias names for SCREEN_ROTATION
enum {
eSCREEN_ROTATE_0 = 1, // 1=landscape
eSCREEN_ROTATE_180 = 3, // 3=landscape 180-degrees
enum Rotation {
PORTRAIT = 0, // 0 degrees = portrait
LANDSCAPE = 1, // 90 degrees = landscape
FLIPPED_PORTRAIT = 2, // 180 degrees = portrait flipped 180-degrees
FLIPPED_LANDSCAPE = 3, // 270 degrees = landscape flipped 180-degrees
};

// ----- alias names for fGetDataSource()
Expand Down

0 comments on commit 3f76f60

Please sign in to comment.