mirror of https://github.com/contiki-ng/mspsim
added firmware for esb demo
git-svn-id: https://mspsim.svn.sourceforge.net/svnroot/mspsim/mspsim@12 23d1a52b-0c3c-0410-b72d-8f29ab48fe35
This commit is contained in:
parent
2a874ea38c
commit
97fcbcea73
6
Makefile
6
Makefile
|
|
@ -53,6 +53,8 @@ CCARGS=-deprecation -classpath .
|
|||
###############################################################
|
||||
|
||||
FIRMWAREFILE = blinker2.ihex
|
||||
ESBFIRMWARE = firmware/esb/sensor-demo.firmware
|
||||
SKYFIRMWARE = firmware/sky/sensor-demo.firmware
|
||||
|
||||
CPUTEST := tests/cputest.firmware
|
||||
|
||||
|
|
@ -81,10 +83,10 @@ run: compile
|
|||
java se.sics.mspsim.util.IHexReader $(FIRMWAREFILE) $(MAPFILE)
|
||||
|
||||
runesb: compile
|
||||
java se.sics.mspsim.platform.esb.ESBNode $(FIRMWAREFILE) $(MAPFILE)
|
||||
java se.sics.mspsim.platform.esb.ESBNode $(ESBFIRMWARE) $(MAPFILE)
|
||||
|
||||
runsky: compile
|
||||
java se.sics.mspsim.platform.sky.SkyNode $(FIRMWAREFILE) $(MAPFILE)
|
||||
java se.sics.mspsim.platform.sky.SkyNode $(SKYFIRMWARE) $(MAPFILE)
|
||||
|
||||
.PHONY: cputest test
|
||||
test: cputest
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -136,7 +136,9 @@ public class IOPort extends IOUnit {
|
|||
// case IFG:
|
||||
if (interrupt > 0) {
|
||||
// IFG - writing a zero => clear the flag!
|
||||
System.out.println(getName() + " Clearing IFlag: " + data);
|
||||
if (DEBUG) {
|
||||
System.out.println(getName() + " Clearing IFlag: " + data);
|
||||
}
|
||||
interruptFlag &= data;
|
||||
memory[offset + IFG] = interruptFlag;
|
||||
cpu.flagInterrupt(interrupt, this, interruptFlag > 0);
|
||||
|
|
@ -169,14 +171,19 @@ public class IOPort extends IOUnit {
|
|||
// LO/HI transition
|
||||
if (state == PIN_HI) {
|
||||
interruptFlag |= bit;
|
||||
System.out.println(getName() + " Flagging interrupt (HI): " + bit);
|
||||
if (DEBUG) {
|
||||
System.out.println(getName() +
|
||||
" Flagging interrupt (HI): " + bit);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// HI/LO transition
|
||||
if (state == PIN_LOW) {
|
||||
interruptFlag |= bit;
|
||||
System.out.println(getName() + " Flagging interrupt (LOW): " +
|
||||
bit);
|
||||
if (DEBUG) {
|
||||
System.out.println(getName() +
|
||||
" Flagging interrupt (LOW): " + bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import java.awt.event.KeyEvent;
|
|||
import java.awt.event.KeyListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.event.MouseListener;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
|
|
@ -57,7 +58,8 @@ import se.sics.mspsim.util.SerialMon;
|
|||
import se.sics.mspsim.util.WindowUtils;
|
||||
|
||||
public class ESBGui extends JComponent implements KeyListener,
|
||||
MouseMotionListener {
|
||||
MouseMotionListener,
|
||||
MouseListener {
|
||||
|
||||
public static final int GREEN_X = 3;
|
||||
public static final int YELLOW_X = 10;
|
||||
|
|
@ -79,6 +81,7 @@ public class ESBGui extends JComponent implements KeyListener,
|
|||
private ImageIcon esbImage;
|
||||
private JFrame window;
|
||||
private ESBNode node;
|
||||
private boolean buttonDown = false;
|
||||
|
||||
public ESBGui(ESBNode node) {
|
||||
this.node = node;
|
||||
|
|
@ -103,6 +106,7 @@ public class ESBGui extends JComponent implements KeyListener,
|
|||
|
||||
window.addKeyListener(this);
|
||||
window.addMouseMotionListener(this);
|
||||
window.addMouseListener(this);
|
||||
|
||||
// Add some windows for listening to serial output
|
||||
MSP430 cpu = node.getCPU();
|
||||
|
|
@ -130,8 +134,25 @@ public class ESBGui extends JComponent implements KeyListener,
|
|||
node.setVIB(x > 60 && x < 100 && y > 180 && y < 200);
|
||||
}
|
||||
|
||||
public void mouseDragged(MouseEvent e) {
|
||||
public void mouseDragged(MouseEvent e) {}
|
||||
public void mouseClicked(MouseEvent e) {}
|
||||
public void mouseEntered(MouseEvent e) {}
|
||||
public void mouseExited(MouseEvent e) {}
|
||||
|
||||
// For the button sensor on the ESB nodes.
|
||||
public void mousePressed(MouseEvent e) {
|
||||
int x = e.getX();
|
||||
int y = e.getY();
|
||||
if (x > 0 && x < 24 && y > 180 && y < 200) {
|
||||
node.setButton(buttonDown = true);
|
||||
}
|
||||
}
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (buttonDown) {
|
||||
node.setButton(buttonDown = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void paintComponent(Graphics g) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue