cork.device.control
Class MillisecondPWM

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--cork.device.control.MillisecondPWM
All Implemented Interfaces:
Device, java.lang.Runnable

public class MillisecondPWM
extends java.lang.Thread
implements Device

PWM generator in teh millisecond range. This class is most useful for DC motors and H-Bridges where the longer pulse length is all that is needed.

Version:
0.1.0
Author:
Brill Pappin

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MillisecondPWM(com.ajile.drivers.gpio.GpioPin pin)
          Constructor for the MillisecondPWM object.
MillisecondPWM(com.ajile.drivers.gpio.GpioPin pin, int high, int low)
          Constructor for the PWM object taht alows pre-setting of the pulse width.
 
Method Summary
 void destroy()
          called to destroy the object and release it's pin.
 java.lang.String getDeviceDestription()
          Gets the destription attribute of the Device object
 java.lang.String getDeviceName()
          Gets the title attribute of the Device object
 int getHighPulseWidth()
          Gets the high pulse width attribute in milliseconds.
 int getLowPulseWidth()
          Gets the low pulse width attribute in milliseconds.
 com.ajile.drivers.gpio.GpioPin getPin()
          Gets the pin attribute of the PWM object
 void run()
          Main processing method for the PWM object
 void setHighPulseWidth(int width)
          Sets the high pulse width attribute in milliseconds.
 void setLowPulseWidth(int width)
          Sets the low pulse width attribute in milliseconds.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MillisecondPWM

public MillisecondPWM(com.ajile.drivers.gpio.GpioPin pin,
                      int high,
                      int low)
Constructor for the PWM object taht alows pre-setting of the pulse width.
Parameters:
pin - com.ajile.drivers.gpio.GpioPin the pin to send the pulse on.
high - int the amount of time in milliseconds that the pin will be high.
low - int the amount of time in milliseconds that the pin will be low.
Since:
 

MillisecondPWM

public MillisecondPWM(com.ajile.drivers.gpio.GpioPin pin)
Constructor for the MillisecondPWM object. The pulse width will default to 0 (i.e. no pulse). you must set teh high and low times to something greater than 0 before the generator will send any pulses.
Parameters:
pin - com.ajile.drivers.gpio.GpioPin the pin to send the pulse on.
Since:
 
Method Detail

run

public void run()
Main processing method for the PWM object
Overrides:
run in class java.lang.Thread
Since:
 

destroy

public void destroy()
called to destroy the object and release it's pin.
Overrides:
destroy in class java.lang.Thread
Since:
0.1.0

getDeviceName

public java.lang.String getDeviceName()
Gets the title attribute of the Device object
Specified by:
getDeviceName in interface Device
Returns:
The title value
Since:
0.1.0

getDeviceDestription

public java.lang.String getDeviceDestription()
Gets the destription attribute of the Device object
Specified by:
getDeviceDestription in interface Device
Returns:
The destription value
Since:
0.1.0

getHighPulseWidth

public int getHighPulseWidth()
Gets the high pulse width attribute in milliseconds.
Returns:
int high pulse width.
Since:
0.1.0

getLowPulseWidth

public int getLowPulseWidth()
Gets the low pulse width attribute in milliseconds.
Returns:
int low pulse width.
Since:
0.1.0

getPin

public com.ajile.drivers.gpio.GpioPin getPin()
Gets the pin attribute of the PWM object
Returns:
com.ajile.drivers.gpio.GpioPin The GPIO pin
Since:
0.1.0

setHighPulseWidth

public void setHighPulseWidth(int width)
Sets the high pulse width attribute in milliseconds.
Parameters:
width - int high pulse width.
Since:
0.1.0

setLowPulseWidth

public void setLowPulseWidth(int width)
Sets the low pulse width attribute in milliseconds.
Parameters:
width - int low pulse width.
Since:
0.1.0