Priprava Ncurses a vlakna pro UART

This commit is contained in:
2025-03-29 22:45:42 +01:00
parent 3e5f57c18f
commit 816815ff84
7 changed files with 57 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
{
"files.associations": {
"users.h": "c"
}
}
+2 -2
View File
@@ -7,12 +7,12 @@
CC = gcc CC = gcc
# define any compile-time flags # define any compile-time flags
CFLAGS := -Wall -Wextra -g CFLAGS := -Wall -Wextra -g -pedantic
# define library paths in addition to /usr/lib # define library paths in addition to /usr/lib
# if I wanted to include libraries not in /usr/lib I'd specify # if I wanted to include libraries not in /usr/lib I'd specify
# their path using -Lpath, something like: # their path using -Lpath, something like:
LFLAGS = LFLAGS = -lncurses
# define output directory # define output directory
OUTPUT := output OUTPUT := output
+8
View File
@@ -0,0 +1,8 @@
#ifndef __TUI_H__
#define __TUI_H__
#include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>
#endif
+4
View File
@@ -1,5 +1,7 @@
#include <stdint.h> #include <stdint.h>
#include <time.h> #include <time.h>
#include <unistd.h>
#include <pthread.h>
#ifndef __USERS_H__ #ifndef __USERS_H__
#define __USERS_H__ #define __USERS_H__
@@ -14,6 +16,8 @@ typedef struct person
time_t last_timestamp; time_t last_timestamp;
uint32_t total; uint32_t total;
pthread_mutex_t lock;
} person_t; } person_t;
typedef struct node typedef struct node
Executable
BIN
View File
Binary file not shown.
+35 -1
View File
@@ -1,8 +1,42 @@
#include <ncurses.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include "users.h" #include "users.h"
void *uartListener(void *arg)
{
return NULL;
}
int main(int argc, char const *argv[]) int main(int argc, char const *argv[])
{ {
int y_max, x_max;
pthread_t uart_thread;
return 0; initscr();
getmaxyx(stdscr, y_max, x_max);
noecho();
noraw();
start_color();
curs_set(0);
assume_default_colors(COLOR_WHITE, COLOR_BLUE);
erase();
refresh();
pthread_create(&uart_thread, NULL, uartListener, NULL);
//
pthread_join(uart_thread, NULL);
clear();
endwin();
return EXIT_SUCCESS;
} }
+3
View File
@@ -0,0 +1,3 @@
#include <ncurses.h>
#include <stdio.h>
#include <stdlib.h>