Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
emWin V6.34g
  • Loading branch information
SEGGER-Sven committed Nov 6, 2023
0 parents commit 9f4461c
Show file tree
Hide file tree
Showing 144 changed files with 50,021 additions and 0 deletions.
63 changes: 63 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
This license (License) is a legal agreement between YOU and, as licensor, SEGGER SOFTWARE GmbH, a company organized and existing under the laws of the Federal Republic of Germany (SEGGER). Upon downloading and using the SOFTWARE, YOU shall become a non-exclusive licensee of the SEGGER SOFTWARE and hereby agree to be bound by the terms of this License.

ß 1 Scope of License; Indemnification, Definitions
1. Solely with respect to electronic documents included with the SOFTWARE, YOU may make an unlimited number of copies (either in hardcopy or electronic form), provided that such copies shall be used only for Your internal purposes and not republished or distributed to any third party without the prior written consent of SEGGER.
2. The SOFTWARE is licensed, not sold, to YOU, and is for use only under the terms of this License. The SOFTWARE is not open source SOFTWARE. The SOFTWARE consists of proprietary, closed source SOFTWARE protected under applicable copyright and trade secret laws. All rights, title and interest in the SOFTWARE are and shall at all times remain with SEGGER.
3. YOU hereby agree to defend, indemnify and hold SEGGER harmless from and against any claim, suit, demand, or other costs arising from Your breach of the terms of this License and subsequent revisions of this License in accordance with its terms.
4. The following terms shall have the following meaning:
- COMPILER and IDE means the following tools provided by third parties for the TARGET MCU: ARM GNU toolchain (GNU Compiler Collection GCC)
- COMPANY or YOU means (either an individual or a single legal entity)
- SOFTWARE means the SEGGER emWin components
- EXECUTABLE CODE means the machine-executable (and non-linkable) version of the Licensed SOFTWARE;
- OBJECT CODE means the machine readable, linkable and compiled version of the SOFTWARE
- TARGET MCU means the STM32 Cortex-M based Microcontroller Units with LCD controller on chip designed and manufactured by STMicroelectronics International N.V.
- SOURCE CODE means the human-readable version of the SOFTWARE that can be compiled into OBJECT CODE
- CW-OCL means COMPANY Wide OBJECT CODE License
- CW-ECL means COMPANY Wide EXECUTABLE CODE License
- PRODUCT means the end result of a manufacturing process offered to the market under a certain name

ß 2a Grant of License for OBJECT CODE licensed under CW-OCL (COMPANY Wide OBJECT CODE License) limited to the TARGET MCU, COMPILER and IDE as specified in this agreement
1. YOU may download and use the OBJECT CODE for the COMPILER and IDEs as defined in this agreement to create one or more programs executable on your embedded TARGET MCU. The resulting SOFTWARE as EXECUTABLE CODE may be shipped with this equipment royalty free. Any distribution or shipment of SOURCE CODE or code in linkable form (e.g. OBJECT CODE) requires the prior written authorization from SEGGER.
2. This CW-OCL entitles an unlimited number of persons employed by YOU to use the OBJECT CODE only in connection with the development and creation of PRODUCTs based on the TARGET MCU as defined in this agreement. The SOFTWARE or parts thereof are in use on a personal computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g., hard disk, CD-ROM, or other storage device) of that personal computer. YOU may install and use the SOFTWARE in OBJECT CODE form on a server or make it available on a network or in any way provide the SOFTWARE or parts thereof to multiple users within your COMPANY.
3. YOU are entitled to make copies of the SOFTWARE for backup purposes.
4. Any other use of the SOFTWARE is prohibited without prior written authorization from SEGGER. Under this license, the package may not be used to create and distribute a relinkable or an equivalent. Under no circumstances may any of the SOURCE CODE be used for creating or developing a similar or competitive SOFTWARE.
5. YOU will take all commercially reasonable efforts to prevent and discourage piracy of the SOFTWARE code, including, without limitation, prohibiting Your employees and consultants from using or copying the SOFTWARE code for any purpose other than as permitted herein.

ß 2b Grant of License for EXECUTABLE CODE licensed under CW-ECL (COMPANY Wide EXECUTABLE CODE License) limited to the TARGET MCU, COMPILER and IDE as specified in this agreement
1. Some SOFTWARE components such as Bitmapconverter and AppWizard are provided in EXECUTABLE CODE form only.
2. This CW-ECL entitles an unlimited number of persons employed by YOU to use the EXECUTABLE CODE only in connection with the development and creation of PRODUCTs based on the TARGET MCU as defined in this agreement. The SOFTWARE or parts thereof are in use on a personal computer when it is loaded into temporary memory (i.e. RAM) or installed into permanent memory (e.g., hard disk, CD-ROM, or other storage device) of that personal computer. YOU may install and use the SOFTWARE in EXECUTABLE CODE form on a server or make it available on a network or in any way provide the SOFTWARE or parts thereof to multiple users within your COMPANY.
3. An SEL entitles one and only one person working on a project for your COMPANY to work with the SOFTWARE on one and only one personal computer at a time. YOU may download and use the SOFTWARE in EXECUTABLE CODE form code to create one or more programs executable for the TARGET MCU as defined in this agreement.

ß 3 Other Restrictions
1. The SOFTWARE is not transferable to any third party, and any use of the SOFTWARE by a third party requires the prior consent of SEGGER in each instance and YOU shall not sell, lease or otherwise transfer the SOFTWARE or any interest therein to any third party. The foregoing and anything else in this License to the contrary notwithstanding, the incorporation of the SOFTWARE into the PRODUCT to the extent permitted by this License shall not be deemed to be a prohibited transfer.
2. YOU shall not reverse engineer, decompile or disassemble the SOFTWARE shipped in OBJECT or EXECUTABLE CODE form.
3. YOU shall not use or port the SOFTWARE on another TARGET MCU, COMPILER or IDE.
4. The License is non-transferable and not assignable.
5. YOU agree during the time that YOU are actively using licensed SOFTWARE and for a period of twelve (12) months thereafter, YOU shall not to develop a software similar or competitive to the SOFTWARE, nor participate in the development of such software, either directly or indirectly, with any third party.
6. YOU shall not use nor permit the use of the SOFTWARE licensed hereunder in any Weapon or Weapon System. A Weapon or Weapon System is any tool, instrument or system designed with the priimary or substantial purpose of injuring, incapacitating or killing any person or adversary or destroying or damaging the property of such person or adversary or threatening such person or adversary, regardless of whether such Weapon or Weapon System may be used to attack, defend, threaten or protect.

ß 4 Termination
1. Without prejudice to any other rights, SEGGER may terminate Your rights under this License if YOU fail to comply with the terms and conditions of this License and any other agreement YOU may have with SEGGER related to this License. In such event, upon written notice from SEGGER, YOU shall, at the election of SEGGER, return or destroy all copies of the SOFTWARE and all of its component parts and shall provide written certification of such destruction or return to SEGGER.

ß 5 Limited Warranties
1. The SOFTWARE is generated by SEGGER and provided on "as is" basis, without support services or warranty of any kind from SEGGER, including without limitation the warranties that it is free of defects, merchantable, fit for a particular purpose or non-infringing.
2. Any support services or warranty from SEGGER is subject to a separate support and update agreement between SEGGER and YOU or part of an SOURCE CODE upgrade.
3. In developing the SOFTWARE SEGGER attempted to offer the most current, correct and clearly expressed information possible. Nonetheless, errors may occur and SEGGER does not warrant that the SOFTWARE is free from bugs, errors, or other program limitations.
4. SEGGER makes no representation and provides no warranty or guarantee that the SOFTWARE will be suited to Your particular needs or use.
5. Except to the extent prohibited by applicable law, in no event shall SEGGER nor any of its distributors or affiliates be liable to YOU for any direct, indirect, punitive, special, incidental or consequential damages, including lost profits, business interruption and like damages, even if advised of the possibility of such losses or damages. The total monetary liability of SEGGER shall be limited to the amount actually paid by YOU for the SOFTWARE License (if any).

ß 6 Miscellaneous
1. Applicable Law; Not For Resale or Export. YOU agree to comply with all applicable laws and regulations of the Federal Republic of Germany. YOU agree and represent that YOU are downloading the SOFTWARE for your own internal use only, and not for resale or export. This License shall be governed by the laws of the Federal Republic of Germany. Any action SEGGER brings against YOU for the enforcement of this License may be brought in Germany or any other jurisdiction in which the courts have jurisdiction over YOU. YOU hereby consent to the personal jurisdiction of the courts located within the Federal Republic of Germany and waive any right to assert that such courts are not a convenient forum.
2. YOU hereby acknowledge that SEGGER's damages at law would not be adequate in the case of a breach of this License by YOU. Therefore SEGGER shall have the right of specific performance, injunction or other equitable remedy in the event of such breach, without the necessity of posting any bond.
3. SEGGERíS rights and remedies hereunder shall be construed to be cumulative, and no one of them exclusive of any other or of any right or remedies allowed by law.
4. In addition to any other relief awarded, the prevailing party in any legal action shall be entitled to recover its reasonable legal fees and costs.
5. SEGGER has the right to have an independent third party review and inspect Your use of the SOFTWARE at any place at which such SOFTWARE is used, at reasonable times to ensure compliance with the terms of this License.
6. YOU agree to provide SEGGER with any and all additional documents as may be reasonably requested by SEGGER and/or necessary to effectuate the purposes and intent of this License.
7. No waiver by either party of any breach of any term or provisions of this License shall be construed as a waiver of any preceding or succeeding breach of the same or of any other term or provision.
8. No modifications or amendments of any terms hereof shall be effective unless in writing and signed by SEGGER and YOU.
9. If any provision or part of this License is determined to be invalid or illegal by any court or agency of competent jurisdiction, then that provision or part shall be limited or curtailed to the extent (but only to the extent) necessary to make such provision valid, and all other remaining terms and provisions of this License shall remain in full force and effect.
10. Any notices hereunder will be sent charges prepaid to the other party to its respective addresses set forth herein (or to such other address that may be designated by such party) a reputable delivery service, a part of whose services shall include obtaining a signature from the addressee. The foregoing notwithstanding, the parties may provide routine notices to each other designed solely to carry out their obligations to one another via email and/or other methods mutually agreed. This License may be executed in identical counterparts and such Licenses shall be deemed one and the same License.
11. YOU represent and warrant to SEGGER that (a) YOU have all requisite power and authority to execute and deliver this License, to perform Your obligations hereunder and to engage in the transactions contemplated hereby, (b )the execution, delivery and performance of this License has been duly authorized by all requisite action on Your part and this License constitutes the legal, valid and binding obligation of YOU, enforceable in accordance with its terms and (c) the execution, delivery and performance of this Agreement by YOU does not (i) violate any judgment, order, injunction, decree or award of any court or governmental body binding on YOU, (ii) violate any law or regulation that is applicable to YOU, or (iii) violate or conflict with, or constitute a default under, the terms of any agreement to which YOU are a party.
12. This License shall be binding upon and shall inure to the benefit of each party and to its respective successors, legal representatives and permitted assignees. This License represents the entire License of the parties with respect to the subject matter hereof and shall be enforceable in accordance with its terms.


114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# emWin-Arduino-Library
This package includes the embedded graphics library emWin.

This packages was set up for the Arduino GIGA R1 in combination with the Arduino GIGA Display Shield. Since the Arduino GIGA R1 is based on an STM32 chip the free of charge STemWin library is used.

The packages can also be used with emWins UI creation tool, the AppWizard.

For further information on emWin please visit www.segger.com/products/user-interface/emwin
For more information on other SEGGER products please visit www.segger.com

The emWin manual can be found here:
https://www.segger.com/doc/UM03001_emWin.html
https://www.segger.com/downloads/emwin/UM03001

The AppWizard and the AppWizard manual can be found under these links:
https://www.segger.com/downloads/emwin/
https://www.segger.com/doc/UM03003_AppWizard.html

Please make sure to use the correct AppWizard version. This package includes the emWin library V6.34e which matches AppWizard version 1.40e_6.34e.

# Getting started
To get started with emWin simply include "DIALOG.h" which makes any widget as well as the Window Manager and core functionality of emWin available.

After that call GUI_Init() in setup() and add GUI_Exec() to the loop() function.

This might look like below:

```
#include <DIALOG.h>
void setup() {
GUI_Init();
}
void loop() {
// put your main code here, to run repeatedly:
GUI_Exec(); // Keep emWin alive, handle touch and other stuff
}
```

Please note that it is mandatory to start and end multi buffering before the first and last drawing operation. This is only required if you are not using the Window Manager and/or Widgets. If you are using the Window manager a call of WM_MULTIBUF_Enable(1) is sufficient.

Here are two examples:

Without the Window Manager:

```
#include <DIALOG.h>
void setup() {
GUI_Init();
GUI_MULTIBUF_Begin();
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_DispString("Hello world");
GUI_MULTIBUF_End();
}
void loop() {
GUI_Exec();
}
```

And one example with the Window Manager:

```
#include "DIALOG.h"
static void _cbWin(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
break;
}
}
void setup() {
GUI_Init();
WM_MULTIBUF_Enable(1);
WM_CreateWindowAsChild(30, 30, 160, 60, WM_HBKWIN, WM_CF_SHOW, _cbWin, 0);
}
void loop() {
GUI_Exec();
}
```

You might also refer to the examples which come along with this library package.

# Running emWin examples

It is possible to port most emWin examples from our website to your Arduino GIGA R1 project. Please note, that some examples are simply not made for the screen dimensions of the Arduino GIGA Display Shield and it might not work as expected.

To get hands on emWin examples you might either refer to our examples website:
https://www.segger.com/products/user-interface/emwin/technology/samples/

Or our Wiki:
https://wiki.segger.com/emWin_Examples

Most emWin examples are independent of the display dimensions and can be ported into your Arduino project.

emWin examples typically start in a function named MainTask(). In most cases emWin and the application will be initialized in MainTask() and will end in an endless loop which keeps emWin "alive".

To port the example simply copy the content of MainTask() into the setup() function (except the while(1)-loop) and copy the content of the while(1)-loop into the loop() function. You might want to replace GUI_Delay() by GUI_Exec() which is basically the same but without performing a delay.

Of course you have to copy the rest of the example content into your .ino file, too.

To get an idea on how this can be done, you can compare the "CreateWindow" example from this package with the WM_CreateWindows example from our Wiki:
https://wiki.segger.com/WM_create_windows_(Sample)

72 changes: 72 additions & 0 deletions examples/CreateWindows/CreateWindows.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "DIALOG.h"

/*********************************************************************
*
* Static code
*
**********************************************************************
*/

/*********************************************************************
*
* _cbWin
*
* Function description
* Callback routine for the window created in MainTask. All messages
* sent to the sample window are handled in this routine.
*
* Parameters
* pMsg : Pointer to a message structure sent to the window.
*/
static void _cbWin(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_CREATE:
//
// We land here right after the window has been created.
//
break;
case WM_PAINT:
//
// This case is called everytime the window has to be redrawn
//
GUI_SetBkColor(GUI_WHITE);
GUI_Clear();
GUI_SetColor(GUI_BLACK);
GUI_DispStringAt("Sample window", 10, 10);
break;
default:
WM_DefaultProc(pMsg);
break;
}
}

/*********************************************************************
*
* _cbBk
*/
static void _cbBk(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
break;
default:
WM_DefaultProc(pMsg);
break;
}
}

void setup() {
GUI_Init();
WM_MULTIBUF_Enable(1);
WM_SetCallback(WM_HBKWIN, _cbBk);
//
// Create a window as a child of the background window
//
WM_CreateWindowAsChild(30, 30, 160, 60, WM_HBKWIN, WM_CF_SHOW, _cbWin, 0);
}

void loop() {
// put your main code here, to run repeatedly:
GUI_Exec(); // Keep emWin alive, handle touch and other stuff
}
15 changes: 15 additions & 0 deletions examples/HelloWorld/HelloWorld.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <DIALOG.h> // This header allows to use any emWin feature (including GUI.h would be sufficient for a simple hello world)

void setup() {
GUI_Init(); // Init emWin
GUI_MULTIBUF_Begin();
GUI_SetBkColor(GUI_BLACK); // Set background color
GUI_Clear(); // Clear entire screen with previously set BK color
GUI_DispString("Hello world"); // Show something
GUI_MULTIBUF_End();
}

void loop() {
// put your main code here, to run repeatedly:
GUI_Exec(); // Keep emWin alive, handle touch and other stuff
}
Loading

0 comments on commit 9f4461c

Please sign in to comment.