avrora.sim.platform
Class LED

java.lang.Object
  extended byavrora.sim.mcu.Microcontroller.OutputPin
      extended byavrora.sim.platform.LED
All Implemented Interfaces:
Microcontroller.Pin.Output

public class LED
extends Microcontroller.OutputPin

The LED class implements an LED (light emitting diode) that can be hooked up to a pin on the microcontroller. The LED prints its state when it is initialized and each time it is turned on or off.


Field Summary
protected  java.lang.String color
           
protected  int colornum
           
protected  avrora.sim.platform.LED.LEDProbe probe
           
protected  Simulator sim
           
protected  FiniteStateMachine state
           
 
Constructor Summary
protected LED(Simulator s, int n, java.lang.String c)
           
 
Method Summary
 void disablePrinting()
           
 void enablePrinting()
           
 FiniteStateMachine getFSM()
          The getFSM() method returns the FiniteStateMachine instance corresponding to this LED.
 void write(boolean level)
          The write() method is called by the simulator when the program writes a logical level to the pin.
 
Methods inherited from class avrora.sim.mcu.Microcontroller.OutputPin
disableOutput, enableOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sim

protected Simulator sim

colornum

protected final int colornum

color

protected final java.lang.String color

state

protected final FiniteStateMachine state

probe

protected final avrora.sim.platform.LED.LEDProbe probe
Constructor Detail

LED

protected LED(Simulator s,
              int n,
              java.lang.String c)
Method Detail

write

public void write(boolean level)
Description copied from interface: Microcontroller.Pin.Output
The write() method is called by the simulator when the program writes a logical level to the pin. The device can then take the appropriate action.

Parameters:
level - a boolean representing the logical level of the write

enablePrinting

public void enablePrinting()

disablePrinting

public void disablePrinting()

getFSM

public FiniteStateMachine getFSM()
The getFSM() method returns the FiniteStateMachine instance corresponding to this LED. This finite state machine representation allows probes to be inserted that are notified when the state of the LED is changed.

Returns:
an instance of the FiniteStateMachine class for this LED instance