Finally it looks right
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -3,5 +3,6 @@
|
||||
"java.project.outputPath": "bin",
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar"
|
||||
]
|
||||
],
|
||||
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m"
|
||||
}
|
||||
|
||||
BIN
bin/Backend/InterruptHandling/InterruptServiceHandler.class
Normal file
BIN
bin/Backend/InterruptHandling/InterruptServiceHandler.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12
src/Backend/InterruptHandling/InterruptServiceHandler.java
Normal file
12
src/Backend/InterruptHandling/InterruptServiceHandler.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package Backend.InterruptHandling;
|
||||
|
||||
public class InterruptServiceHandler extends Thread {
|
||||
|
||||
public InterruptServiceHandler() {}
|
||||
|
||||
public void run() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package Backend.InterruptHandling;
|
||||
|
||||
/**
|
||||
* Class contains methods which calls a method to an overhanded value.
|
||||
*/
|
||||
public class InterruptServiceHandlingTable {
|
||||
|
||||
private final int ISR_TMR0_OVERFLOW = 1; //tmr0 overflow interrupt
|
||||
private final int INT_RB0 = 2; //External interrupt over int/rb0-pin
|
||||
private final int RB4 = 3; //PortB change interrupts
|
||||
private final int RB5 = 4; //PortB change interrupts
|
||||
private final int RB6 = 5; //PortB change interrupts
|
||||
private final int RB7 = 6; //PortB change interrupts
|
||||
private final int EEPROM_DATA_WRITE = 7;
|
||||
|
||||
public InterruptServiceHandlingTable() {}
|
||||
|
||||
|
||||
}
|
||||
@@ -8,8 +8,7 @@ package Backend.Microcontroller;
|
||||
/**
|
||||
* Microcontrollerclass that contains all other partclasses
|
||||
*/
|
||||
public class PIC
|
||||
{
|
||||
public class PIC {
|
||||
/**
|
||||
* Parts of PIC.
|
||||
* Objects are written with a large starting letter.
|
||||
@@ -19,8 +18,7 @@ public class PIC
|
||||
private STACK Stack;
|
||||
private int WRegister;
|
||||
|
||||
public PIC()
|
||||
{
|
||||
public PIC() {
|
||||
//Initialising objects of PIC.
|
||||
Eeprom = new EEPROM();
|
||||
Ram = new RAM();
|
||||
@@ -28,7 +26,7 @@ public class PIC
|
||||
WRegister = 0;
|
||||
}
|
||||
|
||||
public void resetPIC()
|
||||
public synchronized void resetPIC()
|
||||
{
|
||||
Ram = new RAM();
|
||||
Stack = new STACK();
|
||||
@@ -61,25 +59,25 @@ public class PIC
|
||||
int bitMaskClearBitArray[] = { bitMaskClearBit0, bitMaskClearBit1, bitMaskClearBit2, bitMaskClearBit3, bitMaskClearBit4, bitMaskClearBit5,
|
||||
bitMaskClearBit6, bitMaskClearBit7};
|
||||
|
||||
public void setWRegister(int value)
|
||||
public synchronized void setWRegister(int value)
|
||||
{
|
||||
WRegister = value;
|
||||
}
|
||||
|
||||
public int get_WRegister()
|
||||
public synchronized int get_WRegister()
|
||||
{
|
||||
return WRegister;
|
||||
}
|
||||
|
||||
public RAM getRam() {
|
||||
public synchronized RAM getRam() {
|
||||
return Ram;
|
||||
}
|
||||
|
||||
public EEPROM getEeprom() {
|
||||
public synchronized EEPROM getEeprom() {
|
||||
return Eeprom;
|
||||
}
|
||||
|
||||
public STACK getStack() {
|
||||
public synchronized STACK getStack() {
|
||||
return Stack;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,14 @@
|
||||
package Frontend.PIC_SIMULATOR_GUI_JAVA;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Insets;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
@@ -24,13 +27,11 @@ public class GUIMainFrame extends JFrame {
|
||||
this.setTitle("PIC-Simulator GUI"); // sets title of frame
|
||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // if x is pressed, exit application (HIDE_ON_CLOSE-hides application, DO_NOTHING_ON_CLOSE-prevents user from closing application)
|
||||
//this.setResizable(false); // prevent frame from beeing resized
|
||||
this.setSize(1200, 840); //sets x and y dimension of frame
|
||||
this.setSize(1400, 800); //sets x and y dimension of frame
|
||||
//this.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
oGUITestFileTable = new GUITestFileTable();
|
||||
|
||||
this.setJMenuBar(new GUIMenuBar(env, this, oGUITestFileTable));
|
||||
|
||||
this.setVisible(true); //make frame visible
|
||||
this.setBackground(new Color(76, 78, 82));
|
||||
ImageIcon guiLogo = new ImageIcon("./images/gui_logo.png"); // create an ImageIcon
|
||||
@@ -50,7 +51,7 @@ public class GUIMainFrame extends JFrame {
|
||||
//text.setBackground(Color.BLUE); // set background color
|
||||
//text.setOpaque(true); // display background color
|
||||
|
||||
Border border = BorderFactory.createLineBorder(Color.green, 3); // creates border for label, color and size of border
|
||||
//Border border = BorderFactory.createLineBorder(Color.green, 3); // creates border for label, color and size of border
|
||||
|
||||
//text.setBorder(border); // sets border of label to "border"
|
||||
//text.setVerticalAlignment(JLabel.TOP); // vertically alligns label "text" (JLabel.TOP, JLabel.CENTER, JLabel.BOTTOM)
|
||||
@@ -60,13 +61,11 @@ public class GUIMainFrame extends JFrame {
|
||||
|
||||
//getContentPane().setLayout(new BorderLayout());
|
||||
//this.add(new GUITestFileTable("./testfiles/TPicSim1.LST"));
|
||||
GridBagConstraints oGridBagConstraints = new GridBagConstraints();
|
||||
oGridBagConstraints.gridx = 10;
|
||||
oGridBagConstraints.gridy = 10;
|
||||
oGridBagConstraints.gridheight = 10;
|
||||
oGridBagConstraints.gridwidth = 500;
|
||||
oGridBagConstraints.anchor = GridBagConstraints.PAGE_START;
|
||||
this.add(oGUITestFileTable, oGridBagConstraints);
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0; //next added element will be in column 1
|
||||
c.gridy = 0; //next added element will be in row 1
|
||||
c.insets = new Insets(1,1,1,1);
|
||||
this.add(oGUITestFileTable, c);
|
||||
updateWindow();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.awt.Dimension;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import java.awt.Insets;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
public class GUITestFileTable extends JPanel {
|
||||
@@ -22,64 +23,77 @@ public class GUITestFileTable extends JPanel {
|
||||
ArrayList<JCheckBox> oCheckboxes = new ArrayList<JCheckBox>();
|
||||
|
||||
public GUITestFileTable() {
|
||||
this.setLayout(new GridBagLayout());
|
||||
GridBagConstraints oGridBagConstraints = new GridBagConstraints();
|
||||
oGridBagConstraints.gridx = 0;
|
||||
oGridBagConstraints.gridy = 0;
|
||||
oGridBagConstraints.gridheight = 20;
|
||||
oGridBagConstraints.gridwidth = 20; //500, 10, 10, 480
|
||||
JTextField oFill = new JTextField("19");
|
||||
oFill.setEditable(false);
|
||||
this.add(oFill, oGridBagConstraints);
|
||||
oGridBagConstraints.gridx = 20;
|
||||
this.add(new JCheckBox(), oGridBagConstraints);
|
||||
oGridBagConstraints.gridx = 40;
|
||||
oGridBagConstraints.gridwidth = 460;
|
||||
this.setLayout(new GridLayout(1, 3));
|
||||
this.add(oFill);
|
||||
this.add(new JCheckBox());
|
||||
oFill = new JTextField("Test");
|
||||
oFill.setEditable(false);
|
||||
this.add(oFill, oGridBagConstraints);
|
||||
this.add(oFill);
|
||||
}
|
||||
|
||||
public void setData(ArrayList<String> data) {
|
||||
this.removeAll();
|
||||
|
||||
JScrollBar oScrollBar = new JScrollBar(JScrollBar.VERTICAL, 30, 1, 0, 100);
|
||||
int iNumberOfLines = data.size() + 1;
|
||||
JPanel oLines = new JPanel();
|
||||
oLines.add(oScrollBar);//TODO
|
||||
oLines.setLayout(new GridBagLayout());
|
||||
int iHorizontalCount = 0;
|
||||
int iVerticalCount = 0;
|
||||
System.out.println(1);
|
||||
GridBagConstraints l = new GridBagConstraints();
|
||||
l.gridx = iHorizontalCount;
|
||||
|
||||
this.setLayout(new GridBagLayout());
|
||||
|
||||
JPanel oLineNumbers = new JPanel();
|
||||
oLineNumbers.setLayout(new GridLayout(iNumberOfLines, 1));
|
||||
GridBagConstraints oGridBagConstraints = new GridBagConstraints();
|
||||
oGridBagConstraints.gridx = 0;
|
||||
oGridBagConstraints.gridy = 0;
|
||||
oGridBagConstraints.gridwidth = 500;
|
||||
oGridBagConstraints.gridheight = 600;
|
||||
|
||||
JPanel oBreakpoints = new JPanel();
|
||||
oBreakpoints.setLayout(new GridLayout(iNumberOfLines, 1));
|
||||
|
||||
JPanel oFileLines = new JPanel();
|
||||
oFileLines.setLayout(new GridLayout(iNumberOfLines, 1));
|
||||
int iMaxLength = getMaxLen(data);
|
||||
|
||||
for (int i = 1; i < iNumberOfLines; i++) {
|
||||
JTextField oTestLine = new JTextField(data.get(i - 1));
|
||||
oTestLine.setEditable(false);
|
||||
oFileLines.add(oTestLine);
|
||||
JCheckBox oCheckbox = new JCheckBox();
|
||||
oCheckbox.setEnabled(false);
|
||||
oCheckboxes.add(oCheckbox);
|
||||
oBreakpoints.add(oCheckbox);
|
||||
JTextField oNumber = new JTextField(i + "");
|
||||
oNumber.setEditable(false);
|
||||
oLineNumbers.add(oNumber);
|
||||
}
|
||||
JPanel oPanel = new JPanel();
|
||||
oPanel.setLayout(new GridBagLayout());
|
||||
|
||||
this.add(oLineNumbers, oGridBagConstraints);
|
||||
this.add(oBreakpoints);
|
||||
this.add(oFileLines);
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
|
||||
JTextField oNumber = new JTextField(i + "", 3);
|
||||
oNumber.setEditable(false);
|
||||
oPanel.add(oNumber, c);
|
||||
|
||||
c.gridx = 1;
|
||||
|
||||
JCheckBox oCheckbox = new JCheckBox();
|
||||
oCheckbox.setEnabled(false);
|
||||
oCheckboxes.add(oCheckbox);
|
||||
oPanel.add(oCheckbox, c);
|
||||
|
||||
c.gridx = 2;
|
||||
|
||||
JTextField oTestLine = new JTextField(data.get(i - 1), iMaxLength);
|
||||
oTestLine.setEditable(false);
|
||||
oPanel.add(oTestLine, c);
|
||||
|
||||
l.gridy = iVerticalCount;
|
||||
l.anchor = GridBagConstraints.WEST;
|
||||
oLines.add(oPanel, l);
|
||||
iVerticalCount++;
|
||||
}
|
||||
System.out.println(iMaxLength);
|
||||
this.add(oLines);
|
||||
}
|
||||
|
||||
public ArrayList<JCheckBox> getCheckboxes() {
|
||||
return oCheckboxes;
|
||||
}
|
||||
|
||||
private int getMaxLen(ArrayList<String> data) {
|
||||
int iSize = data.size();
|
||||
int iMaxLength = 0;
|
||||
for (int i = 0; i < iSize; i++) {
|
||||
if (data.get(i).length() > iMaxLength) {
|
||||
iMaxLength = data.get(i).length();
|
||||
}
|
||||
}
|
||||
return iMaxLength;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user