2 * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
3 * Copyright (c) 2014 Intel Corporation.
6 * Based on Adafruit BMP085 library.
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, sublicense, and/or sell copies of the Software, and to
13 * permit persons to whom the Software is furnished to do so, subject to
14 * the following conditions:
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 #define MIN_PERIOD 500
36 #define MAX_PERIOD 1000
37 #define PULSEWIDTH 480
45 * @brief C++ API for StepMotor Drivers
47 * This file defines the stepmotor C++ interface for libstepmotor
49 * @snippet stepmotor.cxx Interesting
54 * Instanciates a StepMotor object
56 * @param dirPin direction pin
57 * @param stePin steper pulse pin
59 StepMotor (int dirPin, int stePin);
62 * StepMotor object destructor.
67 * Set the speed of rotation
69 * @param speed rotation speed
71 void setSpeed (int speed);
74 * Rotate motor forward
76 * @param ticks number of tickes the motor will move
78 maa_result_t stepForward (int ticks);
81 * Rotate motor backward
83 * @param ticks number of tickes the motor will move
85 maa_result_t stepBackwards (int ticks);
94 maa_gpio_context m_dirPinCtx;
95 maa_pwm_context m_pwmStepContext;
97 maa_result_t move (int ticks);
98 maa_result_t dirForward ();
99 maa_result_t dirBackwards ();