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.
|
|
#include <stddef.h>
#include <stdio.h>
#include "configs/device_id_mgr.hpp"
#include "public_service/public_service.hpp"
#include "sdk/sdk.hpp"
#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(); } }
static void board_init() { int32_t deviceId = zdevice_id_mgr_get_device_id(); switch (deviceId) { default: common_hardware_init(); break; } }
static void board_post_init() { int32_t deviceId = zdevice_id_mgr_get_device_id(); GService::inst()->initialize(); switch (deviceId) { default: break; } }
static iflytop::ZGPIO debuglight; static bool errorFlag; static inline void debugLightLoop() { static bool light = false; static uint32_t lastcall = 0;
if (errorFlag) { if (zos_haspassedms(lastcall) > 30) { light = !light; debuglight.setState(light); lastcall = zos_get_tick(); } } else { if (zos_haspassedms(lastcall) > 300) { light = !light; debuglight.setState(light); lastcall = zos_get_tick(); } } }
void umain() { //
board_init();
sdkinit();
debuglight.initAsOutput(PC_DEBUG_LIGHT_GPIO, iflytop::ZGPIO::kMode_nopull, false, false);
ZLOGI("SYS", "chip init ok"); ZLOGI("SYS", "= manufacturer : %s", PC_MANUFACTURER); ZLOGI("SYS", "= project name : %s", PC_PROJECT_NAME); ZLOGI("SYS", "= version : %d", PC_VERSION); ZLOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq()); ZLOGI("SYS", "= build time : %s", __DATE__ " " __TIME__); ZLOGI("SYS", "= device id : %d", zdevice_id_mgr_get_device_id());
if (zdevice_id_mgr_get_device_id() <= 0) { ZLOGE("SYS", "device id is not set"); errorFlag = true; } else { board_post_init(); ZLOGI(TAG, "======================= sysinfo ======================= "); SysMgr::ins()->initedFinished(); SysMgr::ins()->dumpSysInfo(); ZLOGI(TAG, "="); }
while (true) { GService::inst()->getZCanReceiver()->loop(); osDelay(1); debugLightLoop(); } }
|