Update for spelling etc. in comments!
This commit is contained in:
1 parent
aefcf5af63
commit
d506a3c49d
197 files changed
+1006
-757
No files matched your search
@@ -64,7 +64,7 @@
|
||||
// JOYSTICK_X_PIN and JOYSTICK_Y_PIN specify analog input pins for manually
|
||||
// controlling the eye with an analog joystick. If set to -1 or if not
|
||||
// defined, the eye will move on its own.
|
||||
// IRIS_PIN speficies an analog input pin for a photocell to make pupils
|
||||
// IRIS_PIN specifies an analog input pin for a photocell to make pupils
|
||||
// react to light (or potentiometer for manual control). If set to -1 or
|
||||
// if not defined, the pupils will change on their own.
|
||||
// BLINK_PIN specifies an input pin for a button (to ground) that will
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// boards and WILL NOT work on normal Arduino or other boards!
|
||||
//
|
||||
// SEE FILE "config.h" FOR MOST CONFIGURATION (graphics, pins, display type,
|
||||
// etc). Probably won't need to edit THIS file unless you're doing some
|
||||
// etc.). Probably won't need to edit THIS file unless you're doing some
|
||||
// extremely custom modifications.
|
||||
//
|
||||
// Adafruit invests time and resources providing this open source code,
|
||||
@@ -91,7 +91,7 @@ void updateEye (void)
|
||||
|
||||
// EYE-RENDERING FUNCTION --------------------------------------------------
|
||||
void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
|
||||
// Use native 32 bit variables where possible as this is 10% faster!
|
||||
// Use native 32-bit variables where possible as this is 10% faster!
|
||||
uint8_t e, // Eye array index; 0 or 1 for left/right
|
||||
uint32_t iScale, // Scale factor for iris
|
||||
uint32_t scleraX, // First pixel X offset into sclera image
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
// JOYSTICK_X_PIN and JOYSTICK_Y_PIN specify analog input pins for manually
|
||||
// controlling the eye with an analog joystick. If set to -1 or if not
|
||||
// defined, the eye will move on its own.
|
||||
// IRIS_PIN speficies an analog input pin for a photocell to make pupils
|
||||
// IRIS_PIN specifies an analog input pin for a photocell to make pupils
|
||||
// react to light (or potentiometer for manual control). If set to -1 or
|
||||
// if not defined, the pupils will change on their own.
|
||||
// BLINK_PIN specifies an input pin for a button (to ground) that will
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
// boards and WILL NOT work on normal Arduino or other boards!
|
||||
//
|
||||
// SEE FILE "config.h" FOR MOST CONFIGURATION (graphics, pins, display type,
|
||||
// etc). Probably won't need to edit THIS file unless you're doing some
|
||||
// etc.). Probably won't need to edit THIS file unless you're doing some
|
||||
// extremely custom modifications.
|
||||
//
|
||||
// Adafruit invests time and resources providing this open source code,
|
||||
@@ -91,7 +91,7 @@ void updateEye (void)
|
||||
|
||||
// EYE-RENDERING FUNCTION --------------------------------------------------
|
||||
void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
|
||||
// Use native 32 bit variables where possible as this is 10% faster!
|
||||
// Use native 32-bit variables where possible as this is 10% faster!
|
||||
uint8_t e, // Eye array index; 0 or 1 for left/right
|
||||
uint32_t iScale, // Scale factor for iris
|
||||
uint32_t scleraX, // First pixel X offset into sclera image
|
||||
|
||||
@@ -249,12 +249,12 @@ void jpegInfo() {
|
||||
// Show the execution time (optional)
|
||||
//####################################################################################################
|
||||
// WARNING: for UNO/AVR legacy reasons printing text to the screen with the Mega might not work for
|
||||
// sketch sizes greater than ~70KBytes because 16 bit address pointers are used in some libraries.
|
||||
// sketch sizes greater than ~70KBytes because 16-bit address pointers are used in some libraries.
|
||||
|
||||
// The Due will work fine with the HX8357_Due library.
|
||||
|
||||
void showTime(uint32_t msTime) {
|
||||
//tft.setCursor(0, 0);
|
||||
//tft.setcursor(0, 0);
|
||||
//tft.setTextFont(1);
|
||||
//tft.setTextSize(2);
|
||||
//tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
@@ -120,7 +120,7 @@ void setup(void) {
|
||||
// EYE-RENDERING FUNCTION --------------------------------------------------
|
||||
#define BUFFER_SIZE 256 // 64 to 512 seems optimum = 30 fps for default eye
|
||||
void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
|
||||
// Use native 32 bit variables where possible as this is 10% faster!
|
||||
// Use native 32-bit variables where possible as this is 10% faster!
|
||||
uint8_t e, // Eye array index; 0 or 1 for left/right
|
||||
uint32_t iScale, // Scale factor for iris
|
||||
uint32_t scleraX, // First pixel X offset into sclera image
|
||||
@@ -134,7 +134,7 @@ void drawEye( // Renders one eye. Inputs must be pre-clipped & valid.
|
||||
uint32_t d;
|
||||
|
||||
uint32_t pixels = 0;
|
||||
uint16_t pbuffer[BUFFER_SIZE]; // This one needs to be 16 bit
|
||||
uint16_t pbuffer[BUFFER_SIZE]; // This one needs to be 16-bit
|
||||
|
||||
// Set up raw pixel dump to entire screen. Although such writes can wrap
|
||||
// around automatically from end of rect back to beginning, the region is
|
||||
|
||||
@@ -58,7 +58,7 @@ void screenshotToConsole()
|
||||
|
||||
// Get first pixel to prime the Run Length Encoded
|
||||
// Function format is: tft.readRectRGB( x, y, width, height, buffer);
|
||||
// color is a pointer to a buffer that the RGB 8 bit values are piped into
|
||||
// color is a pointer to a buffer that the RGB 8-bit values are piped into
|
||||
// the buffer size must be >= (width * height * 3) bytes
|
||||
eye[e].tft.readRectRGB(0, 0, 1, 1, color); // 1 x 1 so reading 1 pixel at 0,0
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ void setup(void) {
|
||||
void loop()
|
||||
{
|
||||
tft.fillRectHGradient(0, 0, 160, 50, TFT_MAGENTA, TFT_BLUE);
|
||||
tft.setCursor(10,10);
|
||||
tft.setcursor(10,10);
|
||||
tft.print("Horizontal gradient");
|
||||
|
||||
tft.fillRectVGradient(0, 60, 160, 50, TFT_ORANGE, TFT_RED);
|
||||
tft.setCursor(10,70);
|
||||
tft.setcursor(10,70);
|
||||
tft.print("Vertical gradient");
|
||||
|
||||
while(1) delay(100); // Wait here
|
||||
|
||||
@@ -31,7 +31,7 @@ void loop() {
|
||||
/* Dessine la fractale */
|
||||
draw_Julia(-0.8,+0.156,zoom);
|
||||
tft.fillRect(0, 0, 150, 20, TFT_BLACK);
|
||||
tft.setCursor(0,15);
|
||||
tft.setcursor(0,15);
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.print(" Zoom = ");
|
||||
tft.println(zoom);
|
||||
@@ -46,12 +46,12 @@ void loop() {
|
||||
|
||||
void draw_Julia(float c_r, float c_i, float zoom) {
|
||||
|
||||
tft.setCursor(0,0);
|
||||
tft.setcursor(0,0);
|
||||
float new_r = 0.0, new_i = 0.0, old_r = 0.0, old_i = 0.0;
|
||||
|
||||
/* Pour chaque pixel en X */
|
||||
|
||||
for(int16_t x = SCREEN_WIDTH/2 - 1; x >= 0; x--) { // Rely on inverted symettry
|
||||
for(int16_t x = SCREEN_WIDTH/2 - 1; x >= 0; x--) { // Rely on inverted symmetry
|
||||
/* Pour chaque pixel en Y */
|
||||
for(uint16_t y = 0; y < SCREEN_HEIGHT; y++) {
|
||||
old_r = 1.5 * (x - SCREEN_WIDTH / 2) / (0.5 * zoom * SCREEN_WIDTH);
|
||||
|
||||
@@ -112,7 +112,7 @@ void loop() {
|
||||
|
||||
// Setting textDatum does nothing when using tft.print
|
||||
tft.fillScreen(TFT_BLUE); // Clear screen
|
||||
tft.setCursor(0,60); // To be compatible with Adafruit_GFX the cursor datum is always bottom left
|
||||
tft.setcursor(0,60); // To be compatible with Adafruit_GFX the cursor datum is always bottom left
|
||||
tft.print("âäàå"); // Using tft.print means text background is NEVER rendered
|
||||
delay(2000);
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ void touch_calibrate()
|
||||
} else {
|
||||
// data not valid so recalibrate
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(20, 0);
|
||||
tft.setcursor(20, 0);
|
||||
tft.setTextFont(2);
|
||||
tft.setTextSize(1);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
@@ -162,7 +162,7 @@ void touch_calibrate()
|
||||
} else {
|
||||
// data not valid so recalibrate
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(20, 0);
|
||||
tft.setcursor(20, 0);
|
||||
tft.setTextFont(2);
|
||||
tft.setTextSize(1);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Icon images are stored in tabs ^ e.g. Alert.h etc above this line
|
||||
// Icon images are stored in tabs ^ e.g. Alert.h etc.above this line
|
||||
// more than one icon can be in a header file
|
||||
|
||||
// Arrays containing FLASH images can be created with UTFT library tool:
|
||||
|
||||
@@ -46,7 +46,7 @@ void drawBmp(const char *filename, int16_t x, int16_t y) {
|
||||
bmpFS.read(lineBuffer, sizeof(lineBuffer));
|
||||
uint8_t* bptr = lineBuffer;
|
||||
uint16_t* tptr = (uint16_t*)lineBuffer;
|
||||
// Convert 24 to 16 bit colours
|
||||
// Convert 24 to 16-bit colours
|
||||
for (uint16_t col = 0; col < w; col++)
|
||||
{
|
||||
b = *bptr++;
|
||||
|
||||
@@ -84,7 +84,7 @@ void loop() {
|
||||
tft.setTextFont(0); // Select font 0 which is the Adafruit font
|
||||
tft.drawString("Original Adafruit font!", xpos, 5);
|
||||
|
||||
// The new larger fonts do not need to use the .setCursor call, coords are embedded
|
||||
// The new larger fonts do not need to use the .setcursor call, coords are embedded
|
||||
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
|
||||
|
||||
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
|
||||
|
||||
@@ -63,7 +63,7 @@ int max_allowed = 1000; // Maximum number of save images allowed before a resta
|
||||
// These are default values, this sketch obtains the actual values from the Arduino board
|
||||
int tft_width = 480; // default TFT width (automatic - sent by Arduino)
|
||||
int tft_height = 480; // default TFT height (automatic - sent by Arduino)
|
||||
int color_bytes = 2; // 2 for 16 bit, 3 for three RGB bytes (automatic - sent by Arduino)
|
||||
int color_bytes = 2; // 2 for 16-bit, 3 for three RGB bytes (automatic - sent by Arduino)
|
||||
|
||||
import processing.serial.*;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// over the serial port. Use a high baud rate, e.g. for an ESP8266:
|
||||
// Serial.begin(921600);
|
||||
|
||||
// At 921600 baud a 320 x 240 image with 16 bit colour transfers can be sent to the
|
||||
// PC client in ~1.67s and 24 bit colour in ~2.5s which is close to the theoretical
|
||||
// At 921600 baud a 320 x 240 image with 16-bit colour transfers can be sent to the
|
||||
// PC client in ~1.67s and 24-bit colour in ~2.5s which is close to the theoretical
|
||||
// minimum transfer time.
|
||||
|
||||
// This sketch has been created to work with the TFT_eSPI library here:
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
// Number of pixels to send in a burst (minimum of 1), no benefit above 8
|
||||
// NPIXELS values and render times:
|
||||
// NPIXELS 1 = use readPixel() = >5s and 16 bit pixels only
|
||||
// NPIXELS 1 = use readPixel() = >5s and 16-bit pixels only
|
||||
// NPIXELS >1 using rectRead() 2 = 1.75s, 4 = 1.68s, 8 = 1.67s
|
||||
#define NPIXELS 8 // Must be integer division of both TFT width and TFT height
|
||||
|
||||
@@ -104,7 +104,7 @@ bool serialScreenServer(String filename)
|
||||
wait = false; // No need to wait anymore
|
||||
lastCmdTime = millis(); // Set last received command time
|
||||
|
||||
// Send screen size etc using a simple header with delimiters for client checks
|
||||
// Send screen size etc.using a simple header with delimiters for client checks
|
||||
sendParameters(filename);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ bool serialScreenServer(String filename)
|
||||
}
|
||||
|
||||
//====================================================================================
|
||||
// Send screen size etc using a simple header with delimiters for client checks
|
||||
// Send screen size etc.using a simple header with delimiters for client checks
|
||||
//====================================================================================
|
||||
void sendParameters(String filename)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ void sendParameters(String filename)
|
||||
|
||||
Serial.write('Y'); // Bits per pixel (16 or 24)
|
||||
if (NPIXELS > 1) Serial.write(BITS_PER_PIXEL);
|
||||
else Serial.write(16); // readPixel() only provides 16 bit values
|
||||
else Serial.write(16); // readPixel() only provides 16-bit values
|
||||
|
||||
Serial.write('?'); // Filename next
|
||||
Serial.print(filename);
|
||||
|
||||
@@ -66,7 +66,7 @@ void touch_calibrate()
|
||||
|
||||
// Calibrate
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
tft.setCursor(20, 0);
|
||||
tft.setcursor(20, 0);
|
||||
tft.setTextFont(2);
|
||||
tft.setTextSize(1);
|
||||
tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
// Viewports have a number of potential uses:
|
||||
// - create a "virtual" TFT screen smaller than the actual TFT screen
|
||||
// - render GUI items (menus etc) in a viewport, erase GUI item by redrawing whole screen,
|
||||
// - render GUI items (menus etc.) in a viewport, erase GUI item by redrawing whole screen,
|
||||
// this will be fast because only the viewport will be refreshed (e.g. clearing menu)
|
||||
// - limit screen refresh to a particular area, e.g. changing numbers, icons or graph plotting
|
||||
// - showing a small portion of a larger image or sprite, this allows panning and scrolling
|
||||
|
||||
@@ -134,7 +134,7 @@ unsigned long testFillScreen() {
|
||||
unsigned long testText() {
|
||||
tft.fillScreen(TFT_BLACK);
|
||||
unsigned long start = micros();
|
||||
tft.setCursor(0, 0);
|
||||
tft.setcursor(0, 0);
|
||||
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
|
||||
tft.println("Hello World!");
|
||||
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
blendedColor = tft.alphaBlend(alpha, fg_color, bg_color);
|
||||
|
||||
The alphaBlend() function operates on 16 bit colours only
|
||||
The alphaBlend() function operates on 16-bit colours only
|
||||
A test is included where the colours are mapped to 8 bits after blending
|
||||
|
||||
Information on alpha blending is here
|
||||
@@ -43,7 +43,7 @@ void setup(void) {
|
||||
// -------------------------------------------------------------------------
|
||||
void loop()
|
||||
{
|
||||
// 16 bit colours (5 bits red, 6 bits green, 5 bits blue)
|
||||
// 16-bit colours (5 bits red, 6 bits green, 5 bits blue)
|
||||
// Blend from white to full spectrum
|
||||
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
|
||||
{
|
||||
@@ -79,18 +79,18 @@ void loop()
|
||||
delay(4000);
|
||||
|
||||
//*
|
||||
// Decrease to 8 bit colour (3 bits red, 3 bits green, 2 bits blue)
|
||||
// Decrease to 8-bit colour (3 bits red, 3 bits green, 2 bits blue)
|
||||
// Blend from white to full spectrum
|
||||
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
|
||||
{
|
||||
// Convert blended 16 bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
|
||||
// Convert blended 16-bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
|
||||
for (int c = 0; c < 192; c++) tft.drawPixel(c, a/2, tft.color8to16(tft.color16to8(tft.alphaBlend(a, rainbow(c), 0xFFFF))));
|
||||
}
|
||||
|
||||
// Blend from full spectrum to black
|
||||
for (int a = 255; a > 2; a-=2)
|
||||
{
|
||||
// Convert blended 16 bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
|
||||
// Convert blended 16-bit colour to 8 bits to reduce colour resolution, then map back to 16 bits for displaying
|
||||
for (int c = 0; c < 192; c++) tft.drawPixel(c, 128 + (255-a)/2, tft.color8to16(tft.color16to8(tft.alphaBlend(a, rainbow(c), 0))));
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void loop()
|
||||
//*/
|
||||
|
||||
/*
|
||||
// 16 bit colours (5 bits red, 6 bits green, 5 bits blue)
|
||||
// 16-bit colours (5 bits red, 6 bits green, 5 bits blue)
|
||||
for (int a = 0; a < 256; a+=2) // Alpha 0 = 100% background, alpha 255 = 100% foreground
|
||||
{
|
||||
for (int c = 0; c < 192; c++) tft.drawPixel(c, a/2, tft.alphaBlend(a, rainbow(c), TFT_CYAN));
|
||||
@@ -137,7 +137,7 @@ void loop()
|
||||
|
||||
|
||||
// #########################################################################
|
||||
// Return a 16 bit rainbow colour
|
||||
// Return a 16-bit rainbow colour
|
||||
// #########################################################################
|
||||
unsigned int rainbow(byte value)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ unsigned int rainbow(byte value)
|
||||
|
||||
value = value%192;
|
||||
|
||||
byte red = 0; // Red is the top 5 bits of a 16 bit colour value
|
||||
byte red = 0; // Red is the top 5 bits of a 16-bit colour value
|
||||
byte green = 0; // Green is the middle 6 bits, but only top 5 bits used here
|
||||
byte blue = 0; // Blue is the bottom 5 bits
|
||||
|
||||
|
||||
Reference in new issue
Block a user