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);
}
}