|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.sensorboard.io.ScalarInput
public class ScalarInput
Simple concrete implementation of IScalarInput.
| Field Summary | |
|---|---|
protected PinDescriptor |
index
|
protected IADCController |
myController
|
protected int |
range
|
| Constructor Summary | |
|---|---|
ScalarInput(PinDescriptor idx,
int r,
IADCController cntrl)
|
|
| Method Summary | |
|---|---|
void |
addIScalarInputThresholdListener(IScalarInputThresholdListener who)
Adds the specified scalar input threshold listener to receive callbacks from this input device. |
boolean |
areThresholdEventsEnabled()
Return whether threshold events are enabled or not. |
void |
enableThresholdEvents(boolean enable)
Enable or disable threshold events. |
int |
getHighThreshold()
Return the current high threshold value. |
PinDescriptor |
getIndex()
Return the PinDescriptor associated with this input pin. |
IScalarInputThresholdListener[] |
getIScalarInputThresholdListeners()
Returns an array of all the scalar input threshold listeners registered on this input device. |
int |
getLowThreshold()
Return the current low threshold value. |
int |
getRange()
Return the maximum possible value that could be returned from the input device. |
int |
getValue()
Return the current value of the input. |
float |
getVoltage()
Get the ADC value in voltage |
void |
removeIScalarInputThresholdListener(IScalarInputThresholdListener who)
Removes the specified scalar input threshold listener so that it no longer receives callbacks from this input device. |
void |
setThresholds(int low,
int high)
Set the low and high threshold values for this scalar input. |
boolean |
supportsThresholdEvents()
Returns whether the underlying hardware supports threshold events. |
void |
thresholdChanged(int low,
int high)
Called by pin's IADCController when pin threshold values are exceeded. |
void |
thresholdExceeded(int val)
Callback from EDemoBoard interrupt handler for threshold event. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected PinDescriptor index
protected int range
protected IADCController myController
| Constructor Detail |
|---|
public ScalarInput(PinDescriptor idx,
int r,
IADCController cntrl)
| Method Detail |
|---|
public PinDescriptor getIndex()
getIndex in interface IScalarInput
public int getRange()
throws IOException
getRange in interface IScalarInputIOExceptionpublic int getValue()
getValue in interface IScalarInputIOExceptionpublic float getVoltage()
public boolean supportsThresholdEvents()
supportsThresholdEvents in interface IScalarInputpublic void addIScalarInputThresholdListener(IScalarInputThresholdListener who)
addIScalarInputThresholdListener in interface IScalarInputwho - the scalar input threshold listener to add.public void removeIScalarInputThresholdListener(IScalarInputThresholdListener who)
removeIScalarInputThresholdListener in interface IScalarInputwho - the scalar input threshold listener to remove.public IScalarInputThresholdListener[] getIScalarInputThresholdListeners()
getIScalarInputThresholdListeners in interface IScalarInputpublic void enableThresholdEvents(boolean enable)
enableThresholdEvents in interface IScalarInputenable - if true then listeners will be notified if the scalar input
reading goes above the high threshold or below the low threshold.public boolean areThresholdEventsEnabled()
areThresholdEventsEnabled in interface IScalarInput
public void setThresholds(int low,
int high)
setThresholds in interface IScalarInputlow - the new low threshold value.high - the new high threshold value.
public void thresholdChanged(int low,
int high)
low - the new low threshold value.high - the new high threshold value.public int getLowThreshold()
getLowThreshold in interface IScalarInputpublic int getHighThreshold()
getHighThreshold in interface IScalarInputpublic void thresholdExceeded(int val)
val - scalar value taken after event triggered
|
SunSPOT API V4.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||