29 #include <mraa/types.hpp>
30 #include <mraa/i2c.hpp>
32 #define GROVEMD_I2C_BUS 0
33 #define GROVEMD_DEFAULT_I2C_ADDR 0x0f
86 typedef enum { SET_SPEED = 0x82,
91 STEPPER_ENABLE = 0x1a,
92 STEPPER_DISABLE = 0x1b,
93 STEPPER_NUM_STEPS = 0x1c
97 typedef enum { STEP_DIR_CCW = 0x01,
102 typedef enum { DIR_CCW = 0x02,
107 typedef enum { STEP_MODE1 = 0x00,
117 GroveMD(
int bus=GROVEMD_I2C_BUS,
118 uint8_t address=GROVEMD_DEFAULT_I2C_ADDR);
133 bool writePacket(REG_T reg, uint8_t data1, uint8_t data2);
210 void configStepper(
unsigned int stepsPerRev, STEP_MODE_T mode=STEP_MODE1);
220 uint32_t m_stepDelay;
221 uint32_t m_totalSteps;
222 STEP_MODE_T m_stepMode;
234 static const uint8_t GROVEMD_NOOP = 0x01;
236 struct timeval m_startTime;
244 uint32_t getMillis();
bool enableStepper(STEP_DIRECTION_T dir, uint8_t speed)
Definition: grovemd.cxx:109
bool disableStepper()
Definition: grovemd.cxx:152
API for the Grove I2C Motor Driver.
Definition: grovemd.h:82
bool setMotorSpeeds(uint8_t speedA, uint8_t speedB)
Definition: grovemd.cxx:93
bool writePacket(REG_T reg, uint8_t data1, uint8_t data2)
Definition: grovemd.cxx:68
bool setPWMFrequencyPrescale(uint8_t freq=0x03)
Definition: grovemd.cxx:98
bool setMotorDirections(DC_DIRECTION_T dirA, DC_DIRECTION_T dirB)
Definition: grovemd.cxx:103
void configStepper(unsigned int stepsPerRev, STEP_MODE_T mode=STEP_MODE1)
Definition: grovemd.cxx:215
~GroveMD()
Definition: grovemd.cxx:62
GroveMD(int bus=GROVEMD_I2C_BUS, uint8_t address=GROVEMD_DEFAULT_I2C_ADDR)
Definition: grovemd.cxx:36
bool setStepperSteps(unsigned int steps)
Definition: grovemd.cxx:162