正点原子开发板
alientek_develop_board
cancmder
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 "main.hpp"
#include <stddef.h>
#include <stdio.h>
//
#include "sdk/os/zos.hpp"
//
// #include "sdk\components\cmdscheduler\cmd_scheduler.hpp"
#include "sdk\components\eq_20_asb_motor\eq20_servomotor.hpp"
#include "sdk\components\iflytop_can_slave_module_master_end\stepmotor.hpp"
#include "sdk\components\iflytop_can_slave_v1\iflytop_can_master.hpp"
#include "sdk\components\step_motor_45\step_motor_45.hpp"
#include "sdk\components\step_motor_45\step_motor_45_scheduler.hpp"
#include "sdk\components\zcancmder\zcanreceiver_master.hpp"
//
#include "sdk\components\cmdscheduler\cmd_scheduler_v2.hpp"
#include "sdk\components\eq_20_asb_motor\script_cmder_eq20_servomotor.hpp"
#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
#include "sdk\components\mini_servo_motor\scirpt_cmder_mini_servo_motor_ctrl_module.hpp"
#include "sdk\components\step_motor_45\script_cmder_step_motor_45.hpp"
// #include "sdk\components\scriptcmder_module\xy_robot_script_cmder_module.hpp"
// #include "sdk\components\zcancmder_master_module/zcan_master_step_motor_ctrl_module.hpp"
// #include "sdk\components\zcancmder_master_module\zcan_xy_robot_master_module.hpp"
#include "sdk\components\taojingchi_screen\taojingchi_screen_service.hpp"
#include "sdk\components\zprotocol_helper\micro_computer_module_device_script_cmder_paser.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\protocol_proxy.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_manager.hpp"
#include "sdk\components\zprotocols\zcancmder_v2\zmodule_device_script_cmder_paser.hpp"
//
#define TAG "main"
namespace iflytop { Main gmain; };
using namespace iflytop; using namespace std; #define CHECK_ARGC(n) \
if (argc != (n + 1)) { \ ZLOGE(TAG, "argc != %d", n); \ context->breakflag = true; \ return; \ } extern "C" { void StartDefaultTask(void const* argument) { iflytop::gmain.run(); } } /*******************************************************************************
* ���� * *******************************************************************************/ static chip_cfg_t chipcfg = { .us_dleay_tim = &DELAY_US_TIMER, .tim_irq_scheduler_tim = &TIM_IRQ_SCHEDULER_TIMER, .huart = &DEBUG_UART, .debuglight = DEBUG_LIGHT_GPIO, };
namespace iflytop { /*******************************************************************************
* �������� * *******************************************************************************/ ZCanCommnaderMaster m_zcanCommnaderMaster; // can����
ModbusBlockHost g_modbusblockhost; // modbus����
CmdSchedulerV2 g_cmdScheduler; // �����ַ���ָ������
MicroComputerModuleDeviceScriptCmderPaser g_zmodule_device_script_cmder_paser; // ���ڽ������е��豸ָ��
ZModuleDeviceManager g_zmodule_device_manager; // �豸������
/*******************************************************************************
* CAN�豸 * *******************************************************************************/ ZIProtocolProxy protocolProxy[30];
} // namespace iflytop
extern "C" { extern DMA_HandleTypeDef hdma_usart3_rx; extern DMA_HandleTypeDef hdma_usart3_tx; }
extern "C" {} extern DMA_HandleTypeDef hdma_usart2_rx; extern DMA_HandleTypeDef hdma_usart2_tx;
extern void script_reg_fn(); void regfn() { script_reg_fn(); }
extern void step_motor_cmd_reg(); void Main::run() { // PB13
/*******************************************************************************
* ϵͳ��ʼ�� * *******************************************************************************/
chip_init(&chipcfg); zos_cfg_t zoscfg; zos_init(&zoscfg);
/*******************************************************************************
* ���߳�ʼ�� * *******************************************************************************/ auto* cfg = m_zcanCommnaderMaster.createCFG(); // can��������
m_zcanCommnaderMaster.init(cfg); // can����
g_zmodule_device_manager.initialize(&m_zcanCommnaderMaster); /*******************************************************************************
* �豸�����ͳ�ʼ�� * *******************************************************************************/
for (size_t i = 0; i < ZARRAY_SIZE(protocolProxy); i++) { protocolProxy[i].initialize(i + 1, &m_zcanCommnaderMaster); g_zmodule_device_manager.registerModule(&protocolProxy[i]); } /*******************************************************************************
* �����ַ���ָ������ * *******************************************************************************/ g_cmdScheduler.initialize(&DEBUG_UART, 1000); //
g_zmodule_device_script_cmder_paser.initialize(&g_cmdScheduler, &g_zmodule_device_manager);
#if 0
step_motor_cmd_reg(); #endif
while (true) { OSDefaultSchduler::getInstance()->loop(); g_cmdScheduler.schedule(); osDelay(1); } }
|