achimdoebler / ugui Goto Github PK
View Code? Open in Web Editor NEWµGUI - Open Source GUI module for embedded systems
License: Other
µGUI - Open Source GUI module for embedded systems
License: Other
ugui works well right now ,but i can not rotate display .sometimes i need this feature, is there any way to achieve that goal?
Hello guys!
First of all many tanks to @achimdoebler , this is a very time saver library!
The only big problem (in my case) is that i'm trying to use it together with Arduino Adafruit_GFX and a modified version of Adafruit_ILI9341 libraries but, after compiling and uploading on my Arduino Uno with 2.4 tft lcd shield (8bit bus and 18bit colors) , what appears is a randomly colored pixels on the screen.
All examples on the Adafruit libraries work well so, i think i'm doing something wrong with the implementation of the uGUI lib.
My code is as following:
In my EXAMPLE i modified the ugui_config.h
and i've included all relevant code in guitest.ino
.
Then, in the UGUI.h
file i replaced #include <system.h>
with #include <Arduino.h>
.
Someone has already tried to run the library with Arduino?
In that case you could post your implementation code?
Many thanks.
Does anyone recommend what could be used to create UG_BMP ?
Hello,
Could you please provide the guide in a text format such as markdown, plain text, or on the github wiki?
When using the PDF it's not possible (at least on OS X) to copy any of the code examples since some character such as underlines appear to be missed for some reason... I've tried both the Chrome and Preview viewers but neither of them really works.
Thanks :)
So I offer a reformatted version
of it at my second, messy, what-ever-goes-style of GitHub account.
Currently uGUI only has support for a single touch point, however certain dev boards with capacitive touch sensors (the STM32F7-Discovery, for example) have up to 5 or more points that may be activated simultaneously. While the simple solution is to just pass all 5 (or more/less) in one at a time, I think there is room for growth of uGUI in such a way that these multi-touch events could be used to add additional functionality. One such example is rotating a window, where two touch points could be used to adjust the rendering of the window to make it appear rotated, leading to a potentially improved experience and greater usefulness. Not strictly necessary, but something to consider I think.
hi all ,
how to create font for monochrome ?
UGUI default for the RGB888/565 lcd.
so how to add font for the monochrome lcd(like ssd1306)
void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const UG_FONT* font)
HW:
SSD1306 monochrome
ugui_config.h
#ifndef __UGUI_CONFIG_H
#define __UGUI_CONFIG_H
/* -------------------------------------------------------------------------------- /
/ -- CONFIG SECTION -- /
/ -------------------------------------------------------------------------------- */
//#define USE_MULTITASKING
/* Enable color mode /
//#define USE_COLOR_RGB888 // RGB = 0xFF,0xFF,0xFF
//#define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB
#define USE_COLOR_NONE //monochrome
/ Enable needed fonts here */
#define USE_FONT_4X6
//#define USE_FONT_5X8
//#define USE_FONT_5X12
//#define USE_FONT_6X8
//#define USE_FONT_6X10
//#define USE_FONT_7X12
//#define USE_FONT_8X8
//#define USE_FONT_8X12_CYRILLIC
//#define USE_FONT_8X12
//#define USE_FONT_8X12
//#define USE_FONT_8X14
//#define USE_FONT_10X16
//#define USE_FONT_12X16
//#define USE_FONT_12X20
//#define USE_FONT_16X26
//#define USE_FONT_22X36
//#define USE_FONT_24X40
//#define USE_FONT_32X53
/* Specify platform-dependent integer types here */
#define __UG_FONT_DATA const
typedef uint8_t UG_U8;
typedef int8_t UG_S8;
typedef uint16_t UG_U16;
typedef int16_t UG_S16;
typedef uint32_t UG_U32;
typedef int32_t UG_S32;
/* Example for dsPIC33
typedef unsigned char UG_U8;
typedef signed char UG_S8;
typedef unsigned int UG_U16;
typedef signed int UG_S16;
typedef unsigned long int UG_U32;
typedef signed long int UG_S32;
*/
/* -------------------------------------------------------------------------------- /
/ -------------------------------------------------------------------------------- */
/* Feature enablers */
#define USE_PRERENDER_EVENT
#define USE_POSTRENDER_EVENT
#define LCD_WIDTH_PIXELS 128
#define LCD_HEIGHT_PIXELS 64
#endif
Hi,
Following is my code on Arduino IDE using ATMEGA2560 Board.
`#include <SPI.h>
#include "ugui.h"
#include "ugui_config.h"
#define DISPLAY_WIDTH 160
#define DISPLAY_HEIGHT 128
#define MAX_OBJECTS 10
#define BuffOUT 40
char bufferOut[BuffOUT];
void window_1_callback(UG_MESSAGE *msg);
UG_GUI gui1963;
UG_COLOR color[3];
void my_int_func(UG_S16 x,UG_S16 y,UG_COLOR z)
{
unsigned int sum=0;
sum=x+y+z;
}
void setup()
{
void (*foo)(UG_S16,UG_S16,UG_COLOR);
foo = &my_int_func;
UG_Init(&gui1963, foo(2,2,3), 160, 128);
UG_COLOR color[3];
UG_WINDOW window_1;
UG_BUTTON button_1;
UG_BUTTON button_2;
UG_BUTTON button_3;
UG_TEXTBOX textbox_1;
UG_OBJECT obj_buff_wnd_1[MAX_OBJECTS];
UG_Init(&gui1963, foo(2,2,3), 160, 128);
}
void loop()
{
// put your main code here, to run repeatedly:
}`
I encounter following error when compiling. Kindly provide an insight of whats going wrong?
testugui:27:43: error: invalid use of void expression
UG_Init(&gui1963, foo(2,2,3), 160, 128);
^
testugui:37:43: error: invalid use of void expression
UG_Init(&gui1963, foo(2,2,3), 160, 128);
Regards,
Hi guys,
I am working with ssd1963 display, with arm cortex m4. I have ported ugui for my display and test all the basics functions. They are working fine for me but when I am trying to create a window as per written in reference guide, it is no showing anything. Any help in this regards 'll be highly appreciable.
Thanks.
Hi
Am I right that UG does not support font kerning? The thing where an I
is smaller then an O
. Does every letter uses the same width?
Is there some pre-work since I'm very likely going to implement that.
Given this project seems no longer alive, I'm providing the fork for anyone who might be searching new enhancements...
https://github.com/deividAlfa/UGUI
What does it take to make to make uGUI work with ILI9341 + ESP32 ESP-IDF ?
Any pointers highly appreciated.
Dear my friends:
In the code , there are the define of DRIVER_FILL_AREA, but there are no samples , how to write the porting code .
I tried some ,but faild
The uGUI has too many forks and too many changes.
Can anyone helps?
THANKS.
sorry for my pool english, hope you can get my point and Thanks for you time reading this. :)
in my project, PRESS and RELEASE are working well, but CLICK is never normally working
Seems that the UG_Init isn't documented. Given that nothing works without it, this seems like a critical oversight. Not hard to figure out from the source, but it 's still sort of a pain.
Comment would help if you're supposed to adapt this.
hi all,
how can set Font Direction (rotate 45 degrees)
in my design , it is Diamond . so all component need align direction.
LCM ST7571,128x128
Hello
I am desperate about follow errors:
I try to setup and compile ugui.c on the raspberry pi 3.
when I compile I always get errors like this:
//////compiling /////////////
gcc -Wall -pthread -o ugui ugui.c -lpigpio -lrt
//////ERROR //////////////
ugui.c: In function ‘_UG_PutChar’:
ugui.c:5343:65: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
color = (((fc & 0xFF) * b + (bc & 0xFF) * (256 – b)) >> 8) & 0xFF |//Blue component
^
ugui.c:5345:73: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
(((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 – b)) >> 8) & 0xFF0000; //Red component
^
ugui.c:5392:75: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
color = (((fc & 0xFF) * b + (bc & 0xFF) * (256 – b)) >> 8) & 0xFF |//Blue component
^
ugui.c:5394:83: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses]
(((fc & 0xFF0000) * b + (bc & 0xFF0000) * (256 – b)) >> 8) & 0xFF0000; //Red component
^
ugui.c: At top level:
ugui.c:8483:10: error: conflicting types for ‘gui’
UG_GUI gui;
^
ugui.c:79:16: note: previous declaration of ‘gui’ was here
static UG_GUI* gui;
//////////////////////////////////////////////////////////////
//programm-code
/////////////////////////////////////////////////////////////
My main and pset function in the ugui.c file (at the end):
void ST7775R_pset(UG_S16 x ,UG_S16 y,UG_COLOR c)
{
.....
....
}
UG_GUI gui;
int main(void)
{
.....
.....
initST7775R();
UG_Init(&gui, ST7775R_pset, 176, 220);
//UG_SelectGUI(&gui);
UG_Update();
while(1)
{
color(248,0); //red
sleep(1);
color(7,224); //green
sleep(1);
color(0,31); //blue
sleep(1);
color(248,31); //violet
sleep(1);
color(121,239); //grau
sleep(1);
UG_FontSelect(&FONT_24X40);
UG_SetBackcolor(C_BLACK);
UG_SetForecolor(C_CYAN);
UG_PutString(0,0,"Hello World!");
UG_Update();
sleep(3);
color(251,43); //rosa
sleep(1);
}
spiClose(h);
gpioTerminate();
return 0;
}
whats wrong???
I'm doing calls to UG_FillRoundFrame and UG_DrawRoundFrame with the same params, but radius of the corners seems to be different. Making call with radius 3 is handled right by UG_FillRoundFrame but UG_DrawRoundFrame seems to draw frame with radius 1.
Not Every device has touch screen.
I can not find any info of checkbox. I look through wed, guild book and source commit. I just donot know what is the main point of checkbox ,and what is the function it will show to us?
Hello, I try to implemente ugui with arduino/teensy 3.2, but unfortunately if I implement in the sketch #include "ugui.c" I get follow error:
invalid conversion from 'void*' to 'void ()(UG_COLOR) {aka void ()(long unsigned int)}' [-fpermissive]
?? whats wrong?
In UG_DrawBMP(),
invalid color conversion done when BMP format is 565.
just before this line the color is set to 888 format, but that causes wrong colors to be displayed on a 565 format screen
https://github.com/achimdoebler/UGUI/blob/master/ugui.c#L5840
a possible fix:
tmp = *p++;
#ifdef USE_COLOR_RGB565
UG_DrawPixel( xp++ , yp , tmp );
#else
/* Convert RGB565 to RGB888 */
r = (tmp>>11)&0x1F;
r<<=3;
g = (tmp>>5)&0x3F;
g<<=2;
b = (tmp)&0x1F;
b<<=3;
c = ((UG_COLOR)r<<16) | ((UG_COLOR)g<<8) | (UG_COLOR)b;
UG_DrawPixel( xp++ , yp , c );
#endif
For example correct buttons, need correct code from this place:
7120: txt.h_space = 2;
7121: txt.v_space = 2;
to
7120: txt.h_space = btn->h_space;
7121: txt.v_space = btn->v_space;
e.g. for CheckBoxes
v0.31 beta commit contains changes from forked repositories. The proper way to include those changes would have been a merge/pull request. The corresponding changes need to be merged in for visibility in Git.
A newbie who familer to android always think that callback function will be called when the button pressed ranthre than changed. So i suggest add a new conditional sentence in the callback function (in your demo).
ex: if ( msg->id == OBJ_TYPE_BUTTON && msg->event == OBJ_EVENT_PRESSED )
i spent whole two days to figure this future out. ~( ̄▽ ̄~)
Without
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
at the beginning and later proper closing the library will not compile in C++ project.
In line 5650
:
msg.src = &obj;
Instance where a stack address is assigned to a non-local variable. Storing the address of a local variable in non-local memory can cause a dangling pointer bug if the address is used after the function returns.
Lines 898 to 899 in ce0bccb
UG_PutString, as with most other functions, has the location first, then the object, and also use the previously set colors.
UG_PutChar, on the other hand, has the object first, then the location, and then color information.
This makes for an inconsistent UI.
good job, thanks for yours ugui!
Hi,
I am plagued by that I have to flash the code into the MCU to check the result of GUI everytime.
So is there anyway or will there be a way like simulation on linux to solve this problem?
Thanks a lot!
Lines 898 to 899 in ce0bccb
UG_PutString, as with most other functions, has the location first, then the object.
UG_PutChar, on the other hand, has the object first, then the location.
Additionally UG_PutChar sets the foreground&background colors, but UG_PutString does not have any color information. Other graphics primitives have only the foreground color.
This makes for an inconsistent UI.
I suggest we extend UG_FONT definition with two constants: offset and length. The reason is that if i needed an incomplete character set, for example just numbers, i wouldn't spend ROM space for keeping the rest of the characters. Offset and length means the font defines characters starting from ascii code "offset" and ending by "offset + length"
Dear:
The uGUi is really great project! it is powerful~!
When I use this I can't find the place to set it into grayscale or mono mode?
I think maybe there are missing ?
Thanks for your time and Thanks for your reply if there are.
:)
hi i am planning on using the uGUI for the ST7529 driver using MSP430.
Can you please share the example for how to define the pset function ?
I have gone through the Manual PDF and also the ST7529 datasheet.
I am unable to understand how to define the PSET function.
If someone could help me on this, please.
Any demand / existing implementations / caveats adding UTF-8 support for uGUI (like in https://github.com/olikraus/u8g2)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.