Merge branch 'Modbus_TCP_Obe' of https://github.com/Sani7/2023-Webservices_And_Applications into Modbus_TCP_Obe
This commit is contained in:
@@ -104,7 +104,7 @@ void main(void) {
|
||||
#### Drawing text on the screen
|
||||
|
||||
```c
|
||||
void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
|
||||
void lcd_display_text(const char* text, uint32_t x_pos, uint32_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font);
|
||||
```
|
||||
|
||||
```c
|
||||
@@ -165,6 +165,7 @@ Note that when an image exceeds the X or Y size of the LCD display, the image wi
|
||||
#### Drawing a BMP from the filesystem to the LCD
|
||||
```c
|
||||
void lcd_draw_img_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
|
||||
void lcd_draw_img_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
|
||||
```
|
||||
|
||||
```c
|
||||
@@ -175,10 +176,13 @@ void main(void) {
|
||||
lcd_init(true);
|
||||
...
|
||||
lcd_draw_img_from_fs("st.bmp", 0, 0);
|
||||
...
|
||||
llfs_file_t* file = llfs_open("st.bmp");
|
||||
lcd_draw_img_from_llfs_file(file, 50, 50);
|
||||
}
|
||||
```
|
||||
|
||||
This function expects the name of the BMP image as argument, together with the X and Y coordinates.
|
||||
This function expects the name of the BMP image as argument or a pointer to the llfs_file_t struct, together with the X and Y coordinates.
|
||||
|
||||
Note that this function only works for BMP images and not raw images and when an image exceeds the X or Y size of the LCD display, the image will go out of the visible LCD area.
|
||||
|
||||
@@ -186,6 +190,7 @@ Note that this function only works for BMP images and not raw images and when an
|
||||
```c
|
||||
lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_pos);
|
||||
lcd_gif_t* lcd_draw_gif_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos);
|
||||
lcd_gif_t* lcd_draw_gif_from_llfs_file(llfs_file_t* file, uint32_t x_pos, uint32_t y_pos);
|
||||
```
|
||||
```c
|
||||
#include "lcd_api.h"
|
||||
@@ -201,6 +206,10 @@ void main(void) {
|
||||
// From the filesystem
|
||||
lcd_gif_t* gif = lcd_draw_gif_from_fs("st.gif", 0, 0);
|
||||
|
||||
// From a llfs_file_t struct
|
||||
llfs_file_t* file = llfs_open("st.gif");
|
||||
lcd_gif_t* gif = lcd_draw_gif_from_llfs_file(file, 0, 0);
|
||||
|
||||
if (gif == NULL) {
|
||||
LOG_WARNING("GIF could not be drawn");
|
||||
}
|
||||
|
||||
24
docs/llfs.md
24
docs/llfs.md
@@ -23,6 +23,7 @@ restricting operations solely to read functions.
|
||||
- [Iterator function (not recommended)](#iterator-function-not-recommended)
|
||||
- [Reading a file](#reading-a-file)
|
||||
- [Getting the number of files](#getting-the-number-of-files)
|
||||
- [Getting a file extension](#getting-a-file-extension)
|
||||
- [Using the POSIX file functions](#using-the-posix-file-functions)
|
||||
- [Enabling the external loader in STM32CubeIDE](#enabling-the-external-loader-in-stm32cubeide)
|
||||
|
||||
@@ -144,6 +145,29 @@ void main(void) {
|
||||
}
|
||||
```
|
||||
|
||||
### Getting a file extension
|
||||
```c
|
||||
#include "llfs.h"
|
||||
void main(void) {
|
||||
llfs_init();
|
||||
|
||||
// Get a file by name
|
||||
llfs_file_t* file = llfs_file_open("filename with a space.txt");
|
||||
|
||||
if (file != NULL) {
|
||||
// Print the file name, size and data
|
||||
LOG_INFO(TAG, "File found: %s, size: %d", file->name, file->len);
|
||||
LOG_INFO(TAG, "File data: %s", file->data);
|
||||
|
||||
// Get the file extension
|
||||
const char* ext = llfs_file_ext(file->name);
|
||||
LOG_INFO(TAG, "File extension: %s", ext);
|
||||
} else {
|
||||
LOG_WARN(TAG, "File not found");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Using the POSIX file functions
|
||||
The llfs library also supports the POSIX file functions.
|
||||
As the file system is read-only, write functions are not implemented.
|
||||
|
||||
@@ -6,6 +6,7 @@ This is the documentation of the Modbus-TCP task
|
||||
- [Initialization](#initialization)
|
||||
- [Usage](#usage)
|
||||
- [Guide](#Guide)
|
||||
- [Extra](#Extra)
|
||||
|
||||
## Initialization
|
||||
The Modbus task is initialized in the main function.
|
||||
@@ -28,4 +29,5 @@ modbus_init();
|
||||
|
||||
## Extra
|
||||
|
||||
The start addres is ignored and the timeout warnings arne normal because there is no response from my code back to QModMaster.
|
||||
The start addres is ignored and the timeout warnings arne normal because there is no response from my code back to QModMaster.
|
||||
|
||||
|
||||
13
docs/tftp.md
13
docs/tftp.md
@@ -1,5 +1,14 @@
|
||||
# TFTP
|
||||
This is the documentation of the TFTP task
|
||||
|
||||
## Table of contents
|
||||
- [Table of contents](#table-of-contents)
|
||||
- [Initialization](#initialization)
|
||||
- [Deinitialization](#deinitialization)
|
||||
- [Usage](#usage)
|
||||
- [Receive a file](#receive-a-file)
|
||||
- [Send a file](#send-a-file)
|
||||
|
||||
## Initialization
|
||||
The TFTP task is initialized in the main function.
|
||||
```c
|
||||
@@ -16,9 +25,9 @@ tftp_server_deinit();
|
||||
## Usage
|
||||
The TFTP task is used to receive and send files via TFTP.
|
||||
### Receive a file
|
||||
index.txt contains a list of files on the file system.
|
||||
index.txt contains a list of files on the file system. For some weird reason tftp only works in octet mode.
|
||||
```bash
|
||||
bash $ tftp <ip>
|
||||
bash $ tftp -m octet <ip>
|
||||
tftp $ get index.txt
|
||||
```
|
||||
### Send a file
|
||||
|
||||
@@ -9,6 +9,8 @@ there are currently 2 types of datagrams it processes:
|
||||
|
||||
It also writes the current owner's name on the screen and updates it everytime it's changed.
|
||||
|
||||
To use the Qt application for this part of the project you can use [App](https://github.com/Sani7/2023-Webservices_And_Applications/releases/tag/V1.1)
|
||||
|
||||
## Table of contents
|
||||
- [Introduction](#introduction)
|
||||
- [Table of contents](#table-of-contents)
|
||||
@@ -68,7 +70,7 @@ connected:
|
||||
|
||||
```
|
||||
### Owner details interface
|
||||
The interface to ask for the owner's details and change them is a modified version of the [Qt application](https://github.com/wimdams/Device_finder) Wim Dams build. His only has the functionality to ask for the owner's details.
|
||||
The interface to ask for the owner's details and change them is a modified version of the [Qt application](https://github.com/wimdams/Device_finder) Wim Dams build. His only has the functionality to ask for the owner's details. The changed version can be found at [App](https://github.com/Sani7/2023-Webservices_And_Applications/releases/tag/V1.1)
|
||||
|
||||
Just because the owner's details might want to be used in other code, some functions have been written for obtaining these in the STM32 code aswell.
|
||||
#### Setting owner details
|
||||
|
||||
Reference in New Issue
Block a user