org.bluemelon.bluesense
Class StepperDevice

java.lang.Object
  extended by org.bluemelon.bluesense.Device
      extended by org.bluemelon.bluesense.StepperDevice

public class StepperDevice
extends Device

Interface to the dc stepper module. This module can be used to control the speed of 2 dc steppers.


Field Summary
static int PROXY_ID
           
static java.lang.String PROXY_TITLE
           
static int[] SUPPORTS
           
 
Constructor Summary
StepperDevice(Master master, int deviceId)
          Creates a 'software' dc stepper device proxy with a given id.
 
Method Summary
 boolean getConfigurationAutoStop()
           
 int getConfigurationCurrent()
           
 boolean getConfigurationFastDecay()
           
 boolean getConfigurationHalfStep()
           
 boolean getConfigurationWaveDrive()
           
 int getCurrentSpeed()
          Returns the current set speed of a specific stepper.
 int getCurrentStepCount()
           
 boolean getPendingConfigurationAutoStop()
           
 int getPendingConfigurationCurrent()
           
 boolean getPendingConfigurationFastDecay()
           
 boolean getPendingConfigurationHalfStep()
           
 boolean getPendingConfigurationWaveDrive()
           
 int getPendingSpeed()
          Returns the speed of a specific stepper, which is currently underway to the device
 boolean getRequestGetConfigurationDone()
           
 boolean getRequestSetConfigurationDone()
          Checks if the configuration request is finished
 boolean getRequestSetSpeedDone()
          Checks if the speed set request is finished
 long getTimeOutUs()
          Returns the current set time out delay.
 void requestGetConfiguration()
           
 void requestGetState()
           
 void requestSetConfiguration(int current, boolean autoStop, boolean halfStep, boolean waveDrive, boolean fastDecay)
          Requests setting a new configuration
 void requestSetStepCount(int speed, int count)
          Requests the stepper device to set one of its steppers to a new speed
 void setTimeOutUs(int timeOutUs)
          Sets the time out value which is used to check if a request was acknowledged in the set time.
 
Methods inherited from class org.bluemelon.bluesense.Device
addDeviceEventListener, detect, getFirmwareVersion, getId, getType, getTypeName, isAccessible, removeDeviceEventListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_TITLE

public static final java.lang.String PROXY_TITLE

PROXY_ID

public static final int PROXY_ID

SUPPORTS

public static final int[] SUPPORTS
Constructor Detail

StepperDevice

public StepperDevice(Master master,
                     int deviceId)
Creates a 'software' dc stepper device proxy with a given id. The device will inacessible until a physical device with the same id is detected.

Parameters:
master -
deviceId -
Method Detail

requestSetStepCount

public void requestSetStepCount(int speed,
                                int count)
Requests the stepper device to set one of its steppers to a new speed

Parameters:
speed - an uint8_t representing the new speed of the stepper. Note that each speed is a value between -128 and 127. -128 to -1 represent a speed left, 0 stand still and 1 to 127 a speed right, the actual physical speed depends on the specifications of the connected stepper.
count - if this value is not -1, the stepper motor will step the given number of 'count' steps before stopping

requestGetState

public void requestGetState()

getCurrentStepCount

public int getCurrentStepCount()

getPendingSpeed

public int getPendingSpeed()
Returns the speed of a specific stepper, which is currently underway to the device

Returns:
the speed to be set on the stepper.

getRequestSetSpeedDone

public boolean getRequestSetSpeedDone()
Checks if the speed set request is finished

Returns:
1 if request finished, 0 if request still busy

getCurrentSpeed

public int getCurrentSpeed()
Returns the current set speed of a specific stepper.

Parameters:
port - one of the port pin values. @see bsStepper_p1
Returns:
the speed off the stepper.

requestSetConfiguration

public void requestSetConfiguration(int current,
                                    boolean autoStop,
                                    boolean halfStep,
                                    boolean waveDrive,
                                    boolean fastDecay)
Requests setting a new configuration

Parameters:
current - in mA between 0 and 1500 mA. Warning: a wrong value can damage your motor.
autoStop - stops the motor if a connected limit switch is closed
halfStep - true --> half steps, false --> full steps
waveDrive - true --> wave Drive on (noise reduction)
fastDecay - true --> fast decay mode, false --> normal decay mode (noise reduction)

requestGetConfiguration

public void requestGetConfiguration()

getRequestSetConfigurationDone

public boolean getRequestSetConfigurationDone()
Checks if the configuration request is finished

Returns:
1 if request finished, 0 if request still busy

getRequestGetConfigurationDone

public boolean getRequestGetConfigurationDone()

getPendingConfigurationCurrent

public int getPendingConfigurationCurrent()

getPendingConfigurationAutoStop

public boolean getPendingConfigurationAutoStop()

getPendingConfigurationHalfStep

public boolean getPendingConfigurationHalfStep()

getPendingConfigurationWaveDrive

public boolean getPendingConfigurationWaveDrive()

getPendingConfigurationFastDecay

public boolean getPendingConfigurationFastDecay()

getConfigurationCurrent

public int getConfigurationCurrent()

getConfigurationAutoStop

public boolean getConfigurationAutoStop()

getConfigurationHalfStep

public boolean getConfigurationHalfStep()

getConfigurationWaveDrive

public boolean getConfigurationWaveDrive()

getConfigurationFastDecay

public boolean getConfigurationFastDecay()

getTimeOutUs

public long getTimeOutUs()
Returns the current set time out delay. The time out delay is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Returns:
the time out value in microseconds.

setTimeOutUs

public void setTimeOutUs(int timeOutUs)
Sets the time out value which is used to check if a request was acknowledged in the set time. If an answer to a request is not received within the set time, the request is resent.

Parameters:
timeOutUs - the value in microseconds which is the maximum duraion between a request and its answer.