项目是Kevincoooool参加某个大赛开源的项目,原理图和代码开源。希望大家遵守开源协议,勿做商用或者售卖。
#include "lvgl.h"
#include "stdio.h"
#include
#include
#include "esp_system.h"
#include "esp_vfs.h"
#include "esp_spiffs.h"
typedef struct
{
uint16_t min;
uint16_t max;
uint8_t bpp;
uint8_t reserved[3];
} x_header_t;
typedef struct
{
uint32_t pos;
} x_table_t;
typedef struct
{
uint8_t adv_w;
uint8_t box_w;
uint8_t box_h;
int8_t ofs_x;
int8_t ofs_y;
uint8_t r;
} glyph_dsc_t;
static x_header_t __g_xbf_hd = {
.min = 0x0020,
.max = 0xff1a,
.bpp = 4,
};
char *Font_buff = NULL;
// static uint8_t __g_font_buf[240]; //如bin文件存在SPI FLASH可使用此buff
static void init_font(void)
{
FILE *ff = fopen("/spiffs/myFont.bin", "r");
if (ff == NULL)
{
printf("Failed to open file for reading");
return;
}
fseek(ff, 0, SEEK_END);
long lSize = ftell(ff);
rewind(ff);
printf("Lsize %ld", lSize);
static uint8_t first_in = 1;
if (first_in == 1)
{
first_in = 0;
Font_buff = (char *)malloc(sizeof(char) * lSize);
}
int br = fread(Font_buff, 1, lSize, ff);
printf("Bytes read %d", br);
fclose(ff);
}
static uint8_t *__user_font_getdata(int offset, int size)
{
//如字模保存在SPI FLASH, SPIFLASH_Read(__g_font_buf,offset,size);
//如字模已加载到SDRAM,直接返回偏移地址即可如:return (uint8_t*)(sdram_fontddr+offset);
static uint8_t first_in = 1;
if (first_in == 1)//第一次进入的时候初始化外部字体
{
first_in = 0;
init_font();
}
return (uint8_t*)(Font_buff+offset);
// return __g_font_buf;
}
static const uint8_t *__user_font_get_bitmap(const lv_font_t *font, uint32_t unicode_letter)
{
if (unicode_letter > __g_xbf_hd.max || unicode_letter < __g_xbf_hd.min)
{
return NULL;
}
uint32_t unicode_offset = sizeof(x_header_t) + (unicode_letter - __g_xbf_hd.min) * 4;
uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
if (p_pos[0] != 0)
{
uint32_t pos = p_pos[0];
glyph_dsc_t *gdsc = (glyph_dsc_t *)__user_font_getdata(pos, sizeof(glyph_dsc_t));
return __user_font_getdata(pos + sizeof(glyph_dsc_t), gdsc->box_w * gdsc->box_h * __g_xbf_hd.bpp / 8);
}
return NULL;
}
static bool __user_font_get_glyph_dsc(const lv_font_t *font, lv_font_glyph_dsc_t *dsc_out, uint32_t unicode_letter, uint32_t unicode_letter_next)
{
if (unicode_letter > __g_xbf_hd.max || unicode_letter < __g_xbf_hd.min)
{
return NULL;
}
uint32_t unicode_offset = sizeof(x_header_t) + (unicode_letter - __g_xbf_hd.min) * 4;
uint32_t *p_pos = (uint32_t *)__user_font_getdata(unicode_offset, 4);
if (p_pos[0] != 0)
{
glyph_dsc_t *gdsc = (glyph_dsc_t *)__user_font_getdata(p_pos[0], sizeof(glyph_dsc_t));
dsc_out->adv_w = gdsc->adv_w;
dsc_out->box_h = gdsc->box_h;
dsc_out->box_w = gdsc->box_w;
dsc_out->ofs_x = gdsc->ofs_x;
dsc_out->ofs_y = gdsc->ofs_y;
dsc_out->bpp = __g_xbf_hd.bpp;
return true;
}
return false;
}
//AliHYAiHei-Beta,,-1
//字模高度:24
//XBF字体,外部bin文件
lv_font_t myFont = {
.get_glyph_bitmap = __user_font_get_bitmap,
.get_glyph_dsc = __user_font_get_glyph_dsc,
.line_height = 24,
.base_line = 0,
};
LV_FONT_DECLARE(myFont);
lv_obj_t *label = lv_label_create(obj, NULL);
lv_obj_set_style_local_text_font(label, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &myFont);
MimiClaw 是一款基于 ESP32-S3 芯片的超轻量级AI助手,适合嵌入式AI与物联网开发者快速部署本地化AI代理。本系列教程基于MimiClaw的Arduino移植版本进行讲解,小节主要讲解部署和测试。
就像我们用手机打开WiFi功能后可以浏览附近的可用WiFi。要将手机连接到热点,通常需要打开Wi-Fi设置应用程序,列出可用的网络,然后选择所需的热点。然后输入密码(或不输入密码),可以使用ESP32进行相同的操作。
本文本介绍配置飞书机器人为MimiClaw的一个输入/输出端,和添加一个控制WS2812与LED的控制技能。
一块 30 块钱的开发板 + 一个大模型 API,就能做出可以听懂人话的智能硬件。 本文记录完整安装过程和踩坑经验,确保你跟着做就能跑通。
本文将从手绘架构图入手,逐层拆解 MimiClaw 的分层设计、核心模块、数据流转与底层实现,带你解剖这只“智能虾”的技术骨架,看懂在 C 语言加持下,AI 智能体如何以可穿戴设备的形态,在你身边稳稳运行、离线服务、主动响应。
本文介绍如何在不脱离 ArduinoIDE 可视化开发的前提下,通过一个名为 platform.local.txt 的小文件,实现对 ESP32 编译流程的精准控制。
本文将系统分析程序体积增长的五大根源,并提供经过验证的优化方案,帮助减小固件大小。
本文所DIY的语音助手设备端使用的是MicroPython、服务端是Python,对于很多开发者来说MicroPython入门没难度。
本小节使用音频开发框架实现一个音频录制到文件的示例。
I2S协议通过BCLK、LRCLK和DATA三线精准传输音频数据,但时序边沿、帧格式、时钟源等细节常引发噪声或断连。本文详解ESP32的I2S实现,从协议原理到ESP-IDF v5.x代码配置,助你避开常见陷阱,确保音频稳定传输。