|
|
@ -3,6 +3,7 @@ |
|
|
|
|
|
|
|
#include "configs/device_id_mgr.hpp"
|
|
|
|
#include "public_service/public_service.hpp"
|
|
|
|
#include "sdk/sdk.hpp"
|
|
|
|
#include "sysmgr/sys_mgr.hpp"
|
|
|
|
//
|
|
|
|
//
|
|
|
@ -16,42 +17,9 @@ extern "C" { |
|
|
|
void StartDefaultTask(void const* argument) { umain(); } |
|
|
|
} |
|
|
|
|
|
|
|
int32_t deviceId = 0; |
|
|
|
|
|
|
|
static void board_init() { |
|
|
|
int32_t deviceId = zdevice_id_mgr_get_device_id(); |
|
|
|
switch (deviceId) { |
|
|
|
// case 10:
|
|
|
|
// subboard10_hbot_board_init();
|
|
|
|
// break;
|
|
|
|
// case 20: // 板夹仓
|
|
|
|
// subboard20_plate_clamp_case_board_init();
|
|
|
|
// break;
|
|
|
|
// case 30: // 摇匀模组
|
|
|
|
// subboard30_shake_module_board_init();
|
|
|
|
// break;
|
|
|
|
// case 40: // 温度控制板40
|
|
|
|
// case 50: // 温度控制板50
|
|
|
|
// subboard40_and_50_temperature_ctrl_board_init();
|
|
|
|
// break;
|
|
|
|
// case 60: // 进出料模组
|
|
|
|
// subboard60_inlet_and_outlet_module_board_init();
|
|
|
|
// break;
|
|
|
|
// case 70: // 孵化转盘
|
|
|
|
// subboard70_incubation_turntable_board_init();
|
|
|
|
// break;
|
|
|
|
// case 80:
|
|
|
|
// subboard80_cliptip_board_init();
|
|
|
|
// break;
|
|
|
|
// case 90:
|
|
|
|
// subboard90_optical_module_board_init();
|
|
|
|
// break;
|
|
|
|
// case 100:
|
|
|
|
// subboard100_id_card_reader_board_init();
|
|
|
|
// break;
|
|
|
|
// case 200:
|
|
|
|
// subboard200_ext_tmc5160_board_init();
|
|
|
|
// break;
|
|
|
|
|
|
|
|
default: |
|
|
|
common_hardware_init(); |
|
|
|
break; |
|
|
@ -59,90 +27,65 @@ static void board_init() { |
|
|
|
} |
|
|
|
|
|
|
|
static void board_post_init() { |
|
|
|
int32_t deviceId = zdevice_id_mgr_get_device_id(); |
|
|
|
GService::inst()->initialize(); |
|
|
|
switch (deviceId) { |
|
|
|
// case 10:
|
|
|
|
// Subboard10Hbot::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 20:
|
|
|
|
// Subboard20PlateClampCase::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 30: // 摇匀模组
|
|
|
|
// Subboard30ShakeModule::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 40: // 温度控制板40
|
|
|
|
// case 50: // 温度控制板50
|
|
|
|
// Subboard40And50TemperatureCtrl::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 60: // 进出料模组
|
|
|
|
// Subboard60InjectAndOutletModule::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 70: // 孵化转盘
|
|
|
|
// Subboard70IncubationTurntable::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 80:
|
|
|
|
// Subboard80Cliptip::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 100:
|
|
|
|
// Subboard100IdCardReader::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 200:
|
|
|
|
// Subboard200ExtTmc5160::ins()->initialize();
|
|
|
|
// break;
|
|
|
|
// case 90:
|
|
|
|
// Subboard90OpticalModule::ins()->initialize();
|
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void umain() { |
|
|
|
// deviceId = zdevice_id_mgr_get_device_id();
|
|
|
|
|
|
|
|
// board_init();
|
|
|
|
|
|
|
|
// Pin_t debugLight = PC_DEBUG_LIGHT_GPIO;
|
|
|
|
// if (deviceId == 20) {
|
|
|
|
// debugLight = PC_SUBBOARD_20_70_LIGHT_GPIO;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 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 = debugLight;
|
|
|
|
|
|
|
|
// 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 : %d", PC_VERSION);
|
|
|
|
// ZEARLY_LOGI("SYS", "= freq : %d", HAL_RCC_GetSysClockFreq());
|
|
|
|
// ZEARLY_LOGI("SYS", "= build time : %s", __DATE__ " " __TIME__);
|
|
|
|
// ZEARLY_LOGI("SYS", "= device id : %d", deviceId);
|
|
|
|
|
|
|
|
// if (deviceId <= 0) {
|
|
|
|
// chip_set_error();
|
|
|
|
// ZEARLY_LOGE("SYS", "device id is not set");
|
|
|
|
// while (true) {
|
|
|
|
// zos_delay(1);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// board_post_init();
|
|
|
|
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(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// ZLOGI(TAG, "======================= sysinfo ======================= ");
|
|
|
|
// SysMgr::ins()->initedFinished();
|
|
|
|
// SysMgr::ins()->dumpSysInfo();
|
|
|
|
// ZLOGI(TAG, "=");
|
|
|
|
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();
|
|
|
|
// zos_delay(1);
|
|
|
|
// }
|
|
|
|
while (true) { |
|
|
|
GService::inst()->getZCanReceiver()->loop(); |
|
|
|
osDelay(1); |
|
|
|
debugLightLoop(); |
|
|
|
} |
|
|
|
} |