You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.0 KiB
76 lines
2.0 KiB
#include <stddef.h>
|
|
#include <stdio.h>
|
|
|
|
#include "configs/device_id_mgr.hpp"
|
|
#include "public_service/public_service.hpp"
|
|
#include "sdk/chip/chip.hpp"
|
|
#include "sdk/os/zos.hpp"
|
|
#include "subboards/subboard30_shake_module/subboard30_shake_module.hpp"
|
|
#include "subboards/subboard30_shake_module/subboard30_shake_module_board.h"
|
|
#include "sysmgr/sys_mgr.hpp"
|
|
#define TAG "main"
|
|
using namespace std;
|
|
using namespace iflytop;
|
|
|
|
extern void umain();
|
|
extern "C" {
|
|
void StartDefaultTask(void const* argument) { umain(); }
|
|
}
|
|
void umain() {
|
|
int32_t id = zdevice_id_mgr_get_device_id();
|
|
switch (id) {
|
|
case 30: // 摇匀模组
|
|
subboard30_shake_module_board_init();
|
|
break;
|
|
default:
|
|
common_hardware_init();
|
|
break;
|
|
}
|
|
|
|
zos_cfg_t zoscfg = {0};
|
|
chip_cfg_t chipcfg = {};
|
|
chipcfg.us_dleay_tim = &PC_SYS_DELAY_US_TIMER;
|
|
chipcfg.tim_irq_scheduler_tim = &PC_SYS_TIM_IRQ_SCHEDULER_TIMER;
|
|
chipcfg.huart = &PC_DEBUG_UART;
|
|
chipcfg.debuglight = PC_DEBUG_LIGHT_GPIO;
|
|
|
|
chip_init(&chipcfg);
|
|
zos_init(&zoscfg);
|
|
zdevice_id_mgr_init();
|
|
|
|
ZEARLY_LOGI("SYS", "chip init ok");
|
|
ZEARLY_LOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER);
|
|
ZEARLY_LOGI("SYS", "= project name : %s", PC_PROJECT_NAME);
|
|
ZEARLY_LOGI("SYS", "= version : %s", PC_VERSION);
|
|
ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
|
|
ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
|
|
ZEARLY_LOGI("SYS", "= device id : %d", id);
|
|
|
|
if (id <= 0) {
|
|
chip_set_error();
|
|
ZEARLY_LOGE("SYS", "device id is not set");
|
|
while (true) {
|
|
zos_delay(1);
|
|
}
|
|
}
|
|
|
|
GService::inst()->initialize();
|
|
switch (id) {
|
|
case 30: // 摇匀模组
|
|
Subboard30ShakeModule::ins()->initialize();
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
ZLOGI(TAG, "======================= sysinfo ======================= ");
|
|
SysMgr::ins()->initedFinished();
|
|
SysMgr::ins()->dumpSysInfo();
|
|
ZLOGI(TAG, "=");
|
|
|
|
while (true) {
|
|
GService::inst()->getZCanReceiver()->loop();
|
|
zos_delay(1);
|
|
}
|
|
}
|