Sub Process_Globals
Public Serial1 As Serial
Private ssd As AdafruitSSD1306
Private bmpx, bmpy As Int 'ignore
Private imageWidth, imageHeight As Int 'ignore
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
ssd.InitializeI2C(4, 0x3c)
ssd.ClearDisplay
For i = 0 To 3
DrawBitmap(32 * i, 0, 32, 32)
Next
End Sub
Private Sub DrawBitmap(x As Int, y As Int, Width As Int, Height As Int)
bmpx = x
bmpy = y
imageWidth = Width
imageHeight = Height
RunNative("drawBitmap", ssd.GFX)
ssd.Display
End Sub
#if C
#include <avr/pgmspace.h>
static const unsigned char PROGMEM bmp1[] =
{
0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,
0xff,0xe0,0x7,0xff,
0xff,0x80,0x0,0xff,
0xfe,0x0,0x0,0x7f,
0xfc,0xf,0xf0,0x3f,
0xf8,0x3f,0xfc,0x1f,
0xf8,0x7f,0xff,0xf,
0xf0,0xff,0xff,0x87,
0xe1,0xff,0xff,0x87,
0xe3,0xe7,0xff,0xc3,
0xc3,0xc3,0xc3,0xe3,
0xc7,0xc3,0x81,0xe3,
0xc7,0xc3,0xc3,0xe1,
0xc7,0xe7,0xff,0xe1,
0xc7,0xff,0xff,0xf1,
0xc7,0xff,0xff,0xf1,
0xc7,0xff,0xff,0xe1,
0xc7,0xdf,0xf9,0xe1,
0xc7,0x8f,0xf1,0xe3,
0xc3,0x87,0xe1,0xe3,
0xe3,0xc0,0x1,0xc3,
0xe1,0xe0,0x7,0xc7,
0xf0,0xf8,0xf,0x87,
0xf0,0x7f,0xff,0xf,
0xf8,0x3f,0xfc,0x1f,
0xfc,0xf,0xf8,0x3f,
0xfe,0x0,0x0,0x7f,
0xff,0x80,0x0,0xff,
0xff,0xe0,0x3,0xff,
0xff,0xfe,0x7f,0xff,
0xff,0xff,0xff,0xff
};
void drawBitmap(B4R::Object* o) {
B4R::B4RAdafruitGFX* bgfx = (B4R::B4RAdafruitGFX*)o->data.PointerField;
bgfx->gfx->drawBitmap(b4r_main::_bmpx, b4r_main::_bmpy, bmp1,b4r_main::_imagewidth
, b4r_main::_imageheight, 1);
}
#End If