#include <stdio.h>
#include <inttypes.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_timer.h"
#include "oled.h"
#include "ugui.h"
void OLED_SetPFun(UG_S16 x,UG_S16 y,UG_COLOR t)
{
OLED_DrawPoint((u8)x,(u8)y,(u8)t);
}
void uGUI_mytest(void)
{
UG_GUI my_ugui1;
//初始化函数
UG_Init(&my_ugui1,OLED_SetPFun,128,64);
//选择GUI
UG_SelectGUI(&my_ugui1);
//选择字体
UG_FontSelect(&FONT_8X8);
//字符显示
UG_PutChar('B',20,20,C_WHITE,C_BLACK);
OLED_Refresh();
delay_ms(500);
OLED_Clear();
//全屏填充函数
UG_FillScreen(C_WHITE);
OLED_Refresh();
delay_ms(1000);
OLED_Clear();
//矩形填充
UG_FillFrame(0,0,50,50,C_WHITE);
OLED_Refresh();
delay_ms(1000);
OLED_Clear();
//圆角矩形填充
UG_FillRoundFrame(0,0,50,50,10,C_WHITE);
OLED_Refresh();
delay_ms(1000);
OLED_Clear();
//字符串测试
UG_FontSelect(&FONT_16X26);
UG_SetBackcolor(C_BLACK);
UG_SetForecolor(C_WHITE);
UG_PutString(0,0,"Hello Wlord!");
OLED_Refresh();
delay_ms(1000);
OLED_Clear();
}
void app_main(void)
{
OLED_Init(); //初始化OLED
OLED_Clear();
while(1)
{
uGUI_mytest();
// OLED_ShowString(0,0,(unsigned char*)"ABC",8,1);//6*8 “ABC”
// OLED_ShowString(0,8,(unsigned char *)"ABC",12,1);//6*12 “ABC”
// OLED_ShowString(0,20,(unsigned char *)"ABC",16,1);//8*16 “ABC”
// OLED_ShowString(0,36,(unsigned char *)"ABC",24,1);//12*24 “ABC”
// OLED_ShowChinese(54,0,3,16,1);//电
// OLED_ShowChinese(72,0,4,16,1);//子
// OLED_ShowChinese(90,0,5,16,1);//技
// OLED_ShowChinese(108,0,6,16,1);//术
// OLED_Refresh();
// delay_ms(500);
}
}