|
|
@ -92,7 +92,7 @@ void umain() { |
|
|
|
g_motor.setDeceleration(300000); |
|
|
|
g_motor.setIHOLD_IRUN(0, 8, 10); |
|
|
|
|
|
|
|
g_motor.rotate(300000); |
|
|
|
g_motor.rotate(0); |
|
|
|
// g_motor.enable(false);
|
|
|
|
|
|
|
|
auto zcanCmder_cfg = g_zcanCmder.createCFG(deviceId); |
|
|
@ -118,23 +118,35 @@ void umain() { |
|
|
|
* zcanXYRobotCtrlModule * |
|
|
|
*******************************************************************************/ |
|
|
|
static ZGPIO input[10]; |
|
|
|
input[0].initAsInput(SENSOR_INT0, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[1].initAsInput(SENSOR_INT1, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[2].initAsInput(SENSOR_INT2, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[3].initAsInput(SENSOR_INT3, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[4].initAsInput(SENSOR_INT4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[5].initAsInput(SENSOR_INT5, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[6].initAsInput(SENSOR_INT6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[7].initAsInput(SENSOR_INT7, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[8].initAsInput(SENSOR_INT8, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
input[9].initAsInput(SENSOR_INT9, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, false); |
|
|
|
|
|
|
|
// g_stepMotorCtrlModule.initialize(deviceId, &g_motor, &input[0], &input[1]);
|
|
|
|
// g_zcanStepMotorCtrlModule.initialize(&g_zcanCmder, 1, &g_stepMotorCtrlModule);
|
|
|
|
|
|
|
|
// xyRobotCtrlModule.initialize(&motora, &motorb, &input[6], &input[7], IFLYTOP_NVS_CONFIG_FLASH_SECTOR);
|
|
|
|
// xyRobotCtrlModule.dumpcfg();
|
|
|
|
// zcanXYRobotCtrlModule.initialize(&zcanCmder, 1, &xyRobotCtrlModule);
|
|
|
|
input[0].initAsInput(SENSOR_INT0, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[1].initAsInput(SENSOR_INT1, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[2].initAsInput(SENSOR_INT2, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[3].initAsInput(SENSOR_INT3, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[4].initAsInput(SENSOR_INT4, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[5].initAsInput(SENSOR_INT5, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[6].initAsInput(SENSOR_INT6, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[7].initAsInput(SENSOR_INT7, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[8].initAsInput(SENSOR_INT8, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
input[9].initAsInput(SENSOR_INT9, ZGPIO::kMode_nopull, ZGPIO::kIRQ_noIrq, true); |
|
|
|
|
|
|
|
OSDefaultSchduler::getInstance()->regPeriodJob( |
|
|
|
[](OSDefaultSchduler::Context& context) { |
|
|
|
ZLOGI(TAG, "[0]:%d [1]:%d [2]:%d [3]:%d [4]:%d [5]:%d [6]:%d [7]:%d [8]:%d [9]:%d", //
|
|
|
|
input[0].getState(), //
|
|
|
|
input[1].getState(), //
|
|
|
|
input[2].getState(), //
|
|
|
|
input[3].getState(), //
|
|
|
|
input[4].getState(), //
|
|
|
|
input[5].getState(), //
|
|
|
|
input[6].getState(), //
|
|
|
|
input[7].getState(), //
|
|
|
|
input[8].getState(), //
|
|
|
|
input[9].getState()); |
|
|
|
}, |
|
|
|
1000); |
|
|
|
|
|
|
|
//g_stepMotorCtrlModule.initialize(deviceId, &g_motor, input, ZARRAY_SIZE(input));
|
|
|
|
g_zcanStepMotorCtrlModule.initialize(&g_zcanCmder, 1, &g_stepMotorCtrlModule); |
|
|
|
|
|
|
|
while (true) { |
|
|
|
OSDefaultSchduler::getInstance()->loop(); |
|
|
|