mirror of
https://github.com/aster94/logic-analyzer.git
synced 2026-05-01 23:53:02 +03:00
Update processing_LA.pde
This commit is contained in:
@@ -8,10 +8,12 @@ Serial p;
|
|||||||
//uncomment the line where your arduino/STM32 is connected
|
//uncomment the line where your arduino/STM32 is connected
|
||||||
//String LA_port = "/dev/ttyACM0"; //linux DFU
|
//String LA_port = "/dev/ttyACM0"; //linux DFU
|
||||||
//String LA_port = "/dev/ttyUSB0"; //linux Serial
|
//String LA_port = "/dev/ttyUSB0"; //linux Serial
|
||||||
String LA_port = "COM9"; //windows, change the number with the real port where your arduino is connected
|
String LA_port = "COM10"; //windows
|
||||||
|
|
||||||
|
final int baudrate = 115200;
|
||||||
|
|
||||||
//change it to true if you are using a STM32 instead of arduino
|
//change it to true if you are using a STM32 instead of arduino
|
||||||
boolean STM32 = false;
|
final boolean STM32 = false;
|
||||||
|
|
||||||
/*------------------END SETUP-----------------*/
|
/*------------------END SETUP-----------------*/
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
@@ -86,7 +88,7 @@ boolean isDraggable = false;
|
|||||||
|
|
||||||
void setup () {
|
void setup () {
|
||||||
//p = new Serial(this, Serial.list()[0], 115200);
|
//p = new Serial(this, Serial.list()[0], 115200);
|
||||||
p = new Serial(this, LA_port, 115200);
|
p = new Serial(this, LA_port, baudrate);
|
||||||
p.bufferUntil('\n');
|
p.bufferUntil('\n');
|
||||||
|
|
||||||
size(1000, 460);
|
size(1000, 460);
|
||||||
@@ -154,7 +156,13 @@ void draw () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xEnd = int (xTime[samples-1]) +10;
|
|
||||||
|
if (samples!=0) {
|
||||||
|
xEnd = int (xTime[samples-1]) +10;
|
||||||
|
} else {
|
||||||
|
xEnd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
yPos = yEdge;
|
yPos = yEdge;
|
||||||
for (int n = 0; n < 6; n++) {
|
for (int n = 0; n < 6; n++) {
|
||||||
if (xPos[n]!=0) { //draw only the pin which are active
|
if (xPos[n]!=0) { //draw only the pin which are active
|
||||||
@@ -195,7 +203,6 @@ void drawText() {
|
|||||||
text ("PB"+i, x, y);
|
text ("PB"+i, x, y);
|
||||||
y+=60;
|
y+=60;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (byte i = 8; i<=13; i++) {
|
for (byte i = 8; i<=13; i++) {
|
||||||
@@ -265,6 +272,7 @@ void mouseClicked() {
|
|||||||
if (mouseY>buttonY && mouseY <buttonY+buttonH &&
|
if (mouseY>buttonY && mouseY <buttonY+buttonH &&
|
||||||
mouseX>button2X && mouseX <button2X+smallButtonW) {
|
mouseX>button2X && mouseX <button2X+smallButtonW) {
|
||||||
p.write('G');
|
p.write('G');
|
||||||
|
println("new data coming");
|
||||||
p.clear();
|
p.clear();
|
||||||
xShift = 0;
|
xShift = 0;
|
||||||
handleX = xEdge;
|
handleX = xEdge;
|
||||||
@@ -335,6 +343,7 @@ void serialEvent (Serial p) {
|
|||||||
|
|
||||||
String inString = p.readStringUntil('\n');
|
String inString = p.readStringUntil('\n');
|
||||||
inString = trim(inString);
|
inString = trim(inString);
|
||||||
|
println("incoming: "+inString);
|
||||||
|
|
||||||
if (inString.equals("S") == true) {
|
if (inString.equals("S") == true) {
|
||||||
|
|
||||||
@@ -375,12 +384,13 @@ void serialEvent (Serial p) {
|
|||||||
void getData () {
|
void getData () {
|
||||||
|
|
||||||
//check data:
|
//check data:
|
||||||
//println(initialState);
|
println("event: "+event);
|
||||||
|
println("initial: "+initialState);
|
||||||
|
println("samples: "+samples);
|
||||||
//println("pin"+changed[0]);
|
//println("pin"+changed[0]);
|
||||||
//println("time"+usTime[0]);
|
//println("time"+usTime[0]);
|
||||||
//printArray(usTime);
|
printArray(usTime);
|
||||||
//printArray(xTime);
|
printArray(xTime);
|
||||||
//println("event: "+event);
|
|
||||||
//println("pin: "+binary(changed[0], 6));
|
//println("pin: "+binary(changed[0], 6));
|
||||||
|
|
||||||
for (int i = 0; i < samples; i++) {
|
for (int i = 0; i < samples; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user