7 #ifndef EV3CPPAPI_MOTOR_H_ 8 #define EV3CPPAPI_MOTOR_H_ 39 explicit Motor(
ePortM port,
bool brake =
true, motor_type_t type = LARGE_MOTOR);
57 ev3_motor_stop(mPort,
true);
58 ev3_motor_reset_counts(mPort);
67 inline int32_t
getCount(
void)
const {
return ev3_motor_get_counts(mPort) - mOffset; }
75 inline void setCount(int32_t count) { mOffset = ev3_motor_get_counts(mPort) - count; }
97 inline void stop() { (void)ev3_motor_stop(mPort, mBrake); }
105 inline motor_port_t
getPort(
void)
const {
return mPort; }
113 inline bool getBrake(
void)
const {
return mBrake; }
120 inline int getPWM(
void)
const {
return mPWM; }
131 #endif // ! EV3CPPAPI_MOTOR_H_
void setBrake(bool brake)
void setCount(int32_t count)
bool getBrake(void) const
motor_port_t getPort(void) const
int32_t getCount(void) const
Motor(ePortM port, bool brake=true, motor_type_t type=LARGE_MOTOR)