mcu debug stuff entfernt
This commit is contained in:
parent
3195b06750
commit
1b36640c4f
|
@ -3,25 +3,33 @@
|
|||
# Author: Tristan Krause
|
||||
# Creation Date: 2019-03-22
|
||||
|
||||
# Umgebungseinstellungen
|
||||
# Environment
|
||||
COMPILER_PATH = g++
|
||||
|
||||
|
||||
OUTPUT = main
|
||||
CFLAGS = -std=c++14 -O3 -Wall -Wextra
|
||||
LDFLAGS =
|
||||
OBJECTS = main.o drv/usart.o drv/b15f.o drv/plottyfile.o drv/dot.o
|
||||
# Options
|
||||
OUT_MAIN = main
|
||||
OBJ_MAIN = main.o
|
||||
OUT_CLI = cli
|
||||
OBJ_CLI = cli.o
|
||||
CFLAGS = -std=c++14 -O3 -Wall -Wextra
|
||||
LDFLAGS =
|
||||
OBJECTS = drv/usart.o drv/b15f.o drv/plottyfile.o drv/dot.o
|
||||
|
||||
COMPILE = $(COMPILER_PATH) $(CFLAGS)
|
||||
|
||||
B15F: $(OBJECTS)
|
||||
main: $(OBJECTS) $(OBJ_MAIN)
|
||||
@echo "Linking..."
|
||||
$(COMPILE) $(OBJECTS) -o $(OUTPUT) $(LDFLAGS)
|
||||
$(COMPILE) $(OBJ_MAIN) $(OBJECTS) -o $(OUT_MAIN) $(LDFLAGS)
|
||||
|
||||
cli: $(OBJECTS) $(OBJ_CLI)
|
||||
@echo "Linking..."
|
||||
$(COMPILE) $(OBJ_CLI) $(OBJECTS) -o $(OUT_CLI) $(LDFLAGS)
|
||||
|
||||
help:
|
||||
@echo "This Makefile has the following rules:"
|
||||
@echo "make B15F .... to compile (default)"
|
||||
@echo "make clean ... to delete objects, elf and hex file"
|
||||
@echo "make main .... to compile main.cpp"
|
||||
@echo "make cli .... to compile Command Line Interface"
|
||||
@echo "make clean ... to delete objects and executables"
|
||||
|
||||
clean:
|
||||
@echo "Cleaning..."
|
||||
|
|
BIN
driver/cli
Executable file
BIN
driver/cli
Executable file
Binary file not shown.
91
driver/cli.cpp
Normal file
91
driver/cli.cpp
Normal file
|
@ -0,0 +1,91 @@
|
|||
#include <stdio.h>
|
||||
#include <ncurses.h> // sudo apt-get install libncurses5-dev
|
||||
|
||||
#define WIDTH 30
|
||||
#define HEIGHT 10
|
||||
|
||||
int startx = 0;
|
||||
int starty = 0;
|
||||
|
||||
char *choices[] = {
|
||||
"Choice 1",
|
||||
"Choice 2",
|
||||
"Choice 3",
|
||||
"Choice 4",
|
||||
"Exit",
|
||||
};
|
||||
int n_choices = sizeof(choices) / sizeof(char *);
|
||||
void print_menu(WINDOW *menu_win, int highlight);
|
||||
|
||||
int main()
|
||||
{ WINDOW *menu_win;
|
||||
int highlight = 1;
|
||||
int choice = 0;
|
||||
int c;
|
||||
|
||||
initscr();
|
||||
clear();
|
||||
noecho();
|
||||
cbreak(); /* Line buffering disabled. pass on everything */
|
||||
startx = (80 - WIDTH) / 2;
|
||||
starty = (24 - HEIGHT) / 2;
|
||||
|
||||
menu_win = newwin(HEIGHT, WIDTH, starty, startx);
|
||||
keypad(menu_win, TRUE);
|
||||
mvprintw(0, 0, "Use arrow keys to go up and down, Press enter to select a choice");
|
||||
refresh();
|
||||
print_menu(menu_win, highlight);
|
||||
while(1)
|
||||
{ c = wgetch(menu_win);
|
||||
switch(c)
|
||||
{ case KEY_UP:
|
||||
if(highlight == 1)
|
||||
highlight = n_choices;
|
||||
else
|
||||
--highlight;
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
if(highlight == n_choices)
|
||||
highlight = 1;
|
||||
else
|
||||
++highlight;
|
||||
break;
|
||||
case 10:
|
||||
choice = highlight;
|
||||
break;
|
||||
default:
|
||||
mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c);
|
||||
refresh();
|
||||
break;
|
||||
}
|
||||
print_menu(menu_win, highlight);
|
||||
if(choice != 0) /* User did a choice come out of the infinite loop */
|
||||
break;
|
||||
}
|
||||
mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]);
|
||||
clrtoeol();
|
||||
refresh();
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void print_menu(WINDOW *menu_win, int highlight)
|
||||
{
|
||||
int x, y, i;
|
||||
|
||||
x = 2;
|
||||
y = 2;
|
||||
box(menu_win, 0, 0);
|
||||
for(i = 0; i < n_choices; ++i)
|
||||
{ if(highlight == i + 1) /* High light the present choice */
|
||||
{ wattron(menu_win, A_REVERSE);
|
||||
mvwprintw(menu_win, y, x, "%s", choices[i]);
|
||||
wattroff(menu_win, A_REVERSE);
|
||||
}
|
||||
else
|
||||
mvwprintw(menu_win, y, x, "%s", choices[i]);
|
||||
++y;
|
||||
}
|
||||
wrefresh(menu_win);
|
||||
}
|
|
@ -11,9 +11,9 @@ set label at 4,7 'U_{GS} [V] = 480' left
|
|||
set label at 3,13 'U_{GS} [V] = 500' left
|
||||
set label at 2,22 'U_{GS} [V] = 520' left
|
||||
set label at 1,33 'U_{GS} [V] = 540' left
|
||||
set label at 0,38 'U_{GS} [V] = 560' left
|
||||
set label at 0,38 'U_{GS} [V] = 580' left
|
||||
set label at 0,38 'U_{GS} [V] = 600' left
|
||||
set label at 0,39 'U_{GS} [V] = 560' left
|
||||
set label at 0,39 'U_{GS} [V] = 580' left
|
||||
set label at 0,39 'U_{GS} [V] = 600' left
|
||||
unset output
|
||||
set terminal qt
|
||||
unset output
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "drv/usart.h"
|
||||
#include "drv/b15f.h"
|
||||
#include "drv/plottyfile.h"
|
||||
|
||||
|
|
BIN
driver/test_plot
BIN
driver/test_plot
Binary file not shown.
Binary file not shown.
|
@ -197,7 +197,6 @@ void rqAdcDacStroke()
|
|||
int16_t count = static_cast<int16_t>(usart.readInt());
|
||||
|
||||
count *= delta;
|
||||
dio1.writePortA(0xFF);
|
||||
|
||||
for(int16_t i = start; i < count; i += delta)
|
||||
{
|
||||
|
|
|
@ -61,7 +61,6 @@ void USART::handleRX(void) volatile
|
|||
|
||||
void USART::handleTX(void) volatile
|
||||
{
|
||||
dio0.writePortA(send_pos);
|
||||
if(send_pos < send_len)
|
||||
{
|
||||
while (!(UCSR0A & (1<<UDRE0)));
|
||||
|
|
Loading…
Reference in a new issue