[add] show_logo

This commit is contained in:
dianjixz
2024-05-20 09:24:18 +08:00
parent e1146ab824
commit 4bb0d155a7
7 changed files with 94 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
dist
build
.config.mk
.flash.conf.json
+4
View File
@@ -0,0 +1,4 @@
from pathlib import Path
import os
with open(str(Path(os.getcwd())/'..'/'..'/'tools'/'scons'/'project.py')) as f:
exec(f.read())
+11
View File
@@ -0,0 +1,11 @@
# unix
CONFIG_TOOLCHAIN_PATH="/opt/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf/bin"
# win
# CONFIG_TOOLCHAIN_PATH="..\\gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf\\bin"
CONFIG_TOOLCHAIN_PREFIX="arm-linux-gnueabihf-"
# CONFIG_MINICV2_COMPONENT_ENABLED=y
CONFIG_DEVICE_DRIVER_ENABLED=y
CONFIG_DEVICE_FRAMEBUFFER_ENABLED=y
CONFIG_STB_ENABLED=y
View File
+33
View File
@@ -0,0 +1,33 @@
# project_root/src/SConscript
import os
# Import the environment from the SConstruct file
Import('env')
with open(env['PROJECT_TOOL_S']) as f:
exec(f.read())
SRCS = Glob('src/*.c*')
INCLUDE = [ADir('include'), ADir('.')]
PRIVATE_INCLUDE = []
REQUIREMENTS = ['pthread', 'DeviceDriver', 'stb']
STATIC_LIB = []
DYNAMIC_LIB = []
DEFINITIONS = []
DEFINITIONS_PRIVATE = []
LDFLAGS = []
LINK_SEARCH_PATH = []
env['COMPONENTS'].append({'target':env['PROJECT_NAME'],
'SRCS':SRCS,
'INCLUDE':INCLUDE,
'PRIVATE_INCLUDE':PRIVATE_INCLUDE,
'REQUIREMENTS':REQUIREMENTS,
'STATIC_LIB':STATIC_LIB,
'DYNAMIC_LIB':DYNAMIC_LIB,
'DEFINITIONS':DEFINITIONS,
'DEFINITIONS_PRIVATE':DEFINITIONS_PRIVATE,
'LDFLAGS':LDFLAGS,
'LINK_SEARCH_PATH':LINK_SEARCH_PATH,
'REGISTER':'project'
})
+3
View File
@@ -0,0 +1,3 @@
#pragma once
+37
View File
@@ -0,0 +1,37 @@
#include <stdio.h>
#include <string.h>
#include "framebuffer/fbtools.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
int main(int argc, char **argv)
{
FBDEV fbdev;
memset(&fbdev, 0, sizeof(FBDEV));
strcpy(fbdev.dev, "/dev/fb1");
if (fb_open(&fbdev) == 0)
{
printf("open frame buffer error/n");
return -1;
}
int w = fbdev.fb_var.xres;
int h = fbdev.fb_var.yres;
int color = fbdev.fb_var.bits_per_pixel;
uint16_t *piex = fbdev.fb_mem;
int iw, ih, n;
unsigned char *idata = stbi_load("/usr/local/m5stack/logo.jpg", &iw, &ih, &n, 0);
for (int i = 0; i < iw * ih; i++)
{
piex[i] = ((((idata[3 * i]) & 0xF8) << 8) | (((idata[3 * i + 1]) & 0xFC) << 3) | ((idata[3 * i + 2]) >> 3));
}
stbi_image_free(idata);
usleep(60 * 1000);
fb_close(&fbdev);
return 0;
}