removed folder "backend"

This commit is contained in:
Meruemon
2022-03-24 14:29:34 +01:00
parent 9ee475b05d
commit b2a739f646
66 changed files with 137 additions and 542 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/Model/MyModel.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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -2,7 +2,7 @@ package Control;
import java.util.ArrayList;
import Model.Backend.MyModel;
import Model.MyModel;
import View.MyView;
public class MyControlModel {

View File

@@ -2,7 +2,7 @@ package Control;
import java.util.ArrayList;
import Model.Backend.MyModel;
import Model.MyModel;
import View.MyView;
public class MyControlView {
@@ -20,6 +20,8 @@ public class MyControlView {
setPortAView();
setPortBView();
setRamView();
setRegistersDetailed();
setStack();
}
/**
@@ -51,11 +53,49 @@ public class MyControlView {
* Sets detailed register-table values to values from PIC.
*/
public void setRegistersDetailed() {
int iStatus = oMyModel.getPIC().getRam().get_STATUS();
int iOption = oMyModel.getPIC().getRam().get_OPTION();
int iIntcon = oMyModel.getPIC().getRam().get_INTCON();
int iS0 = ((iStatus & 1) == 1) ? 1:0;
int iS1 = ((iStatus & 2) == 2) ? 1:0;
int iS2 = ((iStatus & 4) == 4) ? 1:0;
int iS3 = ((iStatus & 8) == 8) ? 1:0;
int iS4 = ((iStatus & 16) == 16) ? 1:0;
int iS5 = ((iStatus & 32) == 32) ? 1:0;
int iS6 = ((iStatus & 64) == 64) ? 1:0;
int iS7 = ((iStatus & 128) == 128) ? 1:0;
int[] aiStatus = {iS0, iS1, iS2, iS3, iS4, iS5, iS6, iS7};
oMyView.getGUIRegistersDetailed().setStatus(aiStatus);
int iO0 = ((iOption & 1) == 1) ? 1:0;
int iO1 = ((iOption & 2) == 2) ? 1:0;
int iO2 = ((iOption & 4) == 4) ? 1:0;
int iO3 = ((iOption & 8) == 8) ? 1:0;
int iO4 = ((iOption & 16) == 16) ? 1:0;
int iO5 = ((iOption & 32) == 32) ? 1:0;
int iO6 = ((iOption & 64) == 64) ? 1:0;
int iO7 = ((iOption & 128) == 128) ? 1:0;
int[] aiOption = {iO0, iO1, iO2, iO3, iO4, iO5, iO6, iO7};
oMyView.getGUIRegistersDetailed().setOption(aiOption);
int iI0 = ((iIntcon & 1) == 1) ? 1:0;
int iI1 = ((iIntcon & 2) == 2) ? 1:0;
int iI2 = ((iIntcon & 4) == 4) ? 1:0;
int iI3 = ((iIntcon & 8) == 8) ? 1:0;
int iI4 = ((iIntcon & 16) == 16) ? 1:0;
int iI5 = ((iIntcon & 32) == 32) ? 1:0;
int iI6 = ((iIntcon & 64) == 64) ? 1:0;
int iI7 = ((iIntcon & 128) == 128) ? 1:0;
int[] aiIntcon = {iI0, iI1, iI2, iI3, iI4, iI5, iI6, iI7};
oMyView.getGUIRegistersDetailed().setIntcon(aiIntcon);
}
/**
*
* Enables and disables checkboxes of PortA.
*/
public void setPortAView() {
@@ -76,9 +116,12 @@ public class MyControlView {
oMyView.getGUIPorts().enableCheckboxesA(abEnabled);
}
/**
* Enables and disables checkboxes of PortB.
*/
public void setPortBView() {
boolean[] abEnabled = new boolean[10];
boolean[] abEnabled = new boolean[16];
abEnabled[0] = oMyModel.getPIC().getRam().get_TRISB0();
abEnabled[1] = oMyModel.getPIC().getRam().get_TRISB1();
@@ -98,26 +141,29 @@ public class MyControlView {
abEnabled[14] = true;
abEnabled[15] = true;
oMyView.getGUIPorts().enableCheckboxesA(abEnabled);
oMyView.getGUIPorts().enableCheckboxesB(abEnabled);
}
public void setRamView() {
int[] aiData;
int[] aiBank0 = oMyModel.getPIC().getRam().get_Bank0();
int[] aiBank1 = oMyModel.getPIC().getRam().get_Bank1();
int iLenB0 = aiBank0.length;
int iLenB1 = aiBank1.length;
aiData = new int[iLenB0 + iLenB1];
for (int i = 0; i < iLenB0; i++) {
aiData = new int[256];
for (int i = 0; i < 128; i++) {
aiData[i] = aiBank0[i];
}
for (int i = iLenB0; i < (iLenB0 + iLenB1); i++) {
aiData[i] = aiBank1[i];
int j = 0;
for (int i = 128; i < 256; i++) {
aiData[i] = aiBank1[j];
j++;
}
oMyView.getGUIRamTable().setGUIRam(aiData);
}
public void setStack() {
oMyView.getGUIStack().setStack(oMyModel.getPIC().getStack().getSTACK());
}
public void startProgramView() {

View File

@@ -1,346 +0,0 @@
/*
Copyright (C) 1999 (Jens Scheffler)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
import java.io.*;
import java.util.*;
import java.math.*;
public class In {
/** Diese Klasse stellt einige einfache Methoden zum Einlesen von der Tastatur
zur Verf&uuml;gung. Es werden diverse Werte von der Tastatur eingelesen, die
jeweils durch ein Leerzeichen, einen Tabstop oder ein Zeilenendezeichen
getrennt sein m&uuml;ssen.
@author Jens Scheffler
@version 1.01 Spezialfassung f&uuml;r <I>Programmieren 1 in Java</I>
*/
private In(){} // somit kann die Klasse nicht instanziiert werden!
private static BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
private static StringTokenizer eingabe;
private static String zeichenkette;
/** L&ouml;scht alles, was sich in der momentanen Zeile befindet.
Das hei&szlig;t es wird der Eingabe bis zum Zeilenende keine Beachtung mehr
geschenkt
*/
public static void flush(){
eingabe=null;
}
/* Private Methode, die den Tokenizer fuellt. Dies ist uebrigens eine von
zwei Methoden, die die Klasse zum Absturz bringen kann...*/
private static void init(){
zeichenkette=null;
if (eingabe!=null && eingabe.hasMoreTokens()) return;
while (eingabe==null || !eingabe.hasMoreTokens())
eingabe=new StringTokenizer(readLine());
}
/* Private Methode, die eine Fehlermeldung ausgibt */
private static void error(Exception e,String prompt) {
System.out.println("Eingabefehler "+e);
System.out.println("Bitte Eingabe wiederholen...");
System.out.print(prompt);
}
/** Liest eine ganze Textzeile von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zeile.
*/
/* Dies ist die zweite Methode, die die Klasse zum Absturz bringen kann.*/
public static String readLine(String prompt){
flush();
String erg="";
System.out.print(prompt);
try{
erg=in.readLine();
} catch(IOException e){
System.err.println(""+e+"\n Programm abgebrochen...\n");
//System.exit(1);
}
if (erg==null) {
System.err.println("Dateiende erreicht.\nProgramm abgebrochen...\n");
//System.exit(1);
}
return erg;
}
/** Liest eine <CODE>int</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static int readInteger(String prompt){
int erg;
System.out.print(prompt);
init();
while(true){
try{
erg=Integer.parseInt(eingabe.nextToken());
} catch (NumberFormatException e) {
error(e,prompt);init();continue;
}
return erg;
}
}
/** Liest eine <CODE>long</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static long readLong(String prompt){
long erg;
System.out.print(prompt);
init();
while(true){
try{
erg=Long.parseLong(eingabe.nextToken());
} catch (NumberFormatException e) {error(e,prompt);init();continue;}
return erg;
}
}
/** Liest eine <CODE>double</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static double readDouble(String prompt){
double erg;
System.out.print(prompt);
init();
while(true){
try{
erg=Double.valueOf(eingabe.nextToken()).doubleValue();
} catch(NumberFormatException e) {error(e,prompt);init();continue;}
return erg;
}
}
/** Liest eine <CODE>float</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static float readFloat(String prompt){
float erg;
System.out.print(prompt);
init();
while(true){
try{
erg=Float.valueOf(eingabe.nextToken()).floatValue();
} catch(NumberFormatException e) {error(e,prompt);init();continue;}
return erg;
}
}
/** Liest eine <CODE>short</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static short readShort(String prompt){
short erg;
System.out.print(prompt);
init();
while(true){
try{
erg=Short.valueOf(eingabe.nextToken()).shortValue();
} catch(NumberFormatException e) {error(e,prompt);init();continue;}
return erg;
}
}
/** Liest einen boolschen Wert von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return der eingelesene Wert.
*/
public static boolean readBoolean(String prompt){
String try_this=readString(prompt);
while (!try_this.equals("true") && !try_this.equals("false"))
try_this=readString();
return try_this.equals("true");
}
/** Liest ein Textwort von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return das eingelesene Wort.
*/
public static String readString(String prompt){
System.out.print(prompt);
init();
return eingabe.nextToken();
}
/** Liest ein Zeichen von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return das eingelesene Zeichen.
*/
public static char readChar(String prompt){
char erg;
System.out.print(prompt);
if (zeichenkette==null || zeichenkette.length()==0)
zeichenkette=readString("");
erg=zeichenkette.charAt(0);
zeichenkette=(zeichenkette.length()>1)?zeichenkette.substring(1):null;
return erg;
}
/** Liest eine ganze Textzeile von der Tastatur ein.
@return die eingelesene Zeile.
*/
public static String readLine(){
return readLine("");
}
/** Liest eine <CODE>int</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static int readInteger(){
return readInteger("");
}
/** Liest eine <CODE>int</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static int readInt(){
return readInteger("");
}
/** Liest eine <CODE>int</CODE>-Zahl von der Tastatur ein. Soll vorher eine
Eingabeaufforderung gemacht werden, geschieht dies durch den Parameter.
Dieser kann jedoch auch wegfallen.
@param prompt eine eventuelle Eingabeaufforderung
@return die eingelesene Zahl.
*/
public static int readInt(String prompt){
return readInteger(prompt);
}
/** Liest eine <CODE>long</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static long readLong(){
return readLong("");
}
/** Liest eine <CODE>double</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static double readDouble(){
return readDouble("");
}
/** Liest eine <CODE>short</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static short readShort(){
return readShort("");
}
/** Liest eine <CODE>float</CODE>-Zahl von der Tastatur ein.
@return die eingelesene Zahl.
*/
public static float readFloat(){
return readFloat("");
}
/** Liest ein Zeichen von der Tastatur ein.
@return das eingelesene Zeichen
*/
public static char readChar(){
return readChar("");
}
/** Liest ein Textwort von der Tastatur ein.
@return das eingelesene Wort.
*/
public static String readString(){
return readString("");
}
/** Liest einen boolschen Wert von der Tastatur ein.
@return das eingelesene Wort.
*/
public static boolean readBoolean(){
return readBoolean("");
}
/** Wandelt eine double-Zahl in einen String um.
Bei der &uuml;blichen Umwandlung von double-Werten in einen String
findet eine Rundung statt. So wird etwa die Zahl 0.1, obwohl intern
nicht darstellbar, dennoch auf dem Bildschirm ausgegeben. Diese
Methode umgeht die Rundung */
public static String toString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d))
return ""+d;
return (new BigDecimal(d)).toString();
}
/**
* Setzt den Standard-Inputreader auf neuen Eingabestrom
* @param in inputstream instance, not null
*/
public static void setInputStream(InputStream in) {
if (in == null)
throw new IllegalArgumentException("in darf nicht null sein.");
In.in = new BufferedReader(new InputStreamReader(in));
}
/**
* Setzt den Standard-Inputreader auf neuen Eingabestrom
* @param in reader instance, not null
*/
public static void setInputStreamReader(Reader in) {
if (in == null)
throw new IllegalArgumentException("in darf nicht null sein.");
In.in = new BufferedReader(in);
}
/**
* Setzt den Standard-Inputreader auf neuen Eingabestrom
*
* @deprecated
* @param bin BufferedReader
*/
public static void setReader (BufferedReader bin) {
if (bin == null)
throw new IllegalArgumentException("bin darf nicht null sein.");
In.in = bin;
}
}

View File

@@ -1,7 +0,0 @@
package Model.Backend.Runtime;
import Model.Backend.Microcontroller.PIC;
public class ProgramStepInformation {
private PIC oPIC;
}

View File

@@ -1,5 +0,0 @@
package Model.Backend.Runtime;
public enum WATCHDOG {
}

View File

@@ -1,16 +0,0 @@
package Model.Backend.Statistics.ErrorHandling;
public class BackendErrorCounter {
private int iErrorCounter = 0;
private int [] aiErrors;
public void incrementErrorCounter() {
iErrorCounter++;
}
public int getErrorCounter() {
return iErrorCounter;
}
//TODO detailed error counts
}

View File

@@ -1,6 +1,6 @@
package Model.Backend.BackendCommandProcessing;
package Model.BackendCommandProcessing;
import Model.Backend.Microcontroller.PIC;
import Model.Microcontroller.PIC;
public class InformationConnecter {

View File

@@ -1,4 +1,4 @@
package Model.Backend.EepromLoader;
package Model.EepromLoader;
import java.io.BufferedReader;
import java.io.File;
@@ -6,7 +6,7 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import Model.Backend.Microcontroller.PIC;
import Model.Microcontroller.PIC;
public class ReadEepromFile {

View File

@@ -1,4 +1,4 @@
package Model.Backend.InterruptHandling;
package Model.InterruptHandling;
public class InterruptServiceHandler extends Thread {

View File

@@ -1,4 +1,4 @@
package Model.Backend.InterruptHandling;
package Model.InterruptHandling;
/**
* Class contains methods which calls a method to an overhanded value.

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
public class Bitmask {
/**

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
/**
* @author Aaron Moser
* @date 23.06.2021

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
/**
* @author Aaron Moser

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
/**
* @author Aaron Moser

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
import java.util.EmptyStackException;
@@ -31,15 +31,16 @@ public class STACK
*/
public void pushReturnAdressOnStack(int return_Adress)
{
if (stackpointer < 7)
if (stackpointer < 8)
{
stack[stackpointer] = return_Adress;
stackpointer++;
}
if (stackpointer == 7)
if (stackpointer == 8)
{
throw new StackOverflowError();
//throw new StackOverflowError();
stackpointer = 0;
}
}

View File

@@ -1,4 +1,4 @@
package Model.Backend.Microcontroller;
package Model.Microcontroller;
/**
* @author Aaron Moser

View File

@@ -1,7 +1,7 @@
package Model.Backend;
package Model;
import Model.Backend.Microcontroller.PIC;
import Model.Backend.Runtime.Environment;
import Model.Microcontroller.PIC;
import Model.Runtime.Environment;
public class MyModel {
PIC oPIC;

View File

@@ -4,12 +4,12 @@
* @lastchange 21.02.2022
*/
package Model.Backend.Runtime;
package Model.Runtime;
import java.util.ArrayList;
import Model.Backend.Microcontroller.PIC;
import Model.Backend.Microcontroller.WATCHDOG;
import Model.Microcontroller.WATCHDOG;
import Model.Microcontroller.PIC;
import View.GUIMainFrame;
public class Environment {
@@ -32,12 +32,12 @@ public class Environment {
public Environment() {
oPIC = new PIC();
oPIC.setWRegister(4);
GUIMainFrame oMainFrame = new GUIMainFrame(this);
watchdog = new WATCHDOG();

View File

@@ -1,4 +1,4 @@
package Model.Backend.Runtime;
package Model.Runtime;
public class Main {
public static void main(String[] args) {

View File

@@ -0,0 +1,7 @@
package Model.Runtime;
import Model.Microcontroller.PIC;
public class ProgramStepInformation {
private PIC oPIC;
}

View File

@@ -1,4 +1,4 @@
package Model.Backend.Runtime;
package Model.Runtime;
public class TODO {

View File

@@ -1,4 +1,4 @@
package Model.Backend.Runtime;
package Model.Runtime;
import java.util.ArrayList;

View File

@@ -10,8 +10,10 @@ import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import Model.Backend.MyModel;
import Model.Backend.Runtime.Environment;
import Control.MyControlModel;
import Control.MyControlView;
import Model.MyModel;
import Model.Runtime.Environment;
public class GUIMainFrame extends JFrame {
@@ -59,6 +61,8 @@ public class GUIMainFrame extends JFrame {
MyModel oMyModel;
MyControlView mcv;
ArrayList<JPanel> oPanels = new ArrayList<JPanel>();
/**
@@ -87,6 +91,9 @@ public class GUIMainFrame extends JFrame {
setTheme(0);
updateWindow();
this.setVisible(true); //make frame visible
oMyModel = new MyModel(oEnvironment.getPIC(), oEnvironment);
mcv = new MyControlView(oMyView, oMyModel);
mcv.updateView();
}
private void buildGUIMainFrame() {

View File

@@ -222,8 +222,10 @@ public class GUIPorts extends JPanel {
}
public void enableCheckboxesB(boolean[] abEnabled) {
int j = 0;
for (int i = 10; i < 26; i++) {
oCheckboxes.get(i).setEnabled(abEnabled[i]);
oCheckboxes.get(i).setEnabled(abEnabled[j]);
j++;
}
}

View File

@@ -140,6 +140,39 @@ public class GUIRegistersDetailed extends JPanel {
oTables.add(oStatusTable);
}
public void setStatus(int[] aiStatus) {
oStatusTable.setValueAt(aiStatus[7] + "", 1, 0);
oStatusTable.setValueAt(aiStatus[6] + "", 1, 1);
oStatusTable.setValueAt(aiStatus[5] + "", 1, 2);
oStatusTable.setValueAt(aiStatus[4] + "", 1, 3);
oStatusTable.setValueAt(aiStatus[3] + "", 1, 4);
oStatusTable.setValueAt(aiStatus[2] + "", 1, 5);
oStatusTable.setValueAt(aiStatus[1] + "", 1, 6);
oStatusTable.setValueAt(aiStatus[0] + "", 1, 7);
}
public void setOption(int[] aiOption) {
oOptionTable.setValueAt(aiOption[7] + "", 1, 0);
oOptionTable.setValueAt(aiOption[6] + "", 1, 1);
oOptionTable.setValueAt(aiOption[5] + "", 1, 2);
oOptionTable.setValueAt(aiOption[4] + "", 1, 3);
oOptionTable.setValueAt(aiOption[3] + "", 1, 4);
oOptionTable.setValueAt(aiOption[2] + "", 1, 5);
oOptionTable.setValueAt(aiOption[1] + "", 1, 6);
oOptionTable.setValueAt(aiOption[0] + "", 1, 7);
}
public void setIntcon(int[] aiIntcon) {
oIntconTable.setValueAt(aiIntcon[0] + "", 1, 0);
oIntconTable.setValueAt(aiIntcon[1] + "", 1, 1);
oIntconTable.setValueAt(aiIntcon[2] + "", 1, 2);
oIntconTable.setValueAt(aiIntcon[3] + "", 1, 3);
oIntconTable.setValueAt(aiIntcon[4] + "", 1, 4);
oIntconTable.setValueAt(aiIntcon[5] + "", 1, 5);
oIntconTable.setValueAt(aiIntcon[6] + "", 1, 6);
oIntconTable.setValueAt(aiIntcon[7] + "", 1, 7);
}
public void setTheme(int iThemeNr) {
switch (iThemeNr) {
case 0: {

View File

@@ -1,127 +0,0 @@
import java.io.*;
//how to use In.java
public class simulator_additional_functions
{
public static char menueSelectionChar = 'A';
public static char secondMenueSelectionChar = 'A';
public static String secondMenueSelectionString = "";
public static File frontendToBackendFile = new File("../SIMULATOR_DAT/gui_change.dat");
public static void main(String[] args)
{
int []array = new int[9];
array[0] = 1;
array[1] = 2;
array[2] = 4;
array[3] = 8;
array[4] = 16;
array[5] = 32;
array[6] = 64;
array[7] = 128;
array[8] = 256;
while ((menueSelectionChar != 'S') && (menueSelectionChar != 's'))
{
menueSelectionChar = In.readChar("What do you want to do?\n(B/b)reakpoint, (P/p)rescaler, (S/s)top:");
switch (menueSelectionChar)
{
case 'B':
case 'b':
{
secondMenueSelectionString = In.readString("In which line do you want to set your breakpoint?:");
if (!frontendToBackendFile.isFile())
{
if (Integer.parseInt(secondMenueSelectionString) >= 0)
{
try
{
FileWriter fw = new FileWriter(frontendToBackendFile);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("BREAKPOINT " + secondMenueSelectionString);
bw.close();
}
catch (IOException ioe)
{}
}
else
{
System.out.println("Please try again, value must be greater -1");
}
}
else
{
System.out.println("Error can't create new File, File already exists!");
}
}break;
case 'P':
case 'p':
{
secondMenueSelectionChar = In.readChar("Which Prescaler you want to set? (T/t)imer0, (W/w)atchdogtimer");
switch (secondMenueSelectionChar)
{
case 'T':
case 't':
{
if (!frontendToBackendFile.isFile())
{
secondMenueSelectionChar = In.readChar("What value you want to set the prescaler?\n0. 1, 1. 2, 2. 4, 3. 8, 4. 16, 5. 32, 6. 64, 7. 128, 8. 256:");
if ((Integer.parseInt("" + secondMenueSelectionChar) >= 0) && (Integer.parseInt("" + secondMenueSelectionChar) < 9))
{
try
{
FileWriter fw = new FileWriter(frontendToBackendFile);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("PRT " + Integer.parseInt("" + secondMenueSelectionChar));
bw.close();
}
catch (IOException ioe)
{}
}
}
else
{
System.out.println("Error can't create new File, File already exists!");
}
}break;
case 'W':
case 'w':
{
if (!frontendToBackendFile.isFile())
{
secondMenueSelectionChar = In.readChar("What value you want to set the prescaler?\n0. 2, 1. 4, 2. 8, 3. 16, 4. 32, 5. 64, 6. 128, 7. 256:");
if ((Integer.parseInt("" + secondMenueSelectionChar) > 0) && (Integer.parseInt("" + secondMenueSelectionChar) < 9))
{
try
{
FileWriter fw = new FileWriter(frontendToBackendFile);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("PRW " + array[Integer.parseInt("" + secondMenueSelectionChar)]);
bw.close();
}
catch (IOException ioe)
{}
}
}
else
{
System.out.println("Error can't create new File, File already exists!");
}
}break;
}
}break;
}
}
}
}