Updated for new listener API in MSPSim
This commit is contained in:
parent
26e7698d32
commit
7628652a9d
8 changed files with 12 additions and 11 deletions
|
@ -481,7 +481,7 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
|||
String name = mapEntry.getName();
|
||||
return file + ":?:" + name;
|
||||
}
|
||||
return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
|
||||
return String.format("*%02x", pc);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ public class ESBLED extends LED implements PortListener {
|
|||
/* Listen for port writes */
|
||||
IOUnit unit = this.mote.getCPU().getIOUnit("Port 2");
|
||||
if (unit instanceof IOPort) {
|
||||
((IOPort) unit).setPortListener(this);
|
||||
((IOPort) unit).addPortListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class Exp5438LED extends LED {
|
|||
|
||||
IOUnit unit = mspMote.getCPU().getIOUnit("P1");
|
||||
if (unit instanceof IOPort) {
|
||||
((IOPort) unit).setPortListener(new PortListener() {
|
||||
((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;
|
||||
|
|
|
@ -73,7 +73,7 @@ public class MspSerial extends SerialUI implements SerialPort {
|
|||
IOUnit ioUnit = this.mote.getCPU().getIOUnit(ioConfigString());
|
||||
if (ioUnit instanceof USARTSource) {
|
||||
usart = (USARTSource) ioUnit;
|
||||
usart.setUSARTListener(new USARTListener() {
|
||||
usart.addUSARTListener(new USARTListener() {
|
||||
public void dataReceived(USARTSource source, int data) {
|
||||
MspSerial.this.dataReceived(data);
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import se.sics.cooja.interfaces.Radio;
|
|||
import se.sics.cooja.mspmote.MspMote;
|
||||
import se.sics.cooja.mspmote.MspMoteTimeEvent;
|
||||
import se.sics.mspsim.chip.CC2420;
|
||||
import se.sics.mspsim.chip.ChannelListener;
|
||||
import se.sics.mspsim.chip.RFListener;
|
||||
import se.sics.mspsim.core.Chip;
|
||||
import se.sics.mspsim.core.OperatingModeListener;
|
||||
|
@ -89,7 +90,7 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
|
|||
throw new IllegalStateException("Mote is not equipped with a CC2420");
|
||||
}
|
||||
|
||||
cc2420.setRFListener(new RFListener() {
|
||||
cc2420.addRFListener(new RFListener() {
|
||||
int len = 0;
|
||||
int expLen = 0;
|
||||
byte[] buffer = new byte[127 + 15];
|
||||
|
@ -158,8 +159,8 @@ public class SkyByteRadio extends Radio implements CustomDataRadio {
|
|||
}
|
||||
});
|
||||
|
||||
cc2420.setChannelListener(new CC2420.ChannelListener() {
|
||||
public void changedChannel(int channel) {
|
||||
cc2420.addChannelListener(new ChannelListener() {
|
||||
public void channelChanged(int channel) {
|
||||
/* XXX Currently assumes zero channel switch time */
|
||||
lastEvent = RadioEvent.UNKNOWN;
|
||||
lastEventTime = SkyByteRadio.this.mote.getSimulation().getSimulationTime();
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SkyLED extends LED {
|
|||
|
||||
IOUnit unit = mspMote.getCPU().getIOUnit("Port 5");
|
||||
if (unit instanceof IOPort) {
|
||||
((IOPort) unit).setPortListener(new PortListener() {
|
||||
((IOPort) unit).addPortListener(new PortListener() {
|
||||
public void portWrite(IOPort source, int data) {
|
||||
blueOn = (data & SkyNode.BLUE_LED) == 0;
|
||||
greenOn = (data & SkyNode.GREEN_LED) == 0;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class TR1001Radio extends Radio implements USARTListener, CustomDataRadio
|
|||
IOUnit usart = this.mote.getCPU().getIOUnit("USART 0");
|
||||
if (usart != null && usart instanceof USART) {
|
||||
radioUSART = (USART) usart;
|
||||
radioUSART.setUSARTListener(this);
|
||||
radioUSART.addUSARTListener(this);
|
||||
} else {
|
||||
throw new RuntimeException("Bad TR1001 IO: " + usart);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TyndallLED extends LED {
|
|||
|
||||
IOUnit unit = mspMote.getCPU().getIOUnit("P7");
|
||||
if (unit instanceof IOPort) {
|
||||
((IOPort) unit).setPortListener(new PortListener() {
|
||||
((IOPort) unit).addPortListener(new PortListener() {
|
||||
public void portWrite(IOPort source, int data) {
|
||||
redOn = (data & TyndallNode.LEDS_CONF_RED) == 0;
|
||||
setChanged();
|
||||
|
@ -83,7 +83,7 @@ public class TyndallLED extends LED {
|
|||
}
|
||||
unit = mspMote.getCPU().getIOUnit("P8");
|
||||
if (unit instanceof IOPort) {
|
||||
((IOPort) unit).setPortListener(new PortListener() {
|
||||
((IOPort) unit).addPortListener(new PortListener() {
|
||||
public void portWrite(IOPort source, int data) {
|
||||
greenOn = (data & TyndallNode.LEDS_CONF_GREEN) == 0;
|
||||
setChanged();
|
||||
|
|
Loading…
Reference in a new issue