Package se.sics.mspsim.core

Examples of se.sics.mspsim.core.IOUnit


  private static final Color DARK_GREEN = new Color(0,100,0);

  public TyndallLED(Mote mote) {
    mspMote = (TyndallMote) mote;

    IOUnit unit = mspMote.getCPU().getIOUnit("P7");
    if (unit instanceof IOPort) {
      ((IOPort) unit).addPortListener(new PortListener() {
        public void portWrite(IOPort source, int data) {
          redOn = (data & TyndallNode.LEDS_CONF_RED) == 0;
          setChanged();
View Full Code Here


  private static final Color DARK_BLUE = new Color(0, 0, 100);

  public TrxebLEDs(Mote mote) {
    mspMote = (Exp5438Mote) mote;

    IOUnit unit = mspMote.getCPU().getIOUnit("P4");
    if (unit instanceof IOPort) {
      ((IOPort) unit).addPortListener(new PortListener() {
        public void portWrite(IOPort source, int data) {
          redOn = (data & (1<<0)) == 0;
          yellowOn = (data & (1<<1)) == 0;
View Full Code Here

   */
  public TR1001Radio(Mote mote) {
    this.mote = (MspMote) mote;

    /* Start listening to CPU's USART */
    IOUnit usart = this.mote.getCPU().getIOUnit("USART 0");
    if (usart != null && usart instanceof USART) {
      radioUSART = (USART) usart;
      radioUSART.addUSARTListener(this);
    } else {
      throw new RuntimeException("Bad TR1001 IO: " + usart);
View Full Code Here

  private static final Color DARK_YELLOW = new Color(184,134,11);

  public Exp5438LED(Mote mote) {
    mspMote = (Exp5438Mote) mote;

    IOUnit unit = mspMote.getCPU().getIOUnit("P1");
    if (unit instanceof IOPort) {
      ((IOPort) unit).addPortListener(new PortListener() {
        public void portWrite(IOPort source, int data) {
          redOn = (data & Exp5438Node.LEDS_CONF_RED) != 0;
          yellowOn = (data & Exp5438Node.LEDS_CONF_YELLOW) != 0;
View Full Code Here

  private static final Color RED = new Color(255, 0, 0);

  public SkyLED(Mote mote) {
    mspMote = (SkyMote) mote;

    IOUnit unit = mspMote.getCPU().getIOUnit("Port 5");
    if (unit instanceof IOPort) {
      ((IOPort) unit).addPortListener(new PortListener() {
        public void portWrite(IOPort source, int data) {
          blueOn = (data & SkyNode.BLUE_LED) == 0;
          greenOn = (data & SkyNode.GREEN_LED) == 0;
View Full Code Here

        cpu.getIOUnit(IOPort.class, "P3").addPortListener(this);
        cpu.getIOUnit(IOPort.class, "P4").addPortListener(this);
        cpu.getIOUnit(IOPort.class, "P5").addPortListener(this);
        cpu.getIOUnit(IOPort.class, "P8").addPortListener(this);

        IOUnit usart0 = cpu.getIOUnit("USCI B0");
        if (usart0 instanceof USARTSource) {

            radio = new CC2520(cpu);
            radio.setGPIO(1, port1, CC2520_FIFO);
            radio.setGPIO(3, port1, CC2520_CCA);
            radio.setGPIO(2, port1, CC2520_FIFOP);
            radio.setGPIO(4, port2, CC2520_SFD);

            ((USARTSource) usart0).addUSARTListener(this);
        } else {
            throw new EmulationException("Could not setup wismote mote - missing USCI B0");
        }
        leds = new Leds(cpu, LEDS);
        button = new Button("Button", cpu, port1, BUTTON_PIN, true);

        IOUnit usart = cpu.getIOUnit("USCI A1");
        if (usart instanceof USARTSource) {
            registry.registerComponent("serialio", usart);
        }
    }
View Full Code Here

        if (!config.getPropertyAsBoolean("nogui", true)) {
            setupGUI();

            // Add some windows for listening to serial output
            IOUnit usart = cpu.getIOUnit("USCI A1");
            if (usart instanceof USARTSource) {
                SerialMon serial = new SerialMon((USARTSource)usart, "USCI A1 Port Output");
                registry.registerComponent("serialgui", serial);
            }
        }
View Full Code Here

        port7 = cpu.getIOUnit(IOPort.class, "P7");
        port7.addPortListener(this);
        port8 = cpu.getIOUnit(IOPort.class, "P8");
        port8.addPortListener(this);

        IOUnit usart0 = cpu.getIOUnit("USCI B0");
        if (usart0 instanceof USARTSource) {
            radio = new CC2420(cpu);
            radio.setCCAPort(port8, CC2420_CCA);
            radio.setFIFOPPort(port8, CC2420_FIFOP);
            radio.setFIFOPort(port8, CC2420_FIFO);

            ((USARTSource) usart0).addUSARTListener(this);
            radio.setSFDPort(port8, CC2420_SFD);
        } else {
            throw new EmulationException("Could not setup tyndall mote - missing USCI B0");
        }

        IOUnit usart = cpu.getIOUnit("USCI A0");
        if (usart instanceof USARTSource) {
            registry.registerComponent("serialio", usart);
        }
    }
View Full Code Here

        if (!config.getPropertyAsBoolean("nogui", true)) {
            setupGUI();

            // Add some windows for listening to serial output
            IOUnit usart = cpu.getIOUnit("USCI A0");
            if (usart instanceof USARTSource) {
                SerialMon serial = new SerialMon((USARTSource)usart, "USCI A0 Port Output");
                registry.registerComponent("serialgui", serial);
            }
        }
View Full Code Here

        port7 = cpu.getIOUnit(IOPort.class, "P7");
        port7.addPortListener(this);
        port8 = cpu.getIOUnit(IOPort.class, "P8");
        port8.addPortListener(this);

        IOUnit usart0 = cpu.getIOUnit("USCI B0");
        if (usart0 instanceof USARTSource) {
            radio = new CC2420(cpu);
            radio.setCCAPort(port1, CC2420_CCA);
            radio.setFIFOPPort(port1, CC2420_FIFOP);
            radio.setFIFOPort(port1, CC2420_FIFO);

            ((USARTSource) usart0).addUSARTListener(this);
            radio.setSFDPort(port1, CC2420_SFD);
        } else {
            throw new EmulationException("Could not setup exp5438 mote - missing USCI B0");
        }

        IOUnit usart = cpu.getIOUnit("USCI A1");
        if (usart instanceof USARTSource) {
            registry.registerComponent("serialio", usart);
        }
    }
View Full Code Here

TOP

Related Classes of se.sics.mspsim.core.IOUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.