离线
Introduction
What is µGUI?
µGUI is a free and open source graphic library for embedded systems. It is platform-independent and can be easily ported to almost any microcontroller system. As long as the display is capable of showing graphics, µGUI is not restricted to a certain display technology. Therefore, display technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module consists of three files: ugui.c, ugui.h and ugui_config.h.
µGUI Features
µGUI supports any color, grayscale or monochrome display
µGUI supports any display resolution
µGUI supports multiple different displays
µGUI supports any touch screen technology (e.g. AR, PCAP)
µGUI supports windows and objects (e.g. button, textbox)
µGUI supports platform-specific hardware acceleration
16 different fonts available
cyrillic fonts supported
TrueType font converter available (https://github.com/AriZuu)
integrated and free scalable system console
basic geometric functions (e.g. line, circle, frame etc.)
can be easily ported to almost any microcontroller system
no risky dynamic memory allocation required
µGUI Requirements
µGUI is platform-independent, so there is no need to use a certain embedded system. In order to use µGUI, only two requirements are necessary:
a C-function which is able to control pixels of the target display.
integer types for the target platform have to be adjusted in ugui_config.h.
离线
那么小的µGUI, 居然还支持 TrueType Font (ttf字体)
离线
厉害了,感谢作者的无私奉献,正在移植中
离线
厉害了,感谢作者的无私奉献,正在移植中
移植好了没有?
最近编辑记录 xinxiaoci (2018-04-18 08:20:23)
离线
移植好了没有?
离线
移植好了没有?
只需要把画点函数提供给uGUI调用就可以,然后使用内部的API进行使用,
/* uGUI */
void pset(UG_U16 x, UG_U16 y, UG_COLOR c)
{
LCD_WriteBuffer(x,y,c);
}
/* GUI structure */
UG_GUI gui;
函数中直接调用下面:
UG_Init(&gui,(void(*)(UG_S16,UG_S16,UG_COLOR))pset,128,128);
最近编辑记录 qwert1213131 (2018-04-18 10:31:14)
离线
kgp0213 说:移植好了没有?
只需要把画点函数提供给uGUI调用就可以,然后使用内部的API进行使用,
/* uGUI */
void pset(UG_U16 x, UG_U16 y, UG_COLOR c)
{
LCD_WriteBuffer(x,y,c);}
/* GUI structure */
UG_GUI gui;函数中直接调用下面:
UG_Init(&gui,(void(*)(UG_S16,UG_S16,UG_COLOR))pset,128,128);
厉害了老铁,学习!
离线
qwert1213131 说:kgp0213 说:移植好了没有?
只需要把画点函数提供给uGUI调用就可以,然后使用内部的API进行使用,
/* uGUI */
void pset(UG_U16 x, UG_U16 y, UG_COLOR c)
{
LCD_WriteBuffer(x,y,c);}
/* GUI structure */
UG_GUI gui;函数中直接调用下面:
UG_Init(&gui,(void(*)(UG_S16,UG_S16,UG_COLOR))pset,128,128);厉害了老铁,学习!
有硬件加速的选项,但是这ui的控件太少了,我还是去玩LittleVGL了
离线
这个挺不错的,有没有移植运行的效果图看看
离线
这个挺不错的,有没有移植运行的效果图看看
去油管可以看到很多的,
建议试试这个https://littlevgl.com/
离线
nuklear不知道能不能用到普通的单片机里去
离线
交作业,移植不难
离线
可以移植到ESP32里面不
离线
当然可以, ESP32 RAM那么多.
离线
有例程可以提供下不
离线
我来检查作业,不错!100分!
离线
http://embeddedlightning.com/wp-content/uploads/2015/12/ssd1325.c
#include "system.h"
#include "ugui.h"
/* -------------------------------------------------- */
/* SOFTWARE SPI */
/* -------------------------------------------------- */
#define OLED_PORT GPIOB
#define OLED_SCK GPIO_Pin_0
#define OLED_SDA GPIO_Pin_1
#define OLED_DC GPIO_Pin_2
#define OLED_RES GPIO_Pin_3
#define OLED_CS GPIO_Pin_4
void write_cmd(unsigned char b)
{
unsigned char i;
GPIO_WriteBit(OLED_PORT, OLED_CS, Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_DC, Bit_RESET);
for (i=0x80; i; i>>=1)
{
GPIO_WriteBit(OLED_PORT, OLED_SCK, Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_SDA, (b&i)?Bit_SET:Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_SCK, Bit_SET);
}
GPIO_WriteBit(OLED_PORT, OLED_DC, Bit_SET);
GPIO_WriteBit(OLED_PORT, OLED_CS, Bit_SET);
}
void write_data(unsigned char b)
{
unsigned char i;
GPIO_WriteBit(OLED_PORT, OLED_CS, Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_DC, Bit_SET);
for (i=0x80; i; i>>=1)
{
GPIO_WriteBit(OLED_PORT, OLED_SCK, Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_SDA, (b&i)?Bit_SET:Bit_RESET);
GPIO_WriteBit(OLED_PORT, OLED_SCK, Bit_SET);
}
GPIO_WriteBit(OLED_PORT, OLED_DC, Bit_SET);
GPIO_WriteBit(OLED_PORT, OLED_CS, Bit_SET);
}
/* -------------------------------------------------- */
/* FRAMEBUFFER */
/* -------------------------------------------------- */
unsigned char buff[128*32]; // 128x64 4BPP OLED
/* -------------------------------------------------- */
/* SSD1325 PSET-FUNCTION */
/* -------------------------------------------------- */
void ssd1325_pset ( UG_S16 x , UG_S16 y , UG_COLOR c )
{
unsigned int n;
unsigned char b;
unsigned char col;
col = c & 0x0F;
n = (x >> 1) + 64 * y;
b = buff[n];
switch ( x%2 )
{
case 0: b &= 0xF0; b |= col; break;
case 1: b &= 0x0F; b |= col<<4; break;
}
buff[n] = b;
}
/* -------------------------------------------------- */
/* SSD1325 INIT-FUNCTION */
/* -------------------------------------------------- */
void ssd1325_init( void )
{
GPIO_WriteBit(OLED_PORT, OLED_RES, Bit_RESET);
delay_ms(100);
GPIO_WriteBit(OLED_PORT, OLED_RES, Bit_SET);
delay_ms(100);
write_cmd(0xAE|0x00);
delay_ms(10);
write_cmd(0xB3); // Display Clock Divider/Osciallator Frequency
write_cmd(0x91); // Default => 0x41
delay_ms(10);
write_cmd(0xA8); // Set Multiplex Ratio
write_cmd(0x3F); // Default => 0x5F
delay_ms(10);
write_cmd(0xA2); // Set Display Offset
write_cmd(0x4C); // Default => 0x00
delay_ms(10);
write_cmd(0xA1); // Set Display Start Line
write_cmd(0x00); // Default => 0x00
delay_ms(10);
write_cmd(0xAD); // Set Master Configuration
write_cmd(0x02|0x00); // Default => 0x03
delay_ms(10);
write_cmd(0xA0); // Set Re-Map & Data Format
write_cmd(0x50); // Default => 0x00
delay_ms(10);
write_cmd(0x84|0x02); // Set Current Range
delay_ms(10);
write_cmd(0xB8); // Set Gray Scale Table
write_cmd(0x01); // Gray Scale Level 1
write_cmd(0x11); // Gray Scale Level 3 & 2
write_cmd(0x22); // Gray Scale Level 5 & 4
write_cmd(0x32); // Gray Scale Level 7 & 6
write_cmd(0x43); // Gray Scale Level 9 & 8
write_cmd(0x54); // Gray Scale Level 11 & 10
write_cmd(0x65); // Gray Scale Level 13 & 12
write_cmd(0x76); // Gray Scale Level 15 & 14
delay_ms(10);
write_cmd(0x81); // Set Contrast Value
write_cmd(0x7F); // Default => 0x40
delay_ms(10);
write_cmd(0xB2); // Set Frame Frequency (Row Period)
write_cmd(0x46); // Default => 0x25 (37 Display Clocks)
delay_ms(10);
write_cmd(0xB1); // Phase 1 & 2 Period Adjustment
write_cmd(0x22); // Default => 0x53 (5 Display Clocks [Phase 2] / 3 Display Clocks [Phase 1])
delay_ms(10);
write_cmd(0xBC); // Set Pre-Charge Voltage Level
write_cmd(0x10); // Default => 0x10 (Connect to VCOMH)
delay_ms(10);
write_cmd(0xB4); // Set Pre-Charge Compensation Level
write_cmd(0x07); // Default => 0x00 (No Compensation)
write_cmd(0xB0); // Set Pre-Charge Compensation Enable
write_cmd(0x08|0x20); // Default => 0x08
delay_ms(10);
write_cmd(0xBE); // Set Output Level High Voltage for COM Signal
write_cmd(0x02); // Default => 0x1D (0.81*VREF)
delay_ms(10);
write_cmd(0xBF); // Set Segment Low Voltage Level
write_cmd(0x02|0x0C); // Default => 0x0E
delay_ms(10);
write_cmd(0xA4|0x00); // Set Display Mode
delay_ms(10);
write_cmd(0xAE|0x01); // Set Display On/Off
delay_ms(10);
}
/* -------------------------------------------------- */
/* SSD1325 UPDATE-FUNCTION */
/* -------------------------------------------------- */
void ssd1325_update( void )
{
unsigned int i;
unsigned char* p;
p = &buff[0];
write_cmd(0x15); // Set Column Address
write_cmd(0); // Default => 0x00
write_cmd(0x3F); // Default => 0x3F (Total Columns Devided by 2)
write_cmd(0x75); // Set Row Address
write_cmd(0); // Default => 0x00
write_cmd(0x3F); // Default => 0x4F
for(i=0;i<128*32;i++)
{
write_data(*p++);
}
}
UG_GUI gui;
int main(void)
{
//...
//...
/* OLED init */
ssd1325_init();
/* 碌GUI init */
UG_Init(&gui,ssd1325_pset,128,64);
UG_FillScreen( C_BLACK );
UG_DrawFrame( 0, 0, 127, 63, C_WHITE );
ssd1325_update();
while(1)
{
}
}
这里有一个移植demo, poring 到esp32 问题不大。
http://embeddedlightning.com/forums/topic/pset-function-examples/
离线
谢谢分享
离线
看起来还不错啊
离线
一个开源小型GUI移植到STM32F103上: http://bbs.21ic.com/blog-1849938-170836.html
默认支持3种 2D 硬件加速:
/* Supported drivers */
#define NUMBER_OF_DRIVERS 3
#define DRIVER_DRAW_LINE 0
#define DRIVER_FILL_FRAME 1
#define DRIVER_FILL_AREA 2
离线
https://github.com/AndresNavas/PSoC5_uGUI_Sample
https://github.com/AndresNavas/PSoC5_uGUI_Sample/blob/master/TFT_SSD1963/TFT_test.cydsn/main.c
Sample and Test project of uGUI library v.0.31 for a PSoC5-LP Kit using a SSD1963 Solomon LCD controller and XPT2046 Touch Controller.
Developed for CY8CKIT-050 PSoC5-LP Kit with a CY8C5868AXI-LP035 device using PSoC Creator 4.2
Folder with LCD Datasheets.
Folder with Picture and Video sample.
Folder with PSoC Creator Project (Inside Folder with Drivers and uGUI Library)
离线
离线
ugui 这个好, 看了一下代码确实简洁,资源占用少, 用在单片机不错。
离线
挺好用的,呈现的效果也不错
离线
离线
学习了,顶!
离线
控件很少!
离线
适合资源不太充裕的单片机
离线
作者真是劳模,呵呵,谢谢分享。。
离线
奇怪,我这里GIT上不去。。
离线
用了,资源消耗少,功能也少。如果不做复杂的UI还是不错的
离线
这个GUI果然够简,对于不复杂的系统值得一试。
离线
好帖好帖, mark学习
离线
有没有好用的字模提取工具
离线
能不能在OS下跑?
离线
好用吗
离线
这个东西不错,值得仔细研究一下.
另外支持汉字的话全字库肯定不可取,太大了,字模提取软件用起来也不太方便,是否有什么程序可以直接将操作系统中的对应字库信息提取出来的?
离线
超小资源消耗 不错 mark下
离线
这个会不会有版权问题
离线
速度比较慢
离线
nuklear不知道能不能用到普通的单片机里去
我觉得不能。
离线
qwert1213131 说:nuklear不知道能不能用到普通的单片机里去
我觉得不能。
看了代码感觉应该是能的,问题貌似在内存管理上。具体没有深入。
言归正传,这个ugui有个0x333的 fork加强,增强了很多。
废话不多说,5,4,3,2,1,上链接! https://github.com/0x3333/UGUI
https://github.com/0x3333/UGUI/raw/master/.github/simulator-rgb888-x2.jpg?raw=true
离线
这个GUI编译,运行对MCU的要求是什么?
离线
移植成功了吗
离线
最近也在搞类似的,速度快吗?
离线
现在比较牛的是scgui和ldgui
离线
离线
与LVGL轻量级 GUI对比,哪个好一些?
离线
lvgl所需资源更多吧。
离线
离线
这个gui只适合玩玩,组件太少,还不如uGFX
离线