|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.resources.Resource
com.sun.spot.resources.CompositeResource
com.sun.spot.resources.transducers.CompositeTransducer
com.sun.spot.sensorboard.EDemoBoard
public class EDemoBoard
This class reflects all of the functionality of the EDemoBoard to a SPOT application. The old methods bindServo() & bindToneGenerator() have been removed. Please now use "new Servo()" & "new ToneGenerator()" passing in the IOutputPin or IOPin that they should use. This is a facade class. All the real work is done in the EDemoController class.
| Field Summary | |
|---|---|
static int |
A0
A0 index for array returned by getScalarInputs() |
static int |
A1
A1 index for array returned by getScalarInputs() |
static int |
A2
A2 index for array returned by getScalarInputs() |
static int |
A3
A3 index for array returned by getScalarInputs() |
static int |
A4
A4 index for array returned by getScalarInputs() |
static int |
A5
A5 index for array returned by getScalarInputs() |
static int |
D0
D0 index for array returned by getIOPins() |
static int |
D1
D1 index for array returned by getIOPins() |
static int |
D2
D2 index for array returned by getIOPins() |
static int |
D3
D3 index for array returned by getIOPins() |
static int |
D4
D4 index for array returned by getIOPins() |
static int |
H0
H0 index for array returned by getOutputPins() |
static int |
H1
H1 index for array returned by getOutputPins() |
static int |
H2
H2 index for array returned by getOutputPins() |
static int |
H3
H3 index for array returned by getOutputPins() |
static int |
LED1
LED1 index for array returned by getLEDs() |
static int |
LED2
LED2 index for array returned by getLEDs() |
static int |
LED3
LED3 index for array returned by getLEDs() |
static int |
LED4
LED4 index for array returned by getLEDs() |
static int |
LED5
LED5 index for array returned by getLEDs() |
static int |
LED6
LED6 index for array returned by getLEDs() |
static int |
LED7
LED7 index for array returned by getLEDs() |
static int |
LED8
LED8 index for array returned by getLEDs() |
static String |
PART_ID
Identifier string for demoboard |
static String |
PART_ID2
|
static int |
SERIAL_DATABITS_5
|
static int |
SERIAL_DATABITS_6
|
static int |
SERIAL_DATABITS_7
|
static int |
SERIAL_DATABITS_8
|
static int |
SERIAL_PARITY_EVEN
|
static int |
SERIAL_PARITY_NONE
|
static int |
SERIAL_PARITY_ODD
|
static int |
SERIAL_SPEED_1200
|
static int |
SERIAL_SPEED_19200
|
static int |
SERIAL_SPEED_2400
|
static int |
SERIAL_SPEED_28800
|
static int |
SERIAL_SPEED_38400
|
static int |
SERIAL_SPEED_4800
|
static int |
SERIAL_SPEED_57600
|
static int |
SERIAL_SPEED_600
|
static int |
SERIAL_SPEED_9600
|
static int |
SERIAL_STOPBITS_1
|
static int |
SERIAL_STOPBITS_2
|
static int |
SW1
SW1 index for array returned by getSwitches() |
static int |
SW2
SW2 index for array returned by getSwitches() |
| Fields inherited from class com.sun.spot.resources.CompositeResource |
|---|
resources |
| Method Summary | |
|---|---|
void |
andRegister(int reg,
int val)
Perform an AND assignment to one of the registers in the Atmega88 controller. |
int |
availableUART()
Check if there are any available characters read by the UART. |
void |
closeUART()
Deactivate the UART module. |
IAccelerometer3D |
getAccelerometer()
Method to return the built in accelerometer. |
IADT7411 |
getADC()
Method to get an object that corresponds to the ADC on the EDemoBoard. |
ITemperatureInput |
getADCTemperature()
Method to get internal temperature sensor on the ADC from the EDemoBoard. |
IAnalogInput[] |
getAnalogInputs()
Method to return an array of the builtin analog input pins. |
EDemoController |
getEDemoController()
Return the underlying controller used by this EDemoBoard. |
int[] |
getFirmwareVersion()
Get the major and minor version information from the firmware running on the EDemoBoard. |
int |
getHardwareRevision()
Get the hardware revision number for the EDemoBoard. |
II2C |
getI2C()
Return the controller for the I2C. |
InfraRed |
getInfraRed()
Return the controller for InfraRed messages. |
static Properties |
getInitialProperties()
Get the correct set of properties for this board for its flash memory |
static EDemoBoard |
getInstance()
Return the global singleton for the EDemoBoard. |
IIOPin[] |
getIOPins()
Method to return an array of the built in bidirectional digital pins. |
ITriColorLED[] |
getLEDs()
Method that returns an array of all the built in LEDs. |
ILightSensor |
getLightSensor()
Method to return the built in light sensor object. |
IOutputPin[] |
getOutputPins()
Method to return an array of the built in high current output pins. |
Properties |
getProperties()
Get the properties of this board. |
int |
getPulse(IInputPin pin,
boolean dir,
int timeout)
Deprecated. please pass in a com.sun.spot.resources.transducers.IInputPin instead |
int |
getPulse(IInputPin pin,
boolean dir,
int timeout)
Ask the controller for a measurement of an incoming pulse on some input pin. |
int |
getRegister(int reg)
Peek method for the atmega firmware. |
IScalarInput[] |
getScalarInputs()
Method to return an array of the built in analog input pins. |
ISwitch[] |
getSwitches()
Method to return an array of all the built in switches on the board. |
void |
initUART(int baud,
boolean two_stopbit)
Initialize the UART module, set the speed and select the number of stop bits. |
void |
initUART(int baud,
int databits,
int parity,
int stopbits)
Initialize the UART module |
void |
orRegister(int reg,
int val)
Perform an OR assignment to one of the registers in the Atmega88 controller. |
byte |
readUART()
Get the next byte from the UART. |
int |
readUART(byte[] b,
int off,
int len)
Read the next byte from the UART plus any more currently available bytes. |
byte |
readUART(long timeout)
Get the next byte from the UART. |
void |
setPDM(IOutputPin pin,
int duty)
Request the controller maintain a Pulse-density modulation signal on a gpio pin. |
void |
setProperties(Properties p)
Set the properties of this board |
void |
setPWM(IOutputPin pin,
int duty)
Deprecated. please use setPDM() instead |
void |
setRegister(int reg,
int val)
Poke method for the Atmega88 controller, allows user to set low level registers on the part. |
void |
startPulse(IOutputPin pin,
boolean dir,
int usec)
Deprecated. please pass in a com.sun.spot.resources.transducers.IOutputPin instead |
void |
startPulse(IOutputPin pin,
boolean dir,
int usec)
Ask the controller to issue a pulse on the indicated pin. |
void |
writeUART(byte val)
Send a byte over the UART. |
void |
writeUART(byte[] msg)
Send a byte array over the UART. |
void |
writeUART(byte[] msg,
int off,
int len)
Writes len bytes from the specified byte array starting at offset off to the UART. |
void |
writeUART(String msg)
Send a string over the UART. |
| Methods inherited from class com.sun.spot.resources.transducers.CompositeTransducer |
|---|
add, remove |
| Methods inherited from class com.sun.spot.resources.CompositeResource |
|---|
add, internalAt, internalSize, lookup, lookup, lookup, lookup, lookup, lookupAll, lookupAll, lookupAll, lookupAll, lookupAll, remove |
| Methods inherited from class com.sun.spot.resources.Resource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.sun.spot.resources.transducers.ICompositeTransducer |
|---|
add, remove |
| Methods inherited from interface com.sun.spot.resources.ICompositeResource |
|---|
add, lookup, lookup, lookup, lookup, lookup, lookupAll, lookupAll, lookupAll, lookupAll, lookupAll, remove |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Field Detail |
|---|
public static final int SERIAL_SPEED_600
public static final int SERIAL_SPEED_1200
public static final int SERIAL_SPEED_2400
public static final int SERIAL_SPEED_4800
public static final int SERIAL_SPEED_9600
public static final int SERIAL_SPEED_19200
public static final int SERIAL_SPEED_28800
public static final int SERIAL_SPEED_38400
public static final int SERIAL_SPEED_57600
public static final int SERIAL_PARITY_NONE
public static final int SERIAL_PARITY_ODD
public static final int SERIAL_PARITY_EVEN
public static final int SERIAL_STOPBITS_1
public static final int SERIAL_STOPBITS_2
public static final int SERIAL_DATABITS_5
public static final int SERIAL_DATABITS_6
public static final int SERIAL_DATABITS_7
public static final int SERIAL_DATABITS_8
public static final int SW1
public static final int SW2
public static final int D0
public static final int D1
public static final int D2
public static final int D3
public static final int D4
public static final int H0
public static final int H1
public static final int H2
public static final int H3
public static final int A0
public static final int A1
public static final int A2
public static final int A3
public static final int A4
public static final int A5
public static final int LED1
public static final int LED2
public static final int LED3
public static final int LED4
public static final int LED5
public static final int LED6
public static final int LED7
public static final int LED8
public static final String PART_ID
public static final String PART_ID2
| Method Detail |
|---|
public static EDemoBoard getInstance()
public EDemoController getEDemoController()
public IADT7411 getADC()
public ITemperatureInput getADCTemperature()
getADCTemperature in interface IDemoBoardpublic ITriColorLED[] getLEDs()
getLEDs in interface IDemoBoardpublic ISwitch[] getSwitches()
getSwitches in interface IDemoBoardpublic ILightSensor getLightSensor()
getLightSensor in interface IDemoBoardpublic IAccelerometer3D getAccelerometer()
getAccelerometer in interface IDemoBoardpublic IIOPin[] getIOPins()
getIOPins in interface IDemoBoardpublic IOutputPin[] getOutputPins()
getOutputPins in interface IDemoBoardpublic IScalarInput[] getScalarInputs()
getScalarInputs in interface IDemoBoardpublic IAnalogInput[] getAnalogInputs()
getAnalogInputs in interface IDemoBoard
public void setPWM(IOutputPin pin,
int duty)
startPulse method.
Note: that the pdm signal will stop during deep sleep and resume
when deep sleep is over.
pin - output pin to send PDM signal toduty - duty cycle out of 255 slices
public void startPulse(IOutputPin pin,
boolean dir,
int usec)
pin - output pin to issue pulse ondir - direction of desired pulse: true = high, false = lowusec - length of pulse in microseconds [1:65535]
public int getPulse(IInputPin pin,
boolean dir,
int timeout)
pin - input pin to measure pulse ondir - direction of desired pulse: true = high, false = lowtimeout - how many milliseconds to wait for start of pulse (set to 0 for no timeout)
public void setPDM(IOutputPin pin,
int duty)
startPulse method.
Note: that the pdm signal will stop during deep sleep and resume
when deep sleep is over.
pin - output pin to send PDM signal toduty - duty cycle out of 255 slices
public void startPulse(IOutputPin pin,
boolean dir,
int usec)
pin - output pin to issue pulse ondir - direction of desired pulse: true = high, false = lowusec - length of pulse in microseconds [1:65535]
public int getPulse(IInputPin pin,
boolean dir,
int timeout)
pin - input pin to measure pulse ondir - direction of desired pulse: true = high, false = lowtimeout - how many milliseconds to wait for start of pulse (set to 0 for no timeout)
public void initUART(int baud,
boolean two_stopbit)
baud - baud speed to set module to, supported speeds are 2400, 4800, 9600, 19200, 28800, 38400 and 57600two_stopbit - set to true if you want the module setup to send 2 stop bits
public void initUART(int baud,
int databits,
int parity,
int stopbits)
baud - baud speed to set module to, supported speeds are 2400, 4800, 9600, 19200, 28800, 38400 and 57600databits - supported values are 5,6,7,8parity - supported options are none, odd, evenstopbits - supported options are 1 or 2public void closeUART()
public void writeUART(byte val)
val - the value to send over the uartpublic void writeUART(String msg)
msg - the string message to send over the uartpublic void writeUART(byte[] msg)
msg - the byte array message to send over the uart
public void writeUART(byte[] msg,
int off,
int len)
msg - the byte array message to send over the uartoff - the start offset in the datalen - the number of bytes to write
public byte readUART()
throws IOException
IOException - if any UART read or overrun errors
public int readUART(byte[] b,
int off,
int len)
throws IOException
b - byte array to store resultsoff - offset in byte array to store resultslen - maximum bytes to read
IOException - if any UART read or overrun errors
public byte readUART(long timeout)
throws IOException
timeout - how many milliseconds to wait for input
IOException - if any UART read or overrun errors
TimeoutException - if timeout occurs
public int availableUART()
throws IOException
Note that there are two buffers: one located on the eDemo sensor board that is filled directly by the UART, and a second in Java on the ARM processor board that is filled from the sensor board's buffer. Both buffers can hold 64 bytes. availableUART() returns the number of bytes in the Java-side buffer, unless it is empty, in which case it is refilled from the sensor board.
IOException - if any UART read or overrun errorspublic static Properties getInitialProperties()
public Properties getProperties()
public void setProperties(Properties p)
throws IOException
p - The properties to set.
IOExceptionpublic int[] getFirmwareVersion()
public int getHardwareRevision()
public II2C getI2C()
public InfraRed getInfraRed()
public void setRegister(int reg,
int val)
reg - Register to set value of, use only those defined statically by Atmega[88].javaval - value to set
public void orRegister(int reg,
int val)
reg - register to set value ofval - value to use in operation
public void andRegister(int reg,
int val)
reg - register to set value ofval - value to use in operationpublic int getRegister(int reg)
reg - Register to read value from
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||