diff --git a/project/.cproject b/project/.cproject index 74e4aa2..2b2e80a 100644 --- a/project/.cproject +++ b/project/.cproject @@ -1,8 +1,8 @@ - - + + @@ -14,74 +14,96 @@ - - - - - - + + @@ -93,62 +115,83 @@ - - - - - + - + - + - + + + + + + + + \ No newline at end of file diff --git a/project/Core/Inc/modbus-tcp.h b/project/Core/Inc/modbus-tcp.h index 0e1f289..43f7e2e 100644 --- a/project/Core/Inc/modbus-tcp.h +++ b/project/Core/Inc/modbus-tcp.h @@ -12,6 +12,10 @@ #include #include +#include +#include +#include "lcd_api.h" +#include "llfs.h" void modbus_init( void ); diff --git a/project/Core/Src/llfs.c b/project/Core/Src/llfs.c index 62588de..cd08cd3 100644 --- a/project/Core/Src/llfs.c +++ b/project/Core/Src/llfs.c @@ -57,7 +57,7 @@ size_t llfs_file_list(llfs_file_t* file_list, size_t max_files, char* filter) { } // Iterate over all files in the filesystem - while (file != NULL && file_count < max_files) { + while (file != NULL && count < max_files) { // Filter out files with a filename that does not match the filter if (filter != NULL) { if (!file_ext_cmp(file->name, filter)) { diff --git a/project/Core/Src/main.c b/project/Core/Src/main.c index a381c10..b39e308 100644 --- a/project/Core/Src/main.c +++ b/project/Core/Src/main.c @@ -113,11 +113,9 @@ int main(void) MX_LWIP_Init(); MX_QUADSPI_Init(); /* USER CODE BEGIN 2 */ - modbus_init(); lcd_init(true); - llfs_init(); - + modbus_init(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ diff --git a/project/Core/Src/modbus-tcp.c b/project/Core/Src/modbus-tcp.c index 3e3b607..a5fd31b 100644 --- a/project/Core/Src/modbus-tcp.c +++ b/project/Core/Src/modbus-tcp.c @@ -1,7 +1,5 @@ #include "modbus-tcp.h" -#include - char tcp_buffer[1024]; #define MAX_REG 250 @@ -19,10 +17,16 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf * uint8_t txt_green = 0; uint8_t txt_blue = 0; uint8_t nr_img = 0; + uint32_t result_bg = 0; + uint32_t result_txt = 0; + uint32_t result = 0; + char text[200]; + for(i = 0; i < 100;i++){ text[i] = 95; // _ } + text[199] = '\0'; if (p != NULL){ printf("data not null\n"); @@ -64,6 +68,34 @@ static err_t modbus_incomming_data(void *arg, struct tcp_pcb *pcb, struct pbuf * } printf("\n"); + //processing the text data to screen + char *textstring = text; + + result_bg = 0xff000000; + result_bg |= ((uint32_t)bg_red) << 16; + result_bg |= ((uint32_t)bg_green) << 8; + result_bg |= bg_blue; + + result_txt = 0xff000000; + result_txt |= ((uint32_t)txt_red) << 16; + result_txt |= ((uint32_t)txt_green) << 8; + result_txt |= txt_blue; + + lcd_display_text(textstring, 10, 50, result_txt, result_bg, LCD_FONT24); + + //proccesing the image index + + size_t number_of_files = llfs_file_count();//hoeveel files er zijn + + llfs_file_t file_list[number_of_files];//geheugen vrijmaken voor files + + number_of_files = llfs_file_list(file_list, number_of_files, NULL);//vrijgemaakt geheugen invullen met de lijst + + lcd_display_text(file_list[nr_img - 1].name, 10, 75, LCD_COLOR_MAGENTA, LCD_COLOR_YELLOW, LCD_FONT24);//putting the file name on screen + + //functie_voor_naam + + } else if (err == ERR_OK){ tcp_close(pcb);//when everithing was ok close the tcpconnection @@ -95,3 +127,6 @@ void modbus_init( void ) modbus_pcb = tcp_listen( modbus_pcb );//listen tcp_accept(modbus_pcb, modbus_accept);//set callback function } + + +