diff --git a/tools/bootutil/binaries/osx/bootutil b/tools/bootutil/binaries/osx/bootutil index 634e7c2f..bc456373 100755 Binary files a/tools/bootutil/binaries/osx/bootutil and b/tools/bootutil/binaries/osx/bootutil differ diff --git a/tools/bootutil/gui.c b/tools/bootutil/gui.c index 56289843..391a0a1a 100644 --- a/tools/bootutil/gui.c +++ b/tools/bootutil/gui.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -18,10 +19,33 @@ gui_config(void) init_pair(1, COLOR_CYAN, COLOR_BLACK); } +/* +void gui_menu_print(WINDOW *win, int highlight) +{ + int x, y, i; + + x = 2; + y = 2; + box(win, 0, 0); + for(i = 0; i < 10; ++i) { + if(highlight == i + 1) { + wattron(win, A_REVERSE); + mvwprintw(win, y, x, "%s", "string"); + wattroff(win, A_REVERSE); + } else { + mvwprintw(win, y, x, "%s", "string"); + } + ++y; + } + wrefresh(win); +} +*/ + int gui_init(void) { int ch; + int row, col; WINDOW * mainwin; /* Init ncurses window */ @@ -33,12 +57,27 @@ gui_init(void) /* Setup the core window properties */ gui_config(); + /* Get the window dimenstions */ + getmaxyx(stdscr,row,col); + + /* Draw some borders (hack, remove) */ + box(mainwin, 0, 0); + + /* Add the title */ + char *title = "Adafruit nRF52 Bootloader Utility"; + attron(COLOR_PAIR(1)); + attron(A_BOLD); + mvprintw(row/2,(col-strlen(title))/2,"%s",title); + attroff(A_BOLD); + attroff(COLOR_PAIR(1)); + /* Wait for some feedback */ - printw("Type any character to see it in bold and color\n"); + mvprintw(1, 2, "Type any character to see it in bold and color"); ch = getch(); + /* Display the key value */ + mvprintw(2, 2, "The pressed key is "); attron(COLOR_PAIR(1)); - printw("The pressed key is "); attron(A_BOLD); switch(ch) { @@ -65,6 +104,8 @@ gui_init(void) attroff(A_BOLD); attroff(COLOR_PAIR(1)); refresh(); + + /* Wait a bit before closing */ sleep(2); /* Clean up after ourselves */