Skip to content

Instantly share code, notes, and snippets.

@tanakamasayuki
Created November 19, 2020 07:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanakamasayuki/ddbfa2f5f3b5b61f6fcae9cfd008d7d3 to your computer and use it in GitHub Desktop.
Save tanakamasayuki/ddbfa2f5f3b5b61f6fcae9cfd008d7d3 to your computer and use it in GitHub Desktop.
#include "M5Lite.h"
static LGFX_Sprite sprite(&M5Lite.Lcd);
void setup() {
unsigned long time[100] = {};
int timeCnt = 0;
M5Lite.begin();
int x = 0;
int y = 0;
int w = 320;
int h = 80;
uint16_t color = TFT_RED;
int r = 40;
int rx = 40;
int ry = 40;
int x0 = 0;
int y0 = 0;
int x1 = 319;
int y1 = 0;
int x2 = 319;
int y2 = 79;
int x3 = 0;
int y3 = 79;
int angle0 = 90;
int angle1 = 270;
int r0 = 40;
int r1 = 40;
sprite.setPsram(false);
sprite.createSprite(320, 80);
time[timeCnt++] = micros(); sprite.clear();
time[timeCnt++] = micros(); sprite.drawPixel (x, y , color); // 点
time[timeCnt++] = micros(); sprite.drawFastVLine(x, y , h , color); // 垂直線
time[timeCnt++] = micros(); sprite.drawFastHLine(x, y, w , color); // 水平線
time[timeCnt++] = micros(); sprite.drawRect (x, y, w, h , color); // 矩形の外周
time[timeCnt++] = micros(); sprite.fillRect (x, y, w, h , color); // 矩形の塗り
time[timeCnt++] = micros(); sprite.drawRoundRect(x, y, w, h, r, color); // 角丸の矩形の外周
time[timeCnt++] = micros(); sprite.fillRoundRect(x, y, w, h, r, color); // 角丸の矩形の塗り
time[timeCnt++] = micros(); sprite.drawCircle (x, y , r, color); // 円の外周
time[timeCnt++] = micros(); sprite.fillCircle (x, y , r, color); // 円の塗り
time[timeCnt++] = micros(); sprite.drawEllipse (x, y, rx, ry , color); // 楕円の外周
time[timeCnt++] = micros(); sprite.fillEllipse (x, y, rx, ry , color); // 楕円の塗り
time[timeCnt++] = micros(); sprite.drawLine (x0, y0, x1, y1 , color); // 2点間の直線
time[timeCnt++] = micros(); sprite.drawTriangle (x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の外周
time[timeCnt++] = micros(); sprite.fillTriangle (x0, y0, x1, y1, x2, y2, color); // 3点間の三角形の塗り
time[timeCnt++] = micros(); sprite.drawBezier (x0, y0, x1, y1, x2, y2, color); // 3点間のベジエ曲線
time[timeCnt++] = micros(); sprite.drawBezier (x0, y0, x1, y1, x2, y2, x3, y3, color); // 4点間のベジエ曲線
time[timeCnt++] = micros(); sprite.drawArc (x, y, r0, r1, angle0, angle1, color); // 円弧の外周
time[timeCnt++] = micros(); sprite.fillArc (x, y, r0, r1, angle0, angle1, color); // 円弧の塗り
time[timeCnt++] = micros(); sprite.setColor (color); // 色指定
time[timeCnt++] = micros(); sprite.drawPixel (x, y ); // 点
time[timeCnt++] = micros(); sprite.drawFastVLine(x, y , h ); // 垂直線
time[timeCnt++] = micros(); sprite.drawFastHLine(x, y, w ); // 水平線
time[timeCnt++] = micros(); sprite.drawRect (x, y, w, h ); // 矩形の外周
time[timeCnt++] = micros(); sprite.fillRect (x, y, w, h ); // 矩形の塗り
time[timeCnt++] = micros(); sprite.drawRoundRect(x, y, w, h, r); // 角丸の矩形の外周
time[timeCnt++] = micros(); sprite.fillRoundRect(x, y, w, h, r); // 角丸の矩形の塗り
time[timeCnt++] = micros(); sprite.drawCircle (x, y , r); // 円の外周
time[timeCnt++] = micros(); sprite.fillCircle (x, y , r); // 円の塗り
time[timeCnt++] = micros(); sprite.drawEllipse (x, y, rx, ry ); // 楕円の外周
time[timeCnt++] = micros(); sprite.fillEllipse (x, y, rx, ry ); // 楕円の塗り
time[timeCnt++] = micros(); sprite.drawLine (x0, y0, x1, y1 ); // 2点間の直線
time[timeCnt++] = micros(); sprite.drawTriangle (x0, y0, x1, y1, x2, y2); // 3点間の三角形の外周
time[timeCnt++] = micros(); sprite.fillTriangle (x0, y0, x1, y1, x2, y2); // 3点間の三角形の塗り
time[timeCnt++] = micros(); sprite.drawBezier (x0, y0, x1, y1, x2, y2); // 3点間のベジエ曲線
time[timeCnt++] = micros(); sprite.drawBezier (x0, y0, x1, y1, x2, y2, x3, y3); // 4点間のベジエ曲線
time[timeCnt++] = micros(); sprite.drawArc (x, y, r0, r1, angle0, angle1); // 円弧の外周
time[timeCnt++] = micros(); sprite.fillArc (x, y, r0, r1, angle0, angle1); // 円弧の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawPixel (x, y ); // 点
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawFastVLine(x, y , h ); // 垂直線
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawFastHLine(x, y, w ); // 水平線
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawRect (x, y, w, h ); // 矩形の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillRect (x, y, w, h ); // 矩形の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawRoundRect(x, y, w, h, r); // 角丸の矩形の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillRoundRect(x, y, w, h, r); // 角丸の矩形の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawCircle (x, y , r); // 円の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillCircle (x, y , r); // 円の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawEllipse (x, y, rx, ry ); // 楕円の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillEllipse (x, y, rx, ry ); // 楕円の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawLine (x0, y0, x1, y1 ); // 2点間の直線
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawTriangle (x0, y0, x1, y1, x2, y2); // 3点間の三角形の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillTriangle (x0, y0, x1, y1, x2, y2); // 3点間の三角形の塗り
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawBezier (x0, y0, x1, y1, x2, y2); // 3点間のベジエ曲線
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawBezier (x0, y0, x1, y1, x2, y2, x3, y3); // 4点間のベジエ曲線
time[timeCnt++] = micros(); sprite.setColor (color);sprite.drawArc (x, y, r0, r1, angle0, angle1); // 円弧の外周
time[timeCnt++] = micros(); sprite.setColor (color);sprite.fillArc (x, y, r0, r1, angle0, angle1); // 円弧の塗り
time[timeCnt++] = micros();
for (int i = 0; i < timeCnt; i++) {
Serial.println(time[i]);
}
}
void loop() {
M5Lite.Ex.delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment