com.sentilla.platform.tmote
Class ExternUart

java.lang.Object
  extended by com.sentilla.platform.tmote.Action
      extended by com.sentilla.platform.tmote.ExternUart
All Implemented Interfaces:
com.sentilla.io.SynchronousSendRx, Action, Driver

public class ExternUart
extends Action
implements com.sentilla.io.SynchronousSendRx

Provides access to the Tmote's external UART (universal asynchronous receiver/transmitter).


Field Summary
protected  short baudrate
           
static byte Bits7EvenStop1
           
static byte Bits7EvenStop2
           
static byte Bits7NoneStop1
           
static byte Bits7NoneStop2
           
static byte Bits7OddStop1
           
static byte Bits7OddStop2
           
static byte Bits8EvenStop1
           
static byte Bits8EvenStop2
           
static byte Bits8NoneStop1
           
static byte Bits8NoneStop2
           
static byte Bits8OddStop1
           
static byte Bits8OddStop2
           
protected  byte[] buffer
           
protected  short bufsz
           
static byte CLOSE_OP
           
static byte DOWN
           
protected  short e_offset
           
protected  byte error
           
protected  int interbyte_wait
           
protected  byte modulation
           
protected  short num_waitchars
           
protected  byte op
           
static byte OPEN_OP
           
protected  byte portparams
           
protected  short s_offset
           
static byte STATUS_OP
           
static short UBR_4800Baud8Mhz
           
static byte UMCTL_4800Baud8Mhz
           
static byte UP
           
protected  int wait_period
           
static byte WRITE_OP
           
 
Fields inherited from class com.sentilla.platform.tmote.Action
actionAuto, actionId, actionState, isolateOwner
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
ExternUart()
          Constructor initializes a uart port.
 
Method Summary
 void close()
          Closes Uart.
 String getDriverName(int n)
          Returns the valid name(s) for each driver.
 Driver getNextDriver()
          Used by the Driver registry (Drivers) to get the next Driver in the linked list of drivers.
 void open()
           
 void open(short b, byte p, byte m)
          Opens a Uart with baudrate (UBR register) set to b and modulation (UMCTL register) set to m.
 void relay(com.sentilla.io.ByteBuffer buf, int outlen, int inlen)
          Stream a ByteBuffer on the uart port.
 void relay(com.sentilla.io.ByteBuffer buf, int outlen, int inlen, int t0, int t1)
          Stream a ByteBuffer on the uart port.
 void setNextDriver(Driver d)
          Used by the Driver registry (Drivers) to create a linked list of drivers.
 
Methods inherited from class com.sentilla.platform.tmote.Action
block, block, cancel, getActionState, initAction, isDone, lookup, submit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITE_OP

public static final byte WRITE_OP
See Also:
Constant Field Values

CLOSE_OP

public static final byte CLOSE_OP
See Also:
Constant Field Values

OPEN_OP

public static final byte OPEN_OP
See Also:
Constant Field Values

STATUS_OP

public static final byte STATUS_OP
See Also:
Constant Field Values

UP

public static final byte UP
See Also:
Constant Field Values

DOWN

public static final byte DOWN
See Also:
Constant Field Values

Bits7OddStop1

public static final byte Bits7OddStop1
See Also:
Constant Field Values

Bits7OddStop2

public static final byte Bits7OddStop2
See Also:
Constant Field Values

Bits7EvenStop1

public static final byte Bits7EvenStop1
See Also:
Constant Field Values

Bits7EvenStop2

public static final byte Bits7EvenStop2
See Also:
Constant Field Values

Bits8OddStop1

public static final byte Bits8OddStop1
See Also:
Constant Field Values

Bits8OddStop2

public static final byte Bits8OddStop2
See Also:
Constant Field Values

Bits8EvenStop1

public static final byte Bits8EvenStop1
See Also:
Constant Field Values

Bits8EvenStop2

public static final byte Bits8EvenStop2
See Also:
Constant Field Values

Bits7NoneStop1

public static final byte Bits7NoneStop1
See Also:
Constant Field Values

Bits7NoneStop2

public static final byte Bits7NoneStop2
See Also:
Constant Field Values

Bits8NoneStop1

public static final byte Bits8NoneStop1
See Also:
Constant Field Values

Bits8NoneStop2

public static final byte Bits8NoneStop2
See Also:
Constant Field Values

UBR_4800Baud8Mhz

public static final short UBR_4800Baud8Mhz
See Also:
Constant Field Values

UMCTL_4800Baud8Mhz

public static final byte UMCTL_4800Baud8Mhz
See Also:
Constant Field Values

op

protected byte op

error

protected byte error

s_offset

protected short s_offset

e_offset

protected short e_offset

buffer

protected byte[] buffer

interbyte_wait

protected int interbyte_wait

bufsz

protected short bufsz

wait_period

protected int wait_period

num_waitchars

protected short num_waitchars

baudrate

protected short baudrate

portparams

protected byte portparams

modulation

protected byte modulation
Constructor Detail

ExternUart

public ExternUart()
Constructor initializes a uart port. On the Tmote platform this port shares its i/o pins with the radio.

Method Detail

open

public void open()
          throws com.sentilla.io.IORuntimeException
Throws:
com.sentilla.io.IORuntimeException

open

public void open(short b,
                 byte p,
                 byte m)
          throws com.sentilla.io.IORuntimeException
Opens a Uart with baudrate (UBR register) set to b and modulation (UMCTL register) set to m. The data length, parity, and stop bits are set according to portparms p.

Throws:
com.sentilla.io.IORuntimeException

close

public void close()
           throws com.sentilla.io.IORuntimeException
Closes Uart.

Throws:
com.sentilla.io.IORuntimeException

relay

public void relay(com.sentilla.io.ByteBuffer buf,
                  int outlen,
                  int inlen)
           throws com.sentilla.io.IORuntimeException
Stream a ByteBuffer on the uart port. A number (outlen) of bytes is output from the ByteBuffer buf. Immediately following the output sequence, a number of bytes (inlen) is input to the ByteBuffer buf.

Specified by:
relay in interface com.sentilla.io.SynchronousSendRx
Throws:
com.sentilla.io.IORuntimeException

relay

public void relay(com.sentilla.io.ByteBuffer buf,
                  int outlen,
                  int inlen,
                  int t0,
                  int t1)
           throws com.sentilla.io.IORuntimeException
Stream a ByteBuffer on the uart port. Same as 3 parameter method. Two additional timeout parameters t0 and t1. The stream is terminated upon timeout.

Parameters:
t0 - number of 32 KHz cycles to wait for the reception of the first byte.
t1 - number of 32 Khz cycles to wait between byte reception, i.e. interbyte timeout.
Throws:
com.sentilla.io.IORuntimeException

getDriverName

public String getDriverName(int n)
Description copied from interface: Driver
Returns the valid name(s) for each driver. If a driver has N-names, then getDriverName returns a string for n=0 to n=N-1, and returns null for all other values of n.

A driver may return multiple names because it provides the default implementation for a specific name, such as associating "flash" by default to the external flash, or "extflash" if an application specifically asserts it requires the external flash resources. Some drivers may return only a single valid name, such as "intflash" for the internal flash.

Specified by:
getDriverName in interface Driver

setNextDriver

public void setNextDriver(Driver d)
Description copied from interface: Driver
Used by the Driver registry (Drivers) to create a linked list of drivers.

Specified by:
setNextDriver in interface Driver
Parameters:
d - A reference to the next driver in the list of registered drivers
See Also:
Drivers

getNextDriver

public Driver getNextDriver()
Description copied from interface: Driver
Used by the Driver registry (Drivers) to get the next Driver in the linked list of drivers.

Specified by:
getNextDriver in interface Driver
Returns:
An instance of the next driver, or null if the end of the list is reached
See Also:
Drivers


Copyright © 2007 Sentilla Corporation. All Rights Reserved.