void examineID(msg_pointer mp){ printf("ID is %d\n", mp->ID); if (mp->ID == START_ID) startMotors(); if (mp->ID == STOP_ID) stopMotors(); if (mp-> ID == CONTROL_ID) controlMotors(mp); if (mp-> ID == SPECIAL_COMMAND_ID) specialMotorCommand(mp); return; }
/* * to get the message and redirect to propper function */ uint8_t examineID(msg_pointer mp){ switch(mp->ID){ case START_ID:{ moto_startMotors(); break; } case STOP_ID:{ moto_stopMotors(); break; } case CONTROL_ID:{ controlMotors(mp); break; } case SPECIAL_COMMAND_ID:{ specialMotorCommand(mp); break; } } return 0; }