added python tool inital version
This commit is contained in:
84
firmware/src/main.c
Normal file
84
firmware/src/main.c
Normal file
@@ -0,0 +1,84 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/drivers/gpio.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
#include <zephyr/drivers/hwinfo.h>
|
||||
#include <zephyr/init.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <app_version.h>
|
||||
#include <version.h>
|
||||
#include <ncs_version.h>
|
||||
|
||||
#include <fs.h>
|
||||
#include <audio.h>
|
||||
#include <io.h>
|
||||
#include <usb.h>
|
||||
|
||||
LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);
|
||||
|
||||
void print_device_id(void) {
|
||||
uint8_t device_id[8]; // 64 Bit = 8 Bytes
|
||||
ssize_t length;
|
||||
|
||||
// Device ID auslesen
|
||||
length = hwinfo_get_device_id(device_id, sizeof(device_id));
|
||||
|
||||
if (length > 0) {
|
||||
char id_str[17]; // 16 Zeichen + Null-Terminator
|
||||
for (int i = 0; i < length; i++) {
|
||||
sprintf(&id_str[i * 2], "%02x", device_id[i]);
|
||||
}
|
||||
LOG_INF("Board Device ID: %s", id_str);
|
||||
} else {
|
||||
LOG_ERR("Konnte Device ID nicht lesen");
|
||||
}
|
||||
}
|
||||
|
||||
static int print_custom_banner(void)
|
||||
{
|
||||
|
||||
printk("\x1b[44m\x1b[2J\x1b[H");
|
||||
|
||||
// Oberer Rahmen
|
||||
printk("\x1b[1;37m┌───────────────────────────────────────────┐\n");
|
||||
printk("│ Edis Buzzer Version: %-20s │\n", APP_VERSION_STRING);
|
||||
printk("├───────────────────────────────────────────┤\n");
|
||||
printk("│ \x1b[22;37mZephyr Version: \x1b[1;37m%-20s │\n", KERNEL_VERSION_STRING);
|
||||
printk("│ \x1b[22;37mNCS Version: \x1b[1;37m%-20s │\n", NCS_VERSION_STRING);
|
||||
printk("└───────────────────────────────────────────┘\x1b[0m\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(print_custom_banner, PRE_KERNEL_1, 0);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LOG_INF("Starting Edis Buzzer Application");
|
||||
print_device_id();
|
||||
|
||||
int rc;
|
||||
|
||||
rc = fs_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Filesystem initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = audio_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("Audio initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = usb_cdc_acm_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("USB initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = io_init();
|
||||
if (rc < 0) {
|
||||
LOG_ERR("I/O initialization failed: %d", rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user