initial commit: IRCAM app

This commit is contained in:
Patrick Moessler 2024-01-04 00:52:35 +01:00
commit eeaed20316
9 changed files with 269 additions and 0 deletions

2
CMakeLists.txt Normal file
View file

@ -0,0 +1,2 @@
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0

9
Kconfig Normal file
View file

@ -0,0 +1,9 @@
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0
#
# This Kconfig file is picked by the Zephyr build system because it is defined
# as the module Kconfig entry point (see zephyr/module.yml). You can browse
# module options by going to Zephyr -> Modules in Kconfig.
# rsource "drivers/Kconfig"
# rsource "lib/Kconfig"

12
app/CMakeLists.txt Normal file
View file

@ -0,0 +1,12 @@
#-------------------------------------------------------------------------------
# IRCAM
#
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ircam LANGUAGES C)
target_sources(app PRIVATE src/main.c)

10
app/Kconfig Normal file
View file

@ -0,0 +1,10 @@
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0
menu "Zephyr"
source "Kconfig.zephyr"
endmenu
module = APP
module-str = APP
source "subsys/logging/Kconfig.template.log_config"

5
app/VERSION Normal file
View file

@ -0,0 +1,5 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =

114
app/prj.conf Normal file
View file

@ -0,0 +1,114 @@
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0
# shell
CONFIG_SHELL=y
CONFIG_DEVICE_SHELL=y
CONFIG_DEVMEM_SHELL=y
CONFIG_GPIO_SHELL=y
CONFIG_I2C_SHELL=y
CONFIG_INPUT_SHELL=y
CONFIG_LV_Z_SHELL=y
# LVGL
CONFIG_LVGL=y
CONFIG_LV_COLOR_DEPTH_32=y
CONFIG_LV_MEM_CUSTOM=y
CONFIG_LV_USE_LOG=y
CONFIG_LV_FONT_MONTSERRAT_14=y
CONFIG_LV_THEME_DEFAULT_DARK=y
CONFIG_LV_CALENDAR_WEEK_STARTS_MONDAY=y
CONFIG_LV_LOG_PRINTF=y
CONFIG_LV_USE_PERF_MONITOR=y
CONFIG_LV_USE_ASSERT_NULL=n
CONFIG_LV_USE_ASSERT_MALLOC=n
# log
CONFIG_LOG=y
# CONFIG_LV_LOG_LEVEL_TRACE=y
# CONFIG_LV_LOG_LEVEL_INFO=y
# debug
# CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_APP_LOG_LEVEL_DBG=y
CONFIG_DEBUG_THREAD_INFO=y
CONFIG_INIT_STACKS=y
CONFIG_THREAD_STACK_INFO=y
CONFIG_STACK_CANARIES=y
CONFIG_STACK_USAGE=y
# CONFIG_STACK_SENTINEL=y
# CONFIG_KERNEL_LOG_LEVEL_DBG=y
CONFIG_TRACING=y
CONFIG_THREAD_RUNTIME_STATS=y
# smp?
# CONFIG_MP_NUM_CPUS=2
# CONFIG_MP_MAX_NUM_CPUS=2
# CONFIG_SMP=y
# future features?
CONFIG_VIDEO=n
# CONFIG_CRC=y
# CONFIG_DISK_ACCESS=y
# CONFIG_DISK_DRIVER_SDMMC=y
# CONFIG_DISK_DRIVERS=y
# CONFIG_FAT_FILESYSTEM_ELM=y
# CONFIG_FILE_SYSTEM_MAX_FILE_NAME=-1
# CONFIG_FILE_SYSTEM_MAX_TYPES=2
# CONFIG_FILE_SYSTEM=y
# CONFIG_FNMATCH=y
# CONFIG_FS_FATFS_CODEPAGE=437
# CONFIG_FS_FATFS_MAX_ROOT_ENTRIES=512
# CONFIG_FS_FATFS_MAX_SS=512
# CONFIG_FS_FATFS_MIN_SS=512
# CONFIG_FS_FATFS_MOUNT_MKFS=y
# CONFIG_FS_FATFS_NUM_DIRS=4
# CONFIG_FS_FATFS_NUM_FILES=4
# CONFIG_FS_FATFS_WINDOW_ALIGNMENT=1
# CONFIG_GETOPT=y
# CONFIG_KERNEL_SHELL=y
# CONFIG_LV_USE_FS_FATFS=y
# CONFIG_LV_USE_PNG=y
# CONFIG_LV_Z_BUFFER_ALLOC_STATIC=y
# CONFIG_LV_Z_MEM_POOL_SYS_HEAP=y
# CONFIG_LV_Z_POINTER_INPUT_MSGQ_COUNT=10
# CONFIG_LV_Z_POINTER_INPUT=y
# CONFIG_LV_Z_USE_FILESYSTEM=y
# CONFIG_LV_Z_VDB_ALIGN=4
# CONFIG_LV_Z_VDB_SIZE=10
# CONFIG_MMC_RCA=2
# CONFIG_POLL=y
# CONFIG_RING_BUFFER=y
# CONFIG_SD_BUFFER_SIZE=64
# CONFIG_SD_CMD_TIMEOUT=200
# CONFIG_SD_DATA_RETRIES=3
# CONFIG_SD_DATA_TIMEOUT=10000
# CONFIG_SD_INIT_PRIORITY=90
# CONFIG_SD_INIT_TIMEOUT=1500
# CONFIG_SD_OCR_RETRY_COUNT=1000
# CONFIG_SD_RETRY_COUNT=10
# CONFIG_SDHC_INIT_PRIORITY=85
# CONFIG_SDHC=y
# CONFIG_SDMMC_STACK=y
# CONFIG_SDMMC_SUBSYS=y
# CONFIG_SDMMC_VOLUME_NAME="SD"
# CONFIG_SETTINGS_DYNAMIC_HANDLERS=y
# CONFIG_SETTINGS_ENCODE_LEN=y
# CONFIG_SETTINGS_FILE_MAX_LINES=32
# CONFIG_SETTINGS_FILE_PATH="/settings/run"
# CONFIG_SETTINGS_FILE=y
# CONFIG_SETTINGS_RUNTIME=y
# CONFIG_SETTINGS=y
# CONFIG_SPI_COMPLETION_TIMEOUT_TOLERANCE=200
# CONFIG_SPI_INIT_PRIORITY=70
# CONFIG_SPI_SDHC=y
# CONFIG_SYS_HEAP_INFO=y
# CONFIG_UART_INTERRUPT_DRIVEN=y
# CONFIG_VIDEO_BUFFER_POOL_ALIGN=64
# CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=2
# CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=1048576
# CONFIG_VIDEO_INIT_PRIORITY=60
# CONFIG_WIFI=y

80
app/src/main.c Normal file
View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2024 PM
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <app_version.h>
#include <zephyr/kernel.h>
#include <lvgl.h>
#include <lvgl_input_device.h>
#include <zephyr/drivers/display.h>
#include <zephyr/input/input.h>
#include <zephyr/random/random.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);
int main(void)
{
int ret;
printk("IRCAM %s\n", APP_VERSION_STRING);
char count_str[11] = {0};
const struct device *display_dev;
display_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_display));
if (!device_is_ready(display_dev))
{
printf("Device %s not ready\n", display_dev->name);
return 0;
}
if (display_set_pixel_format(display_dev, PIXEL_FORMAT_RGB_888) != 0)
{
printk("display pixel 888 not ok\n");
printf("Failed to set required pixel format");
return 0;
}
printf("Initialized %s\n", display_dev->name);
static lv_color_t cbuf[32 * 24];
lv_obj_t *ir_image = lv_canvas_create(lv_scr_act());
lv_canvas_set_buffer(ir_image, cbuf, 32, 24, LV_IMG_CF_TRUE_COLOR);
lv_canvas_fill_bg(ir_image, lv_color_make(0x40,0x40,0x40), LV_OPA_COVER);
lv_obj_set_size(ir_image, 32, 24);
lv_obj_align(ir_image, LV_ALIGN_TOP_LEFT, 4, 4);
lv_img_set_pivot(ir_image, 0, 0);
lv_img_set_zoom(ir_image, 256 * 8);
lv_img_set_antialias(ir_image, false);
lv_timer_handler();
display_blanking_off(display_dev);
lv_color32_t color;
while (1)
{
for (int y = 0; y < 24; y++)
{
for (int x = 0; x < 32; x++)
{
color.ch.red = (color.ch.red + 11) % 255;
color.ch.green = (color.ch.green + 17) % 255;
color.ch.blue = (color.ch.blue + 13) % 255;
lv_canvas_set_px_color(ir_image, x, y, color);
}
}
int delay = lv_timer_handler_run_in_period(100);
k_msleep(delay);
}
return 0;
}

17
west.yml Normal file
View file

@ -0,0 +1,17 @@
# Copyright (c) 2024 PM
# SPDX-License-Identifier: Apache-2.0
manifest:
remotes:
- name: zephyrproject-rtos
url-base: https://github.com/zephyrproject-rtos
projects:
- name: zephyr
remote: zephyrproject-rtos
revision: main
import:
name-allowlist:
- hal_espressif
- fatfs
- lvgl

20
zephyr/module.yml Normal file
View file

@ -0,0 +1,20 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
build:
# Path to the Kconfig file that will be sourced into Zephyr Kconfig tree under
# Zephyr > Modules > example-application. Path is relative from root of this
# repository.
kconfig: Kconfig
# Path to the folder that contains the CMakeLists.txt file to be included by
# Zephyr build system. The `.` is the root of this repository.
cmake: .
settings:
# Additional roots for boards and DTS files. Zephyr will use the
# `<board_root>/boards` for additional boards. The `.` is the root of this
# repository.
board_root: .
# Zephyr will use the `<dts_root>/dts` for additional dts files and
# `<dts_root>/dts/bindings` for additional dts binding files. The `.` is
# the root of this repository.
dts_root: .