ER ev3_motor_reset_counts()

in ev3-api/src/ev3api_motor.c [238:267]


ER ev3_motor_reset_counts(motor_port_t port) {
	ER ercd;

//	lazy_initialize();

	CHECK_PORT(port);
	CHECK_PORT_CONN(port);

    char buf[2];

    /**
     * Reset the counts when used as a motor.
     * Useful when the position of a motor is changed by hand.
     */
    buf[0] = opOUTPUT_RESET;
    buf[1] = 1 << port;
    motor_command(buf, sizeof(buf));

    /**
     * Reset then counts when used as a tacho sensor.
     */
    buf[0] = opOUTPUT_CLR_COUNT;
    buf[1] = 1 << port;
    motor_command(buf, sizeof(buf));

    ercd = E_OK;

error_exit:
    return ercd;
}