Headless improvements (#58)
- Refactored headless init - Cleanup of statusbar updater
This commit is contained in:
committed by
GitHub
parent
fd27799826
commit
a67ae35aae
@@ -1,14 +1,42 @@
|
||||
#include "tactility_headless.h"
|
||||
#include "hardware_config.h"
|
||||
#include "hardware_i.h"
|
||||
#include "service_manifest.h"
|
||||
#include "service_registry.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#include "esp_init.h"
|
||||
#endif
|
||||
|
||||
#define TAG "tactility"
|
||||
|
||||
extern const ServiceManifest sdcard_service;
|
||||
extern const ServiceManifest wifi_service;
|
||||
|
||||
static const ServiceManifest* const system_services[] = {
|
||||
&sdcard_service,
|
||||
&wifi_service
|
||||
};
|
||||
|
||||
static const HardwareConfig* hardwareConfig = NULL;
|
||||
|
||||
void tt_tactility_headless_init(const HardwareConfig* config, const ServiceManifest* const services[32]) {
|
||||
static void register_and_start_system_services() {
|
||||
TT_LOG_I(TAG, "Registering and starting system services");
|
||||
int app_count = sizeof(system_services) / sizeof(ServiceManifest*);
|
||||
for (int i = 0; i < app_count; ++i) {
|
||||
tt_service_registry_add(system_services[i]);
|
||||
tt_check(tt_service_registry_start(system_services[i]->id));
|
||||
}
|
||||
}
|
||||
|
||||
void tt_headless_init(const HardwareConfig* config) {
|
||||
#ifdef ESP_PLATFORM
|
||||
tt_esp_init();
|
||||
#endif
|
||||
hardwareConfig = config;
|
||||
tt_service_registry_init();
|
||||
tt_hardware_init(config);
|
||||
hardwareConfig = config;
|
||||
register_and_start_system_services();
|
||||
}
|
||||
|
||||
const HardwareConfig* tt_get_hardware_config() {
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "hardware_config.h"
|
||||
#include "service_manifest.h"
|
||||
#include "tactility_headless_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void tt_tactility_headless_init(const HardwareConfig* config, const ServiceManifest* const services[32]);
|
||||
void tt_headless_init(const HardwareConfig* config);
|
||||
|
||||
const HardwareConfig* tt_get_hardware_config();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user