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.

404 lines
19 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "board.h"
  4. #include "sdk\components\subcanmodule\zcancmder_subboard_initer.hpp"
  5. /*******************************************************************************
  6. * PROJECT_INCLUDE *
  7. *******************************************************************************/
  8. #include "sdk/components/step_motor_ctrl_module/step_motor_ctrl_module.hpp"
  9. #include "sdk\components\mini_servo_motor\feite_servo_motor.hpp"
  10. #include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
  11. #include "sdk\components\pipette_module\pipette_ctrl_module_v2.hpp"
  12. #include "sdk\components\sensors\m3078\m3078_code_scaner.hpp"
  13. #include "sdk\components\tmc\ic\ztmc4361A.hpp"
  14. #include "sdk\components\tmc\ic\ztmc5130.hpp"
  15. #define TAG "main"
  16. using namespace iflytop;
  17. using namespace std;
  18. static ZCancmderSubboardIniter initer;
  19. extern IWDG_HandleTypeDef hiwdg;
  20. extern void umain();
  21. extern "C" {
  22. void StartDefaultTask(void const* argument) { umain(); }
  23. extern DMA_HandleTypeDef hdma_usart3_rx;
  24. extern DMA_HandleTypeDef hdma_usart3_tx;
  25. }
  26. /*******************************************************************************
  27. * GET_DEVICE_ID *
  28. *******************************************************************************/
  29. static ZGPIO ID0;
  30. static ZGPIO ID1;
  31. static ZGPIO ID2;
  32. static ZGPIO ID3;
  33. static ZGPIO ID4;
  34. static int32_t getDeviceId() {
  35. static bool init = false;
  36. if (!init) {
  37. ID0.initAsInput(ID0_IO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  38. ID1.initAsInput(ID1_IO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  39. ID2.initAsInput(ID2_IO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  40. ID3.initAsInput(ID3_IO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  41. ID4.initAsInput(ID4_IO, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  42. init = true;
  43. }
  44. uint8_t id = ID0.getState() * 1 + ID1.getState() * 2 + ID2.getState() * 4 + ID3.getState() * 8 + ID4.getState() * 16;
  45. return id;
  46. }
  47. /*******************************************************************************
  48. * INIT_SUBMODULE *
  49. *******************************************************************************/
  50. #define GLOBAL_SCALE 32
  51. #define DEFAULT_ENABLE true
  52. void nvs_init_cb() {}
  53. static void initsubmodule() {
  54. osDelay(1000);
  55. {
  56. static TMC5130 g_motor;
  57. static StepMotorCtrlModule g_stepMotorCtrlModule;
  58. TMC5130::cfg_t cfg = {
  59. .spi = &TMC_MOTOR_SPI, //
  60. .csgpio = MOTO1_CSN, //
  61. .ennPin = MOTO1_DRV_ENN, //
  62. };
  63. g_motor.initialize(&cfg);
  64. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  65. g_motor.enable(true);
  66. g_motor.setMotorShaft(false);
  67. g_motor.setGlobalScale(GLOBAL_SCALE);
  68. // g_motor.rotate(1*1000);
  69. static ZGPIO input[10];
  70. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  71. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  72. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  73. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  74. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  75. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  76. smcm_cfg.base_param.stepmotor_ihold = 1;
  77. smcm_cfg.base_param.stepmotor_irun = 20;
  78. smcm_cfg.base_param.motor_shaft = 0;
  79. smcm_cfg.base_param.motor_default_velocity = 800;
  80. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  81. smcm_cfg.base_param.max_d = 0;
  82. smcm_cfg.base_param.min_d = 0;
  83. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  84. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  85. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  86. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  87. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  88. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  89. g_stepMotorCtrlModule.initialize(initer.get_module_id(1), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  90. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  91. initer.register_module(&g_stepMotorCtrlModule);
  92. }
  93. {
  94. static TMC5130 g_motor;
  95. static StepMotorCtrlModule g_stepMotorCtrlModule;
  96. TMC5130::cfg_t cfg = {
  97. .spi = &TMC_MOTOR_SPI, //
  98. .csgpio = MOTO2_CSN, //
  99. .ennPin = MOTO2_DRV_ENN, //
  100. };
  101. g_motor.initialize(&cfg);
  102. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  103. g_motor.enable(true);
  104. g_motor.setMotorShaft(false);
  105. g_motor.setGlobalScale(GLOBAL_SCALE);
  106. static ZGPIO input[10];
  107. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  108. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  109. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  110. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  111. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  112. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  113. smcm_cfg.base_param.stepmotor_ihold = 1;
  114. smcm_cfg.base_param.stepmotor_irun = 20;
  115. smcm_cfg.base_param.motor_shaft = 0;
  116. smcm_cfg.base_param.motor_default_velocity = 800;
  117. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  118. smcm_cfg.base_param.max_d = 0;
  119. smcm_cfg.base_param.min_d = 0;
  120. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  121. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  122. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  123. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  124. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  125. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  126. g_stepMotorCtrlModule.initialize(initer.get_module_id(2), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  127. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  128. initer.register_module(&g_stepMotorCtrlModule);
  129. }
  130. {
  131. static TMC5130 g_motor;
  132. static StepMotorCtrlModule g_stepMotorCtrlModule;
  133. TMC5130::cfg_t cfg = {
  134. .spi = &TMC_MOTOR_SPI, //
  135. .csgpio = MOTO3_CSN, //
  136. .ennPin = MOTO3_DRV_ENN, //
  137. };
  138. g_motor.initialize(&cfg);
  139. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  140. g_motor.enable(true);
  141. g_motor.setMotorShaft(false);
  142. g_motor.setGlobalScale(GLOBAL_SCALE);
  143. static ZGPIO input[10];
  144. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  145. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  146. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  147. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  148. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  149. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  150. smcm_cfg.base_param.stepmotor_ihold = 1;
  151. smcm_cfg.base_param.stepmotor_irun = 20;
  152. smcm_cfg.base_param.motor_shaft = 0;
  153. smcm_cfg.base_param.motor_default_velocity = 800;
  154. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  155. smcm_cfg.base_param.max_d = 0;
  156. smcm_cfg.base_param.min_d = 0;
  157. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  158. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  159. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  160. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  161. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  162. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  163. g_stepMotorCtrlModule.initialize(initer.get_module_id(3), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  164. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  165. initer.register_module(&g_stepMotorCtrlModule);
  166. }
  167. {
  168. static TMC5130 g_motor;
  169. static StepMotorCtrlModule g_stepMotorCtrlModule;
  170. TMC5130::cfg_t cfg = {
  171. .spi = &TMC_MOTOR_SPI, //
  172. .csgpio = MOTO4_CSN, //
  173. .ennPin = MOTO4_DRV_ENN, //
  174. };
  175. g_motor.initialize(&cfg);
  176. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  177. g_motor.enable(true);
  178. g_motor.setMotorShaft(false);
  179. g_motor.setGlobalScale(GLOBAL_SCALE);
  180. static ZGPIO input[10];
  181. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  182. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  183. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  184. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  185. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  186. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  187. smcm_cfg.base_param.stepmotor_ihold = 1;
  188. smcm_cfg.base_param.stepmotor_irun = 20;
  189. smcm_cfg.base_param.motor_shaft = 0;
  190. smcm_cfg.base_param.motor_default_velocity = 800;
  191. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  192. smcm_cfg.base_param.max_d = 0;
  193. smcm_cfg.base_param.min_d = 0;
  194. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  195. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  196. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  197. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  198. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  199. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  200. g_stepMotorCtrlModule.initialize(initer.get_module_id(4), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  201. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  202. initer.register_module(&g_stepMotorCtrlModule);
  203. }
  204. {
  205. static TMC5130 g_motor;
  206. static StepMotorCtrlModule g_stepMotorCtrlModule;
  207. TMC5130::cfg_t cfg = {
  208. .spi = &TMC_MOTOR_SPI, //
  209. .csgpio = MOTO5_CSN, //
  210. .ennPin = MOTO5_DRV_ENN, //
  211. };
  212. g_motor.initialize(&cfg);
  213. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  214. g_motor.enable(true);
  215. g_motor.setMotorShaft(false);
  216. g_motor.setGlobalScale(GLOBAL_SCALE);
  217. static ZGPIO input[10];
  218. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  219. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  220. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  221. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  222. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  223. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  224. smcm_cfg.base_param.stepmotor_ihold = 1;
  225. smcm_cfg.base_param.stepmotor_irun = 20;
  226. smcm_cfg.base_param.motor_shaft = 0;
  227. smcm_cfg.base_param.motor_default_velocity = 800;
  228. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  229. smcm_cfg.base_param.max_d = 0;
  230. smcm_cfg.base_param.min_d = 0;
  231. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  232. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  233. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  234. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  235. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  236. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  237. g_stepMotorCtrlModule.initialize(initer.get_module_id(5), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  238. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  239. initer.register_module(&g_stepMotorCtrlModule);
  240. }
  241. {
  242. static TMC5130 g_motor;
  243. static StepMotorCtrlModule g_stepMotorCtrlModule;
  244. TMC5130::cfg_t cfg = {
  245. .spi = &TMC_MOTOR_SPI, //
  246. .csgpio = MOTO6_CSN, //
  247. .ennPin = MOTO6_DRV_ENN, //
  248. };
  249. g_motor.initialize(&cfg);
  250. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  251. g_motor.enable(true);
  252. g_motor.setMotorShaft(false);
  253. g_motor.setGlobalScale(GLOBAL_SCALE);
  254. static ZGPIO input[10];
  255. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  256. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  257. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  258. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  259. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  260. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  261. smcm_cfg.base_param.stepmotor_ihold = 1;
  262. smcm_cfg.base_param.stepmotor_irun = 20;
  263. smcm_cfg.base_param.motor_shaft = 0;
  264. smcm_cfg.base_param.motor_default_velocity = 800;
  265. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  266. smcm_cfg.base_param.max_d = 0;
  267. smcm_cfg.base_param.min_d = 0;
  268. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  269. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  270. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  271. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  272. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  273. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  274. g_stepMotorCtrlModule.initialize(initer.get_module_id(6), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  275. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  276. initer.register_module(&g_stepMotorCtrlModule);
  277. }
  278. {
  279. static TMC5130 g_motor;
  280. static StepMotorCtrlModule g_stepMotorCtrlModule;
  281. TMC5130::cfg_t cfg = {
  282. .spi = &TMC_MOTOR_SPI, //
  283. .csgpio = MOTO7_CSN, //
  284. .ennPin = MOTO7_DRV_ENN, //
  285. };
  286. g_motor.initialize(&cfg);
  287. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  288. g_motor.enable(true);
  289. g_motor.setMotorShaft(false);
  290. g_motor.setGlobalScale(GLOBAL_SCALE);
  291. static ZGPIO input[10];
  292. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  293. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  294. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  295. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  296. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  297. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  298. smcm_cfg.base_param.stepmotor_ihold = 1;
  299. smcm_cfg.base_param.stepmotor_irun = 20;
  300. smcm_cfg.base_param.motor_shaft = 0;
  301. smcm_cfg.base_param.motor_default_velocity = 800;
  302. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  303. smcm_cfg.base_param.max_d = 0;
  304. smcm_cfg.base_param.min_d = 0;
  305. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  306. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  307. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  308. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  309. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  310. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  311. g_stepMotorCtrlModule.initialize(initer.get_module_id(7), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  312. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  313. initer.register_module(&g_stepMotorCtrlModule);
  314. }
  315. {
  316. static TMC5130 g_motor;
  317. static StepMotorCtrlModule g_stepMotorCtrlModule;
  318. TMC5130::cfg_t cfg = {
  319. .spi = &TMC_MOTOR_SPI, //
  320. .csgpio = MOTO8_CSN, //
  321. .ennPin = MOTO8_DRV_ENN, //
  322. };
  323. g_motor.initialize(&cfg);
  324. ZLOGI(TAG, "motora initialize 5160:%x ", g_motor.readICVersion());
  325. g_motor.enable(true);
  326. g_motor.setMotorShaft(false);
  327. g_motor.setGlobalScale(GLOBAL_SCALE);
  328. static ZGPIO input[10];
  329. // input[0].initAsInput(MOTOR0_REFL /*REFL*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  330. // input[1].initAsInput(MOTOR0_REFR /*REFR*/, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true);
  331. StepMotorCtrlModule::flash_config_t smcm_cfg = {0};
  332. StepMotorCtrlModule::create_default_cfg(smcm_cfg);
  333. smcm_cfg.base_param.motor_one_circle_pulse = 1000;
  334. smcm_cfg.base_param.motor_one_circle_pulse_denominator = 1;
  335. smcm_cfg.base_param.stepmotor_ihold = 1;
  336. smcm_cfg.base_param.stepmotor_irun = 20;
  337. smcm_cfg.base_param.motor_shaft = 0;
  338. smcm_cfg.base_param.motor_default_velocity = 800;
  339. smcm_cfg.base_param.motor_run_to_zero_speed = 0;
  340. smcm_cfg.base_param.max_d = 0;
  341. smcm_cfg.base_param.min_d = 0;
  342. smcm_cfg.base_param.motor_run_to_zero_max_d = 0;
  343. smcm_cfg.base_param.motor_run_to_zero_speed = 1;
  344. smcm_cfg.base_param.motor_run_to_zero_dec = 0;
  345. smcm_cfg.base_param.motor_look_zero_edge_max_d = 0;
  346. smcm_cfg.base_param.motor_look_zero_edge_speed = 1;
  347. smcm_cfg.base_param.motor_look_zero_edge_dec = 0;
  348. g_stepMotorCtrlModule.initialize(initer.get_module_id(8), &g_motor, input, ZARRAY_SIZE(input), nullptr, &smcm_cfg);
  349. g_stepMotorCtrlModule.enable(DEFAULT_ENABLE);
  350. initer.register_module(&g_stepMotorCtrlModule);
  351. }
  352. }
  353. /*******************************************************************************
  354. * MAIN *
  355. *******************************************************************************/
  356. void umain() {
  357. ZCancmderSubboardIniter::cfg_t cfg = //
  358. {
  359. .deviceId = getDeviceId(),
  360. .input_gpio = {},
  361. .output_gpio = {},
  362. };
  363. initer.init(&cfg);
  364. initsubmodule();
  365. OSDefaultSchduler::getInstance()->regPeriodJob([](OSDefaultSchduler::Context&) { HAL_IWDG_Refresh(&hiwdg); }, 1000);
  366. initer.loop();
  367. }