Merge pull request #1 from Blitblank/hello-world

Hello world
This commit is contained in:
Preston McGee
2025-12-07 15:06:07 -06:00
committed by GitHub
18 changed files with 209 additions and 79 deletions

27
.gitignore vendored
View File

@@ -1,13 +1,20 @@
build/
lib/idf-tools/*
pcb/panel/wombus64_led-backups/
pcb/panel/~*
pcb/panel/#auto_saved_files#
pcb/panel/fp-info-cache
pcb/panel/wombus64_led.kicad_prl
pcb/control/*
!pcb/control/README.md
!pcb/control/revisions.txt
!pcb/control/soburg2.kicad_pcb
!pcb/control/soburg2.kicad_pro
!pcb/control/soburg2.kicad_pch
pcb/panel/soburg2-backups/
pcb/control/~*
pcb/control/#auto_saved_files#
pcb/control/fp-info-cache
pcb/control/soburg2.kicad_prl
pcb/panel/*
!pcb/panel/revisions.txt
!pcb/panel/wombus64_led.kicad_pcb
!pcb/panel/wombus64_led.kicad_pro
!pcb/panel/wombus64_led.kicad_pch
sdkconfig
sdkconfig.old
.vscode/*

5
.gitmodules vendored Normal file
View File

@@ -0,0 +1,5 @@
[submodule "lib/esp-idf"]
path = lib/esp-idf
url = https://github.com/espressif/esp-idf.git
branch = master
ignore = all

View File

@@ -1,7 +1,14 @@
# TODO: check version
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/scripts/project.cmake)
set(PROJECT_MAIN_COMPONENT ${CMAKE_CURRENT_LIST_DIR}/src)
project(this)
set(EXTRA_COMPONENT_DIRS
${CMAKE_CURRENT_LIST_DIR}/config
${CMAKE_CURRENT_LIST_DIR}/src
)
# For the esp-idf configuration
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(wombus_led)

View File

@@ -29,3 +29,9 @@ Scripts are in scripts directory, named appropriately.
- [ ] Microphone for sound-based effects like a spectrum analyzer
This is basic but hopefully can be good platform for future WS2812b projects.
## Scripts:
After cloning: $ ./scripts/repo-setup # installs esp-idf, sets up target configurations
To build: $ ./scripts/build.sh
To flash: $ ./scripts/flash.sh # note: flash.sh automatically builds
To monitor: $ ./scripts/monitor.sh

2
config/CMakeLists.txt Normal file
View File

@@ -0,0 +1,2 @@
idf_component_register(SRCS "" INCLUDE_DIRS "")

49
config/Kconfig.projbuild Normal file
View File

@@ -0,0 +1,49 @@
menu "Example Configuration"
orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"
choice BLINK_LED
prompt "Blink LED type"
default BLINK_LED_GPIO
help
Select the LED type. A normal level controlled LED or an addressable LED strip.
The default selection is based on the Espressif DevKit boards.
You can change the default selection according to your board.
config BLINK_LED_GPIO
bool "GPIO"
config BLINK_LED_STRIP
bool "LED strip"
endchoice
choice BLINK_LED_STRIP_BACKEND
depends on BLINK_LED_STRIP
prompt "LED strip backend peripheral"
default BLINK_LED_STRIP_BACKEND_RMT if SOC_RMT_SUPPORTED
default BLINK_LED_STRIP_BACKEND_SPI
help
Select the backend peripheral to drive the LED strip.
config BLINK_LED_STRIP_BACKEND_RMT
depends on SOC_RMT_SUPPORTED
bool "RMT"
config BLINK_LED_STRIP_BACKEND_SPI
bool "SPI"
endchoice
config BLINK_GPIO
int "Blink GPIO number"
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
default 4
help
GPIO number (IOxx) to blink on and off the LED.
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink.
config BLINK_PERIOD
int "Blink period in ms"
range 10 3600000
default 500
help
Define the blinking period in milliseconds.
endmenu

View File

@@ -0,0 +1,2 @@
CONFIG_BLINK_PERIOD=100

1
lib/esp-idf Submodule

Submodule lib/esp-idf added at 487551888a

View File

@@ -393,23 +393,18 @@
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"conflicting_netclasses": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"endpoint_off_grid": "warning",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"missing_bidi_pin": "warning",
"missing_input_pin": "warning",
"missing_power_pin": "error",
"missing_unit": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
@@ -419,7 +414,6 @@
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"simulation_model_issue": "ignore",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
@@ -437,7 +431,7 @@
"net_settings": {
"classes": [
{
"bus_width": 12,
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
@@ -451,11 +445,11 @@
"track_width": 0.2,
"via_diameter": 0.6,
"via_drill": 0.3,
"wire_width": 6
"wire_width": 6.0
}
],
"meta": {
"version": 3
"version": 2
},
"net_colors": null,
"netclass_assignments": null,
@@ -587,8 +581,18 @@
"version": 1
},
"net_format_name": "",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_current_sheet_as_root": false,
"spice_external_command": "spice \"%I\"",
"spice_model_current_sheet_as_root": true,

View File

@@ -1,3 +1,16 @@
#!usr/bin/bash
# TODO: implement
#!/usr/bin/env bash
set -e
export IDF_TOOLS_PATH=${PWD}/lib/idf-tools
export IDF_PATH=${PWD}/lib/esp-idf
export SDKCONFIG=${PWD}/config/sdkconfig
export SDKCONFIG_DEFAULTS=${PWD}/config/sdkconfig.defaults
. ${IDF_PATH}/export.sh
idf.py build
# idk how to put it in the right place
mv ${PWD}/sdkconfig ${PWD}/config/sdkconfig

10
scripts/clean.sh Normal file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
export IDF_TOOLS_PATH=${PWD}/lib/idf-tools
export IDF_PATH=${PWD}/lib/esp-idf
. ${IDF_PATH}/export.sh
idf.py fullclean

View File

@@ -1,3 +1,20 @@
#!usr/bin/bash
# TODO: implement
#!/usr/bin/env bash
set -e
export IDF_TOOLS_PATH=${PWD}/lib/idf-tools
export IDF_PATH=${PWD}/lib/esp-idf
export SDKCONFIG=${PWD}/config/sdkconfig
export SDKCONFIG_DEFAULTS=${PWD}/config/sdkconfig.defaults
. ${IDF_PATH}/export.sh
idf.py fullclean
idf.py set-target esp32s3
idf.py -b 115200 flash
# idf.py autodetects port but use -p <port> to specify
# idk how to put it in the right place
mv ${PWD}/sdkconfig ${PWD}/config/sdkconfig

View File

@@ -1,3 +1,12 @@
#!usr/bin/bash
# TODO: implement
#!/usr/bin/env bash
set -e
export IDF_TOOLS_PATH=${PWD}/lib/idf-tools
export IDF_PATH=${PWD}/lib/esp-idf
. ${IDF_PATH}/export.sh
idf.py -b 115200 monitor
# idf.py autodetects port but use -p <port> to specify

16
scripts/repo_setup.sh Normal file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -e
export IDF_TOOLS_PATH=${PWD}/lib/idf-tools
export IDF_PATH=${PWD}/lib/esp-idf
# if you get python ssl module errors- make sure your python version is 3.12 or lower
# esp-idf install scripts
bash ${IDF_PATH}/install.sh esp32s3
source ${IDF_PATH}/export.sh
# target
idf.py fullclean
idf.py set-target esp32s3

View File

9
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,9 @@
file(GLOB SRC_FILES "*.c" "*.cpp")
idf_component_register(
SRCS ${SRC_FILES}
PRIV_REQUIRES spi_flash
REQUIRES esp_driver_gpio
INCLUDE_DIRS "."
)

View File

@@ -1,50 +0,0 @@
// Copied from official ESP-IDF repository
// https://github.com/espressif/esp-idf/blob/v5.5.1/examples/get-started/hello_world/main/hello_world_main.c
#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_system.h"
void app_main(void)
{
printf("Hello world!\n");
/* Print chip information */
esp_chip_info_t chip_info;
uint32_t flash_size;
esp_chip_info(&chip_info);
printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
CONFIG_IDF_TARGET,
chip_info.cores,
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
(chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "");
unsigned major_rev = chip_info.revision / 100;
unsigned minor_rev = chip_info.revision % 100;
printf("silicon revision v%d.%d, ", major_rev, minor_rev);
if(esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
printf("Get flash size failed");
return;
}
printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
for (int i = 10; i >= 0; i--) {
printf("Restarting in %d seconds...\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
printf("Restarting now.\n");
fflush(stdout);
esp_restart();
}

23
src/main.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include "App.hpp"
#include "esp_log.h"
static const char *TAG = "main";
#ifdef __cplusplus
extern "C" {
#endif
void app_main(void) {
ESP_LOGI(TAG, "Program start");
App app;
int8_t status = app.main();
ESP_LOGI(TAG, "App main returned status %d", status);
}
#ifdef __cplusplus
}
#endif