/* *** Paint contents of screen. ********************************************** */ void Demo_4_Screen() { unsigned int bitmaplength; /* Start a new Display List. */ FT_ListStart(DLIST); // Clear screen. Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show logo animation. CMDLogo(); /* Finish current display list. Make SWAP. */ FT_ListEnd(END_DL_SWAP); // FT programmer guide says the logo plays during about 2,5 seconds. // We wait 3 seconds. CyDelay(3000); // For the screen saver, we use the same bitmap used in previous demo but // in zlib compressed format. bitmaplength = sizeof(testbitmapzlib); FT_ListStart(DLIST); CMDInflate(RAM_G); // Inflate data in RAM_G memory at offset 0. FT_Write_ByteArray_4(testbitmapzlib, bitmaplength); // Send Zlib data. FT_ListEnd(END_DL_NOSWAP); FT_ListStart(DLIST); CMDScreenSaver(); // Clear screen. Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show top message. DLColorRGB(0xFF, 0x00, 0x00); CMDText( 10, 10, 30, 0, "PSoC Eve Library DEMO/TEST"); CMDText( 10, 50, 30, 0, "Screen: DEMO 4 (Logo & ScreenSaver)"); // Restore white color or the bitmap will be tinted with colorRGB. DLColorRGB(0xFF, 0xFF, 0xFF); DLTag(D4_EXIT); DLBegin(PRIMITIVE_BITMAP); // Start new primitive (BITMAP. DLBitmapSource(0x00); // Source address 0 in RAM_G. DLBitmapLayout(BITMAP_LAYOUT_RGB565, 64*2, 64); DLBitmapSize(BITMAP_SIZE_FILTER_NEAREST, BITMAP_SIZE_WRAP_BORDER, BITMAP_SIZE_WRAP_BORDER, 64, 64); DLMacro(0); FT_ListEnd(END_DL_SWAP); }
/* *** Paint contents of screen. ********************************************** */ void Demo_6_Screen() { uint32 tnumber = 2016; FT_ListStart(DLIST); // Clear screen. Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show top message. DLColorRGB(0xFF, 0x00, 0x00); CMDText( 10, 10, 30, 0, "PSoC Eve Library DEMO/TEST"); CMDText( 10, 50, 30, 0, "Screen: DEMO 6 (Widgets)"); CMDBgcolor(0x00, 0x00, 0xFF); DLColorRGB(0xFF, 0xFF, 0xFF); CMDFgcolor(0xFF, 0xFF, 0x00); // Progress bar. CMDProgressBar(30, 100, 150, 20, 0, 50, 100); // Scroll bar. CMDScrollBar(30, 150, 150, 20, 0, 50, 10, 100); // Toggle CMDToggle(30, 200, 100, 28, 0, TOGGLE_STATE_OFF, "ON" "\xFF" "OFF"); // Gauge CMDGauge(250, 150, 50, 0, 5, 4, 30, 100); // Clock CMDClock(370, 150, 50, 0, 8, 15, 0, 0); // Number & Setbase // If FT800, only shows the number in decimal base. // If FT810, shows the number in decimal, binary and hexadecimal. CMDNumber(250, 210, 28, 0, tnumber); #if defined EVE_FT810 CMDSetBase(NUMBER_BASE_BINARY); CMDNumber(250, 230, 28, 0, tnumber); CMDSetBase(NUMBER_BASE_HEXADECIMAL); CMDNumber(250, 250, 28, 0, tnumber); #endif // Exit button.. CMDFgcolor(0x00, 0x00, 0xFF); // Button color = blue. DLColorRGB(0xFF, 0xFF, 0xFF); // Text color = white. DLTag(D6_BTN_EXIT); // For touch. Assign tag 1 to this button. CMDButton(LCDWIDTH - 120, LCDHEIGHT - 30, 100, 30, 28, OPT_3D, (char*)"Exit"); FT_ListEnd(END_DL_SWAP); }
/* *** Demo main loop. To be called from the program main loop. *************** */ void Demo_4_Loop() { // Here we read the TAG register from EVE chip to know if a button is pressed. uint8 rdtag = FT_Read_Byte(REG_TOUCH_TAG); // Call the callback function with value of TAG. if (rdtag == D4_EXIT) { FT_ListStart(DLIST); // Clear screen. Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show message. DLColorRGB(0x00, 0xFF, 0x00); CMDText( LCDWIDTH / 2, 10, 30, OPT_CENTERX, "Please Wait..."); DLColorRGB(0xFF, 0xFF, 0xFF); CMDSpinner(LCDWIDTH / 2, LCDHEIGHT / 2, SPINNER_ROUND, 1); FT_ListEnd(END_DL_NOSWAP); // The spinner command swaps the display. CyDelay(5000); (*TouchCallback)(rdtag); } }
/* *** Paint contents of screen. ********************************************** */ void Demo_9_Screen() { unsigned int bitmaplength; // Place the bitmap to be used in RAM_G. Using zlib compressed version of bitmap. bitmaplength = sizeof(testbitmapzlib); FT_ListStart(DLIST); CMDInflate(RAM_G); // Inflate data in RAM_G memory at offset 0. FT_Write_ByteArray_4(testbitmapzlib, bitmaplength); // Send Zlib data. FT_ListEnd(END_DL_NOSWAP); /* Start a new Display List. */ FT_ListStart(DLIST); // Num. format for Vertex2F. DLVertexFormat(VERTEX_FORMAT_1); // 1/1 // Clear screen. // Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show top message. DLColorRGB(0xFF, 0x00, 0x00); CMDText( 10, 10, 30, 0, "PSoC Eve Library DEMO/TEST"); CMDText( 10, 50, 30, 0, "Screen: DEMO 9 (bitmaps)"); DLColorRGB(0xFF, 0xFF, 0xFF); // Here we save context because the matrix transformations in next // tests will affect the text at the exit button. // At the end we restore context so text in exit button is shown correctly. DLSaveContext(); // normal bitmap DLBegin(PRIMITIVE_BITMAP); // Start new primitive (BITMAP. DLBitmapSource(0x00); // Source address 0 in RAM_G. DLBitmapLayout(BITMAP_LAYOUT_RGB565, 64*2, 64); DLBitmapSize(BITMAP_SIZE_FILTER_NEAREST, BITMAP_SIZE_WRAP_BORDER, BITMAP_SIZE_WRAP_BORDER, 64, 64); DLVertex2F(5, 100); // Double widht DLBitmapTransformA(128); DLBitmapSize(BITMAP_SIZE_FILTER_NEAREST, BITMAP_SIZE_WRAP_BORDER, BITMAP_SIZE_WRAP_BORDER, 128, 64); DLVertex2F(70, 100); DLRestoreContext(); // Double height DLBitmapTransformE(128); DLBitmapSize(BITMAP_SIZE_FILTER_NEAREST, BITMAP_SIZE_WRAP_BORDER, BITMAP_SIZE_WRAP_BORDER, 64, 128); DLVertex2F(5, 100 + 65); DLRestoreContext(); // Scale DLBegin(PRIMITIVE_BITMAP); DLBitmapHandle(0); DLBitmapSource(0x00); // Source address 0 in RAM_G. DLBitmapLayout(BITMAP_LAYOUT_RGB565, 64*2, 64); DLBitmapSize(BITMAP_SIZE_FILTER_NEAREST, BITMAP_SIZE_WRAP_BORDER, BITMAP_SIZE_WRAP_BORDER, 64, 64); CMDLoadIdentity(); CMDScale(2 * 65536, 2 * 65536); CMDSetmatrix(); DLVertex2II(70, 100 + 65, 0, 0); // Rotate CMDLoadIdentity(); CMDRotate(-32 * 65536 / 360); CMDSetmatrix(); DLVertex2II(70 + 70, 100 + 65, 0, 0); // Scale & translate CMDLoadIdentity(); CMDTranslate(65536 * 32, 65536 * 32); CMDScale(2 * 65536, 2 * 65536); CMDTranslate(65536 * -32, 65536 * -32); CMDSetmatrix(); DLVertex2II(70 + 70 + 70, 100 + 65, 0, 0); // Restore the context. DLRestoreContext(); // Exit button.. CMDFgcolor(0x00, 0x00, 0xFF); // Button color = blue. DLColorRGB(0xFF, 0xFF, 0xFF); // Text color = white. DLTag(D9_BTN_EXIT); // For touch. Assign tag 1 to this button. CMDButton(LCDWIDTH - 120, LCDHEIGHT - 30, 100, 30, 28, OPT_3D, (char*)"Exit"); /* Finish current display list. Make SWAP. */ FT_ListEnd(END_DL_SWAP); }
TREE * CMDItem () { extern char c; TREE * item; while (isspace (c)) { c = CMDRead (); } if (c == '(') { c = CMDRead (); item = CMDList (',', CMDItem); if (c != ')') { error (1, 0, CMD_FORMAT, c, ')'); } c = CMDRead (); return (item); } if (c == '[') { c = CMDRead (); item = CMDList (':', CMDItem); if (c != ']') { error (1, 0, CMD_FORMAT, c, ']'); } c = CMDRead (); return (item); } if (c == '{') { c = CMDRead (); item = CMDList (';', CMDItem); if (c != '}') { error (1, 0, CMD_FORMAT, c, '}'); } c = CMDRead (); return (item); } if (c == '\"') { c = CMDRead (); item = CMDText ('\"'); if (c != '\"') { error (1, 0, CMD_FORMAT, c, '\"'); } c = CMDRead (); return (item); } if (c == '\'') { c = CMDRead (); item = CMDText ('\''); if (c != '\'') { error (1, 0, CMD_FORMAT, c, '\''); } c = CMDRead (); return (item); } item = CMDTerm (); return (item); }
/* *** Paint contents of screen. ********************************************** */ void Demo_7_Screen() { FT_ListStart(DLIST); // Clear screen. Clear Stencil buffer. Clear TAG buffer. DLClearColorRGB(0x00, 0x00, 0x00); DLClear(1, 1, 1); // Show top message. DLColorRGB(0xFF, 0x00, 0x00); CMDText( 10, 10, 30, 0, "PSoC Eve Library DEMO/TEST"); CMDText( 10, 50, 30, 0, "Screen: DEMO 7 ()"); // Gradient DLScissorXY(20, 100); DLScissorSize(LCDWIDTH - 40, 50); CMDGradient(20, 150, 0x00, 0x00, 0xFF, LCDWIDTH - 20, 150, 0xFF, 0x00, 0x00); DLScissorXY(0, 0); DLScissorSize(SCISSOR_RESTORE_SIZE, SCISSOR_RESTORE_SIZE); // Dial CMDFgcolor(0x00, 0x00, 0xFF); DLColorRGB(0xFF, 0xFF, 0xFF); CMDDial(70, 220, 40, 0, 0x8000); // Num. format for Vertex2F. DLVertexFormat(VERTEX_FORMAT_1); // 1/1 DLColorRGB(0x00, 0x00, 0xFF); DLBegin(PRIMITIVE_RECTANGLE); DLVertex2F(120, 170); DLVertex2F(LCDWIDTH - 20, 270); DLColorRGB(0xFF, 0xFF, 0xFF); // Color alpha CMDText(130, 170, 28, 0, "hackingchips"); // alpha default = 255; blend_func = default = transparent DLColorA(128); CMDText(130, 200, 28, 0, "hackingchips"); DLColorA(64); CMDText(130, 230, 28, 0, "hackingchips"); DLBlendFunc(BLEND_FUNC_SRC_ALPHA, BLEND_FUNC_ZERO); CMDText(270, 170, 28, 0, "hackingchips"); // alpha default = 255; blend_func = default = transparent DLColorA(128); CMDText(270, 200, 28, 0, "hackingchips"); DLColorA(64); CMDText(270, 230, 28, 0, "hackingchips"); // restore alpha, restore blend or it will affect button text. DLColorA(255); DLBlendFunc(BLEND_FUNC_SRC_ALPHA, BLEND_FUNC_ONE_MINUS_SRC_ALPHA); // testing button gradient. It will affect exit button. CMDFgcolor(0x10, 0x10, 0x10); CMDGradcolor(0xFF, 0x00, 0x00); // Exit button.. //CMDFgcolor(0x00, 0x00, 0xFF); // Button color = blue. DLColorRGB(0xFF, 0xFF, 0xFF); // Text color = white. DLTag(D7_BTN_EXIT); // For touch. Assign tag 1 to this button. CMDButton(LCDWIDTH - 120, LCDHEIGHT - 30, 100, 30, 28, OPT_3D, (char*)"Exit"); // Restore button gradient to default. CMDGradcolor(0xFF, 0xFF, 0xFF); FT_ListEnd(END_DL_SWAP); }