How to drawColorBitmap on M5STACK Core2 in Arduino IDE / PlatformIO?
-
Hello everyone
I'm playing with my new Core2 and i saw the pretty display of the factory default.
Now i want to create my own Output on the LCD. I would like to drawColorBitmap like in the clock example of the factory default.TFT_eSprite DisClockbuff = TFT_eSprite(&M5.Lcd); void clockSetup() { DisClockbuff.createSprite(164,101); DisClockbuff.drawJpg(clockImage,18401,0,0,163,101); } void clockFlush() { uint16_t posx[6] = { 4, 28, 66, 90, 127, 144 }; // colon between the numbers DisClockbuff.fillRect(0, 20, 162, 50, DisClockbuff.color565(0x1a, 0x11, 0x00)); DisClockbuff.fillRect(0, 25, 2 , 45, DisClockbuff.color565(0xff, 0x9c, 0x00)); DisClockbuff.fillRect(56,35, 5 , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00)); DisClockbuff.fillRect(56,54, 5 , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00)); DisClockbuff.fillRect(118,40, 5 , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00)); DisClockbuff.fillRect(118,57, 5 , 5 , DisClockbuff.color565(0xff, 0x9c, 0x00)); M5.Rtc.GetTime(&sytState.Rtctime); // digits DisClockbuff.drawColorBitmap(posx[0],26,24,42, DigNumber[ sytState.Rtctime.Hours / 10 ], 0xff9c00, 0x1a1100); DisClockbuff.drawColorBitmap(posx[1],26,24,42, DigNumber[ sytState.Rtctime.Hours % 10 ], 0xff9c00, 0x1a1100); DisClockbuff.drawColorBitmap(posx[2],26,24,42, DigNumber[ sytState.Rtctime.Minutes / 10 ], 0xff9c00, 0x1a1100); DisClockbuff.drawColorBitmap(posx[3],26,24,42, DigNumber[ sytState.Rtctime.Minutes % 10 ], 0xff9c00, 0x1a1100); DisClockbuff.drawColorBitmap(posx[4],33,18,35, DigNumber_35px[ sytState.Rtctime.Seconds / 10 ], 0xff9c00, 0x1a1100); DisClockbuff.drawColorBitmap(posx[5],33,18,35, DigNumber_35px[ sytState.Rtctime.Seconds % 10 ], 0xff9c00, 0x1a1100); sytState.clockCount ++; sytState.clockCount %= 6; // this i don't know what it's for DisClockbuff.drawColorBitmap(0,0,164,17, rectptrBuff[sytState.clockCount], 0xff9c00, 0x000000); // maybe this code will actually display the created image? DisClockbuff.pushSprite(72,4); }
And yes, i know there is some more code for Image representation needed. I've added this to ask how it's working.
First i tried to remove a single digit. Then i registered that the code won't run on the device.
Can somebody please explain how this code is working?
Why can't i remove a single digit?
What is the minimum requirement to draw a single digit?