M5StickC  0.2.0
M5Display クラス

#include <M5Display.h>

M5Display の継承関係図
TFT_eSPI

公開メンバ関数

 M5Display ()
 
void begin ()
 
void sleep ()
 
void setBrightness (uint8_t brightness)
 
void drawBitmap (int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data)
 
void drawBitmap (int16_t x0, int16_t y0, int16_t w, int16_t h, const uint8_t *data)
 
void drawBitmap (int16_t x0, int16_t y0, int16_t w, int16_t h, uint16_t *data)
 
void drawBitmap (int16_t x0, int16_t y0, int16_t w, int16_t h, uint8_t *data)
 
void drawBitmap (int16_t x0, int16_t y0, int16_t w, int16_t h, const uint16_t *data, uint16_t transparent)
 
void loadHzk16 (Hzk16Types hzkTypes=InternalHzk16, const char *HZK16Path="/HZK16", const char *ASC16Path="/ASC16")
 
void setTextWrap (boolean wrap)
 
void writeHzk (char *c)
 
void highlight (bool isHighlight)
 
void setHighlightColor (uint16_t color)
 
void qrcode (const char *string, uint16_t x=5, uint16_t y=45, uint8_t width=70, uint8_t version=7)
 
void qrcode (const String &string, uint16_t x=5, uint16_t y=45, uint8_t width=70, uint8_t version=7)
 
- 基底クラス TFT_eSPI に属する継承公開メンバ関数
 TFT_eSPI (int16_t _W=TFT_WIDTH, int16_t _H=TFT_HEIGHT)
 
void init (uint8_t tc=TAB_COLOUR)
 
void begin (uint8_t tc=TAB_COLOUR)
 
virtual void drawPixel (int32_t x, int32_t y, uint32_t color)
 
virtual void drawChar (int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size)
 
virtual void drawLine (int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
 
virtual void drawFastVLine (int32_t x, int32_t y, int32_t h, uint32_t color)
 
virtual void drawFastHLine (int32_t x, int32_t y, int32_t w, uint32_t color)
 
virtual void fillRect (int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 
virtual int16_t drawChar (uint16_t uniCode, int32_t x, int32_t y, uint8_t font)
 
virtual int16_t drawChar (uint16_t uniCode, int32_t x, int32_t y)
 
virtual int16_t height (void)
 
virtual int16_t width (void)
 
void setWindow (int32_t xs, int32_t ys, int32_t xe, int32_t ye)
 
void pushColor (uint16_t color)
 
void pushColor (uint16_t color, uint32_t len)
 
void pushColors (uint16_t *data, uint32_t len, bool swap=true)
 
void pushColors (uint8_t *data, uint32_t len)
 
void fillScreen (uint32_t color)
 
void drawRect (int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
 
void drawRoundRect (int32_t x0, int32_t y0, int32_t w, int32_t h, int32_t radius, uint32_t color)
 
void fillRoundRect (int32_t x0, int32_t y0, int32_t w, int32_t h, int32_t radius, uint32_t color)
 
void setRotation (uint8_t r)
 
void invertDisplay (boolean i)
 
void drawCircle (int32_t x0, int32_t y0, int32_t r, uint32_t color)
 
void drawCircleHelper (int32_t x0, int32_t y0, int32_t r, uint8_t cornername, uint32_t color)
 
void fillCircle (int32_t x0, int32_t y0, int32_t r, uint32_t color)
 
void fillCircleHelper (int32_t x0, int32_t y0, int32_t r, uint8_t cornername, int32_t delta, uint32_t color)
 
void drawEllipse (int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
 
void fillEllipse (int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
 
void drawTriangle (int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color)
 
void fillTriangle (int32_t x0, int32_t y0, int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color)
 
void drawBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawXBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
 
void drawXBitmap (int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t fgcolor, uint16_t bgcolor)
 
void setBitmapColor (uint16_t fgcolor, uint16_t bgcolor)
 
void setPivot (int16_t x, int16_t y)
 
void setCursor (int16_t x, int16_t y)
 
void setCursor (int16_t x, int16_t y, uint8_t font)
 
void setTextColor (uint16_t color)
 
void setTextColor (uint16_t fgcolor, uint16_t bgcolor)
 
void setTextSize (uint8_t size)
 
void setTextWrap (boolean wrapX, boolean wrapY=false)
 
void setTextDatum (uint8_t datum)
 
void setTextPadding (uint16_t x_width)
 
void setFreeFont (const GFXfont *f=NULL)
 
void setTextFont (uint8_t font)
 
void spiwrite (uint8_t)
 
void writecommand (uint8_t c)
 
void writedata (uint8_t d)
 
void commandList (const uint8_t *addr)
 
uint8_t readcommand8 (uint8_t cmd_function, uint8_t index=0)
 
uint16_t readcommand16 (uint8_t cmd_function, uint8_t index=0)
 
uint32_t readcommand32 (uint8_t cmd_function, uint8_t index=0)
 
uint16_t readPixel (int32_t x0, int32_t y0)
 
void setCallback (getColorCallback getCol)
 
void readRect (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushRect (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data, uint16_t transparent)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, const uint16_t *data, uint16_t transparent)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, const uint16_t *data)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data, bool bpp8=true)
 
void pushImage (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data, uint8_t transparent, bool bpp8=true)
 
void setSwapBytes (bool swap)
 
bool getSwapBytes (void)
 
void readRectRGB (int32_t x0, int32_t y0, int32_t w, int32_t h, uint8_t *data)
 
uint8_t getRotation (void)
 
uint8_t getTextDatum (void)
 
uint8_t color16to8 (uint16_t color565)
 
int16_t getCursorX (void)
 
int16_t getCursorY (void)
 
int16_t getPivotX (void)
 
int16_t getPivotY (void)
 
uint16_t fontsLoaded (void)
 
uint16_t color565 (uint8_t red, uint8_t green, uint8_t blue)
 
uint16_t color8to16 (uint8_t color332)
 
int16_t drawNumber (long long_num, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawNumber (long long_num, int32_t poX, int32_t poY)
 
int16_t drawFloat (float floatNumber, uint8_t decimal, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawFloat (float floatNumber, uint8_t decimal, int32_t poX, int32_t poY)
 
int16_t drawString (const char *string, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawString (const char *string, int32_t poX, int32_t poY)
 
int16_t drawCentreString (const char *string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawRightString (const char *string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawString (const String &string, int32_t poX, int32_t poY, uint8_t font)
 
int16_t drawString (const String &string, int32_t poX, int32_t poY)
 
int16_t drawCentreString (const String &string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t drawRightString (const String &string, int32_t dX, int32_t poY, uint8_t font)
 
int16_t textWidth (const char *string, uint8_t font)
 
int16_t textWidth (const char *string)
 
int16_t textWidth (const String &string, uint8_t font)
 
int16_t textWidth (const String &string)
 
int16_t fontHeight (int16_t font)
 
int16_t fontHeight (void)
 
void setAddrWindow (int32_t xs, int32_t ys, int32_t w, int32_t h)
 
void startWrite (void)
 
void writeColor (uint16_t color, uint32_t len)
 
void endWrite (void)
 
uint16_t decodeUTF8 (uint8_t *buf, uint16_t *index, uint16_t remaining)
 
uint16_t decodeUTF8 (uint8_t c)
 
size_t write (uint8_t)
 
void setAttribute (uint8_t id=0, uint8_t a=0)
 
uint8_t getAttribute (uint8_t id=0)
 
void getSetup (setup_t &tft_settings)
 
void loadFont (String fontName, fs::FS &ffs)
 
void loadFont (String fontName, bool flash=true)
 
void unloadFont (void)
 
bool getUnicodeIndex (uint16_t unicode, uint16_t *index)
 
uint16_t alphaBlend (uint8_t alpha, uint16_t fgc, uint16_t bgc)
 
virtual void drawGlyph (uint16_t code)
 
void showFont (uint32_t td)
 

その他の継承メンバ

- 基底クラス TFT_eSPI に属する継承静的公開メンバ関数
static SPIClass & getSPIinstance (void)
 
- 基底クラス TFT_eSPI に属する継承公開変数類
int32_t cursor_x
 
int32_t cursor_y
 
int32_t padX
 
uint32_t textcolor
 
uint32_t textbgcolor
 
uint32_t bitmap_fg
 
uint32_t bitmap_bg
 
uint8_t textfont
 
uint8_t textsize
 
uint8_t textdatum
 
uint8_t rotation
 
int16_t _xpivot
 
int16_t _ypivot
 
uint8_t decoderState = 0
 
uint16_t decoderBuffer
 
fontMetrics gFont = { 0, 0, 0, 0, 0, 0, 0 }
 
uint16_t * gUnicode = NULL
 
uint8_t * gHeight = NULL
 
uint8_t * gWidth = NULL
 
uint8_t * gxAdvance = NULL
 
int16_t * gdY = NULL
 
int8_t * gdX = NULL
 
uint32_t * gBitmap = NULL
 
bool fontLoaded = false
 
fs::File fontFile
 
- 基底クラス TFT_eSPI に属する継承限定公開変数類
int32_t win_xe
 
int32_t win_ye
 
int32_t _init_width
 
int32_t _init_height
 
int32_t _width
 
int32_t _height
 
int32_t addr_row
 
int32_t addr_col
 
uint32_t fontsloaded
 
uint8_t glyph_ab
 
uint8_t glyph_bb
 
bool isDigits
 
bool textwrapX
 
bool textwrapY
 
bool _swapBytes
 
bool locked
 
bool inTransaction
 
bool _booted
 
bool _cp437
 
bool _utf8
 
uint32_t _lastColor
 
GFXfont * gfxFont
 

詳解

M5Display.h28 行目に定義があります。

構築子と解体子

◆ M5Display()

M5Display::M5Display ( )

M5Display.cpp4 行目に定義があります。

4  : TFT_eSPI() {
5  hzk16Used = false;
6  hzk16Type = DontUsedHzk16;
7 }

関数詳解

◆ begin()

void M5Display::begin ( )

M5Display.cpp9 行目に定義があります。

9  {
11  fillScreen(0);
12 }

◆ drawBitmap() [1/5]

void M5Display::drawBitmap ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
const uint16_t *  data 
)

M5Display.cpp372 行目に定義があります。

372  {
373  bool swap = getSwapBytes();
374  setSwapBytes(true);
375  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
376  setSwapBytes(swap);
377 }

◆ drawBitmap() [2/5]

void M5Display::drawBitmap ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
const uint16_t *  data,
uint16_t  transparent 
)

M5Display.cpp386 行目に定義があります。

386  {
387  bool swap = getSwapBytes();
388  setSwapBytes(true);
389  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data, transparent);
390  setSwapBytes(swap);
391 }

◆ drawBitmap() [3/5]

void M5Display::drawBitmap ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
const uint8_t *  data 
)

M5Display.cpp393 行目に定義があります。

393  {
394  bool swap = getSwapBytes();
395  setSwapBytes(true);
396  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (const uint16_t*)data);
397  setSwapBytes(swap);
398 }

◆ drawBitmap() [4/5]

void M5Display::drawBitmap ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
uint16_t *  data 
)

M5Display.cpp379 行目に定義があります。

379  {
380  bool swap = getSwapBytes();
381  setSwapBytes(true);
382  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, data);
383  setSwapBytes(swap);
384 }

◆ drawBitmap() [5/5]

void M5Display::drawBitmap ( int16_t  x0,
int16_t  y0,
int16_t  w,
int16_t  h,
uint8_t *  data 
)

M5Display.cpp400 行目に定義があります。

400  {
401  bool swap = getSwapBytes();
402  setSwapBytes(true);
403  pushImage((int32_t)x0, (int32_t)y0, (uint32_t)w, (uint32_t)h, (uint16_t*)data);
404  setSwapBytes(swap);
405 }

◆ highlight()

void M5Display::highlight ( bool  isHighlight)
inline

M5Display.h47 行目に定義があります。

47 { highlighted = isHighlight; }

◆ loadHzk16()

void M5Display::loadHzk16 ( Hzk16Types  hzkTypes = InternalHzk16,
const char *  HZK16Path = "/HZK16",
const char *  ASC16Path = "/ASC16" 
)

M5Display.cpp28 行目に定義があります。

28  {
29 
30  if (hzk16Used) return;
31 
32  //Hzk16Types hzkTypes = InternalHzk16
33  if(hzkTypes == InternalHzk16) {
34  //#if defined(_ASC16_) && defined(_HZK16_)
35  pAscCharMatrix = (uint8_t *)&ASC16[0];
36 
37  pGbkCharMatrix = (uint8_t *)&HZK16[0];
38 
39  Serial.println("HZK16 path: Internal");
40 
41  Serial.println("ASC16 path: Internal");
42 
43  hzk16Used = initHzk16(true, nullptr, nullptr);
44  }
45 
46  Serial.print("HZK16 init result: ");
47  Serial.println(isHzk16Used());
48 }

◆ qrcode() [1/2]

void M5Display::qrcode ( const char *  string,
uint16_t  x = 5,
uint16_t  y = 45,
uint8_t  width = 70,
uint8_t  version = 7 
)

M5Display.cpp407 行目に定義があります。

407  {
408 
409  // Create the QR code
410  QRCode qrcode;
411  uint8_t qrcodeData[qrcode_getBufferSize(version)];
412  qrcode_initText(&qrcode, qrcodeData, version, 0, string);
413 
414  // Top quiet zone
415  uint8_t thickness = width / qrcode.size;
416  uint16_t lineLength = qrcode.size * thickness;
417  uint8_t xOffset = x + (width-lineLength)/2;
418  uint8_t yOffset = y + (width-lineLength)/2;
419  fillRect(x, y, width, width, TFT_WHITE);
420 
421  for (uint8_t y = 0; y < qrcode.size; y++) {
422  for (uint8_t x = 0; x < qrcode.size; x++) {
423  uint8_t q = qrcode_getModule(&qrcode, x, y);
424  if (q) fillRect(x * thickness + xOffset, y * thickness + yOffset, thickness, thickness, TFT_BLACK);
425  }
426  }
427 }

◆ qrcode() [2/2]

void M5Display::qrcode ( const String &  string,
uint16_t  x = 5,
uint16_t  y = 45,
uint8_t  width = 70,
uint8_t  version = 7 
)

M5Display.cpp429 行目に定義があります。

429  {
430  int16_t len = string.length() + 1;
431  char buffer[len];
432  string.toCharArray(buffer, len);
433  qrcode(buffer, x, y, width, version);
434 }

◆ setBrightness()

void M5Display::setBrightness ( uint8_t  brightness)

◆ setHighlightColor()

void M5Display::setHighlightColor ( uint16_t  color)
inline

M5Display.h49 行目に定義があります。

49 { highlightcolor = color; istransparent = false; }

◆ setTextWrap()

void M5Display::setTextWrap ( boolean  wrap)

M5Display.cpp370 行目に定義があります。

370 { textwrap = w; }

◆ sleep()

void M5Display::sleep ( )

◆ writeHzk()

void M5Display::writeHzk ( char *  c)

M5Display.cpp111 行目に定義があります。

111  {
112 
113  char *ret = c;
114 
115  ascCharWidth = 8 * textsize;
116 
117  ascCharHeigth = 16 * textsize;
118 
119  gbkCharWidth = ascCharHeigth;
120 
121  gbkCharHeight = gbkCharWidth;
122  if(ret == NULL) return;
123  while(*ret != '\0'){
124  while(*ret <= 0xA0){
125  if(*ret == '\0') return;
126  writeHzkAsc(*ret);
127  ret++;
128  }
129  writeHzkGbk(ret);
130  ret++;
131  ret++;
132  }
133 }

このクラス詳解は次のファイルから抽出されました:
TFT_eSPI::TFT_eSPI
TFT_eSPI(int16_t _W=TFT_WIDTH, int16_t _H=TFT_HEIGHT)
Definition: In_eSPI.cpp:142
TFT_eSPI::pushImage
void pushImage(int32_t x0, int32_t y0, int32_t w, int32_t h, uint16_t *data)
Definition: In_eSPI.cpp:1032
qrcode_initText
int8_t qrcode_initText(QRCode *qrcode, uint8_t *modules, uint8_t version, uint8_t ecc, const char *data)
Definition: qrcode.c:851
TFT_WHITE
#define TFT_WHITE
Definition: In_eSPI.h:527
TFT_eSPI::width
virtual int16_t width(void)
Definition: In_eSPI.cpp:2313
TFT_eSPI::fillScreen
void fillScreen(uint32_t color)
Definition: In_eSPI.cpp:1892
M5Display::qrcode
void qrcode(const char *string, uint16_t x=5, uint16_t y=45, uint8_t width=70, uint8_t version=7)
Definition: M5Display.cpp:407
TFT_BLACK
#define TFT_BLACK
Definition: In_eSPI.h:512
TFT_eSPI::getSwapBytes
bool getSwapBytes(void)
Definition: In_eSPI.cpp:1547
qrcode_getModule
bool qrcode_getModule(QRCode *qrcode, uint8_t x, uint8_t y)
Definition: qrcode.c:855
TFT_eSPI::fillRect
virtual void fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
Definition: In_eSPI.cpp:3876
TFT_eSPI::textsize
uint8_t textsize
Definition: In_eSPI.h:850
TFT_eSPI::setSwapBytes
void setSwapBytes(bool swap)
Definition: In_eSPI.cpp:1537
qrcode_getBufferSize
uint16_t qrcode_getBufferSize(uint8_t version)
Definition: qrcode.c:770
TFT_eSPI::begin
void begin(uint8_t tc=TAB_COLOUR)
Definition: In_eSPI.cpp:276
InternalHzk16
@ InternalHzk16
Definition: M5Display.h:24
BitBucket::data
uint8_t * data
Definition: qrcode.c:171
QRCode
Definition: qrcode.h:65
DontUsedHzk16
@ DontUsedHzk16
Definition: M5Display.h:23