From 56ac14b5bf6cb4966df867427649ed60aa4b62d5 Mon Sep 17 00:00:00 2001 From: niwciu <57457942+niwciu@users.noreply.github.com> Date: Sun, 14 Jan 2024 23:09:30 +0100 Subject: [PATCH 1/5] Update ReadMe.md --- ReadMe.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 1e66738..85da0e8 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -118,7 +118,7 @@ Library main header file with available library api.

#### How to build and run example 1. Open the location you want to clone the repository to in your terminal - 2. .Clone repository to your preferred localization + 2. Clone repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -170,7 +170,7 @@ Library main header file with available library api.

#### How to build and run example 1. Open the location you want to clone the repository to in your terminal - 2. .Clone repository to your preferred localization + 2. Clone repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -223,7 +223,7 @@ Library main header file with available library api.

#### How to build and run example 1. Open the location you want to clone the repository to in your terminal - 2. .Clone repository to your preferred localization + 2. Clone repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -301,7 +301,7 @@ const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void) } ``` -It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find empty template with declaration of all required interface elements as well as a few files with examples of implementations for different microcontrollers.Additional detail of the implementation in project can be also find in **./examples** folder. +It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find template with empty definitions of all required interface elements as well as a few files with examples of implementations for different microcontrollers. Additional details of the implementation in project can be also found in **./examples** folder. ## How to use in your Project - advanced case @@ -358,7 +358,7 @@ It's a basic interface that connects the library with your HW driver layer in th } ```
- It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find empty template with declaration of all required interface elements as well as a few files with examples of implementations for different microcontrollers. Additional detail of the implementation in project can be also find in **./examples** folder. + It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find template with empty definitions of all required interface elements as well as a few files with examples of implementation for different microcontrollers. Additional details of the implementation in project can be also found in **./examples** folder. ## How to define custom characters and custom character banks. ### Example of Correspondence between EPROM Address Data and Character Pattern (5 × 8 Dots)
From d536c7a1cdcd11100e4621a96a72678a49d7641d Mon Sep 17 00:00:00 2001 From: niwciu <57457942+niwciu@users.noreply.github.com> Date: Sun, 14 Jan 2024 23:11:18 +0100 Subject: [PATCH 2/5] Update ToDo_readme --- ToDo_readme | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ToDo_readme b/ToDo_readme index 155cad8..a7c1597 100644 --- a/ToDo_readme +++ b/ToDo_readme @@ -1 +1,4 @@ -1) edycja obrazków w hw requairments na zgodne z opisem. \ No newline at end of file +wszystko po dodaniu sterowania podświetleniem LCD +1) edycja obrazków w hw requairments na zgodne z opisem. +2) dodać pliki template przykłady implementacji interface +3)zaktyakiziwac dezwwnko I opis SRC folderu w readme \ No newline at end of file From 776978666cd131f626a9e04073d3bf19635b5564 Mon Sep 17 00:00:00 2001 From: niwciu <57457942+niwciu@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:33:28 +0100 Subject: [PATCH 3/5] Update ReadMe.md --- ReadMe.md | 76 +++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 85da0e8..39009a3 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,5 +1,5 @@ -# LCD HD44780 lib - simple cross platform C library -- [LCD HD44780 lib - simple cross platform C library](#lcd-hd44780-lib---simple-cross-platform-c-library) +# LCD HD44780 lib - simple cross-platform C library +- [LCD HD44780 lib - simple cross-platform C library](#lcd-hd44780-lib---simple-cross-platform-c-library) - [Features](#features) - [Release info](#release-info) - [Hardware configuration](#hardware-configuration) @@ -38,18 +38,18 @@ - [Project main folders file structure](#project-main-folders-file-structure) ## Features -- Works with LCD display connected in 4-bit mode, -- One direction or bi direction communication with LCD (predefined time slots or LCD RW pin usage) +- Works with LCD connected in 4-bit mode, +- One-direction or bi-direction communication with LCD (predefined time slots or LCD RW pin usage) - Easy to port on different microcontrollers - Contain examples of porting to STM32, AVR, ESP8266 - Allows to display strings/chars directly on LCD - Allows to put strings/chars in buffer and refresh LCD periodically with buffer content -- Allows to define custom chars (more than 8) as well as custom char banks where different combination of custom characters can be easily loaded to LCD CGRAM -- Contain functions for displayin on LCD int values as string representing: +- Allows to define custom chars (more than 8) as well as custom char banks where different combinations of custom characters can be easily loaded to LCD CGRAM +- Contain functions for displaying on LCD int values as a string representing: - int format - hex format - bin format -- Library has currently predefined LCD types: +- The library has currently predefined LCD types: - 2 lines 16 characters (1602) - 4 lines 16 characters (1604) - 4 lines 20 characters (2004) @@ -83,7 +83,7 @@ LCD_HD44780 ... ``` #### 1. lcd_driver_intrface_example_implementations - Folder that contain template of lcd_driver_interface implementation and examples of lcd_driver_interface_implementation for different hardware + The folder that contains a template of lcd_driver_interface implementation and examples of lcd_driver_interface_implementation for different hardware - file 1 - file 2 - file 3 @@ -92,7 +92,7 @@ LCD_HD44780 - LCD type - Usage of RW Signal/PIN - Usage of LCD buffer for displaying the content on the LCD - - Which functions from LCD_HD44780 lib you would like to compile and use in you project. + - Which functions from LCD_HD44780 lib you would like to compile and use in your project. #### 3. lcd_hd44780_def_char.h Header file for defining user special characters and user special characters banks. Each bank can contain up to 8 characters that are user-defined combinations of characters from defined user-special characters. This allows to creation of different combinations of special characters that can be loaded depending on current code needs. #### 4. lcd_hd44780_interface.h @@ -100,25 +100,25 @@ Header file with library interface declaration that needs to be implemented on t #### 5. lcd_hd44780.c Library main C file #### 6. lcd_hd44780.h -Library main header file with available library api. +Library main header file with available library functions. ## Examples ### 1. STM32G071RB -bare metal implementation -#### Requirements for compile and run the example: +#### Requirements for compiling and running the example: 1. CMake installed 2. Make or Ninja installed 3. ARM GNU Toolchain (gcc-arm-none-eabi) installed 4. STM32_Programmer_CLI installed 5. ST-link (on Nucleo Board) installed -#### Hardware requirements, configuration and connections +#### Hardware requirements, configuration, and connections 1. STM32G071 Nucleo-64


2. LCD Keypad Shield for Arduino


3. Pin connection between LCD Keypad Shield and Nucleo board


-#### How to build and run example +#### How to build and run the example 1. Open the location you want to clone the repository to in your terminal - 2. Clone repository to your preferred localization + 2. Clone the repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -152,25 +152,25 @@ Library main header file with available library api. ```bash ninja flash ``` - 6. In some cases Nucleo board require plugging out and in USB port to run the program. + 6. In some cases Nucleo board requires plugging out and in a USB port to run the program. ### 2. STM32G474 - STMCubeIDE project generated with LL drivers -#### Requirements for compile and run the example +#### Requirements for compiling and running the example 1. CMake installed 2. Make or Ninja installed 3. ARM GNU Toolchain (gcc-arm-none-eabi) installed 4. STM32_Programmer_CLI installed 5. ST-link (on Nucleo Board) installed -#### Hadrware configuration and connections +#### Hardware configuration and connections 1. STM32G474 Nucleo-64


2. LCD Keypad Shield for Arduino


3. Pin connection between LCD Keypad Shield and Nucleo board


-#### How to build and run example +#### How to build and run the example 1. Open the location you want to clone the repository to in your terminal - 2. Clone repository to your preferred localization + 2. Clone the repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -206,13 +206,13 @@ Library main header file with available library api. ``` ### 3. AVR ATmega 328P -#### Requirements for compile and run the example +#### Requirements for compiling and running the example 1. CMake installed 2. Make or Ninja installed - 3. AVR 8 bit GNU Toolchain + 3. AVR 8-bit GNU Toolchain 4. AVRdude Installed 5. USBasp programmer installed and updated -#### Hadrware configuration and connections +#### Hardware configuration and connections 1. Arduino UNO R3


2. USBasp programmer
@@ -221,9 +221,9 @@ Library main header file with available library api.

4. Pin connection between LCD Keypad Shield and Nucleo board


-#### How to build and run example +#### How to build and run the example 1. Open the location you want to clone the repository to in your terminal - 2. Clone repository to your preferred localization + 2. Clone the repository to your preferred localization ```bash git clone https://github.com/niwciu/LCD_HD44780.git ``` @@ -266,9 +266,9 @@ Library main header file with available library api. ### 4. ESP8266 NONOS SDK - TBD #### RequirementsTBD -#### Hadrware connections -#### How to build and run example -## How to use in your Project - simple case withoud user predefined characters +#### Hardware connections +#### How to build and run the example +## How to use in your Project - simple case without user-predefined characters 1. Copy LCD library src files (or files from src folder) to your project. 2. In lcd_hd44780.config.h - Define specific **LCD_TYPE** and usage of **RW Pin**
@@ -281,7 +281,7 @@ Library main header file with available library api.       OFF - when RW pin is not connected
-3. Declare the LCD IO driver interface in your application on GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h +3. Declare the LCD IO driver interface in your application on the GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h ```C /************LCD_IO_driver_interface implementation START**************/ static const struct LCD_IO_driver_interface_struct LCD_IO_driver = { @@ -301,7 +301,7 @@ const struct LCD_IO_driver_interface_struct *LCD_IO_driver_interface_get(void) } ``` -It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find template with empty definitions of all required interface elements as well as a few files with examples of implementations for different microcontrollers. Additional details of the implementation in project can be also found in **./examples** folder. +It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find a template with empty definitions of all required interface elements as well as a few files with examples of implementations for different microcontrollers. Additional details of the implementation in the project can be also found in **./examples** folder. ## How to use in your Project - advanced case @@ -321,8 +321,8 @@ It's a basic interface that connects the library with your HW driver layer in th ```C /******************************** LCD LIBRARY COMPILATION SETTINGS ************************ * Setting USE_(procedure name) to: - * ON - add specific procedure to complilation - * OFF - exclude specific procedure from complitaion + * ON - add specific procedure to compilation + * OFF - exclude specific procedure from compilation ********************************************************************************************/ #define USE_DEF_CHAR_FUNCTION ON #define USE_LCD_INT ON @@ -337,7 +337,7 @@ It's a basic interface that connects the library with your HW driver layer in th ```
3. If setting USE_DEF_CHAR_FUNCTION   ON define special characters and character banks in lcd_hd44780_def_char.h
For more details about defining custom char please refer to [How to define custom characters and custom character banks.](#how-to-define-custome-charatcters-and-custom-character-banks) -4. Declare the LCD IO driver interface in your application on GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h
+4. Declare the LCD IO driver interface in your application on the GPIO driver side. This interface should contain the following implementation defined in lcd_hd44780_interface.h

```C /************LCD_IO_driver_interface implementation START**************/ @@ -358,7 +358,7 @@ It's a basic interface that connects the library with your HW driver layer in th } ```
- It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find template with empty definitions of all required interface elements as well as a few files with examples of implementation for different microcontrollers. Additional details of the implementation in project can be also found in **./examples** folder. + It's a basic interface that connects the library with your HW driver layer in the application without making any dependencies between them.
In **.src/lcd_driver_intrface_example_implementations** folder you can find a template with empty definitions of all required interface elements as well as a few files with examples of implementation for different microcontrollers. Additional details of the implementation in the project can be also found in **./examples** folder. ## How to define custom characters and custom character banks. ### Example of Correspondence between EPROM Address Data and Character Pattern (5 × 8 Dots)
@@ -468,11 +468,11 @@ LCD_HD44780 Folder description: - .github -> Folder with githubactions .yml scripts - .vscode -> folder with vscode example settings for luch.json and tasks.json -- doc -> folder for any documentations needes or created in the project -- hxamples -> folder with example hardware implementations contain ready to compile examples for different uC -- test -> folder where all tests are written. Folder contain fallowing subfolders: - - hw_test -> folder with configurations/setups for specyfic ucontrollers to make integration tests - - lcd_hd44780 -> folder where all unit tests for lcd_hd44780 module are keept +- doc -> folder for any documentation needed or created in the project +- examples -> folder with example hardware implementations contain ready to compile examples for different uC +- test -> folder where all tests are written. The folder contains following subfolders: + - hw_test -> folder with configurations/setups for specific ucontrollers to make integration tests + - lcd_hd44780 -> folder where all unit tests for lcd_hd44780 module are kept - template -> empty setup for uint test (copy, paste, rename, edit for new module unit testing) - unity -> unity framework From 7130fd6f5afa4e4cc31ff84dc42e32a329dc425b Mon Sep 17 00:00:00 2001 From: niwciu <57457942+niwciu@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:36:12 +0100 Subject: [PATCH 4/5] LCD: lcd_hd44780_config.h REFACTOR corrections to errors in description --- src/lcd_hd44780_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lcd_hd44780_config.h b/src/lcd_hd44780_config.h index 29450e0..70477a8 100644 --- a/src/lcd_hd44780_config.h +++ b/src/lcd_hd44780_config.h @@ -18,20 +18,20 @@ extern "C" // clang-format off /************************************ LCD HARDWARE SETTINGS ******************************* - * LCD_TYPE -> set one of the predefined types: + * LCD_TYPE -> Set one of the predefined types: * 2004 -> 4 lines 20 characters per line * 1604 -> 4 lines 16 characters per line * 1602 -> 2 lines 16 characters per line * USE_RW_PIN -> Defines HW connection between LCD and uC - * ON - when RW pin is connected - * OFF - when RW pin is not connected + * ON - when the RW pin is connected + * OFF - when the RW pin is not connected ********************************************************************************************/ #define LCD_TYPE 1602 #define USE_RW_PIN OFF #define LCD_BUFFERING ON -//definitions of Line and collumn labels for lcd_locate +//definitions of Line and column labels for lcd_locate enum LCD_LINES { LINE_1, @@ -50,8 +50,8 @@ enum LCD_COLUMNS{ /******************************** LCD LIBRARY COMPILATION SETTINGS ************************ * Setting USE_(procedure name) to: - * ON - add specific procedure to complilation - * OFF - exclude specific procedure from complitaion + * ON - add specific procedure to compilation + * OFF - exclude specific procedure from compilation ********************************************************************************************/ #define USE_DEF_CHAR_FUNCTION ON #define USE_LCD_INT ON @@ -70,7 +70,7 @@ enum LCD_COLUMNS{ #endif -/******************** definitions of Line addres for different lcd screens ****************/ +/******************** definitions of Line address for different LCD screens ****************/ //https://web.alfredstate.edu/faculty/weimandn/lcd/lcd_addressing/lcd_addressing_index.html #if LCD_TYPE ==1604 @@ -103,4 +103,4 @@ enum LCD_COLUMNS{ #ifdef __cplusplus } #endif /* __cplusplus */ -#endif /* _LCD_HD44780_CONFIG_H_ */ \ No newline at end of file +#endif /* _LCD_HD44780_CONFIG_H_ */ From dc672f99053bb8f8714de09780b3964847513b8a Mon Sep 17 00:00:00 2001 From: niwciu <57457942+niwciu@users.noreply.github.com> Date: Mon, 15 Jan 2024 10:59:16 +0100 Subject: [PATCH 5/5] LCD: Update lcd_hd44780.c Added missing function description and made some corrections to errors in descriptions. --- src/lcd_hd44780.c | 102 ++++++++++++++++++++++++++++------------------ 1 file changed, 62 insertions(+), 40 deletions(-) diff --git a/src/lcd_hd44780.c b/src/lcd_hd44780.c index 5a89151..aa3a84a 100644 --- a/src/lcd_hd44780.c +++ b/src/lcd_hd44780.c @@ -488,7 +488,7 @@ void write_lcd_buf_2_lcd(const uint8_t * lcd_cursor_position, const uint8_t *lcd #endif /** - * @brief Function that initialize LCD in 4-bit mode with or without LCD R/W Pin handling. + * @brief Function that initializes LCD in 4-bit mode with or without LCD R/W Pin handling. * @attention LCD R/W handling should be configured in lcd_hd44780_config.h by setting USE_RW_PIN to 1 (Enable R/W Pin * handling) or 0 (disable R/W Pin handling). */ @@ -497,7 +497,7 @@ void lcd_init(void) register_LCD_IO_driver(); LCD->init_LCD_pins(); /**************************BASIC LCD INIT - basing on DS init procedure***************************************/ - // set all LCD signals to High for more than 15ms ->bit different then in DS base on other implementation from internet + // set all LCD signals to High for more than 15ms ->bit different than in DS based on other implementations from the internet lcd_set_all_SIG(); LCD->delay_us(15000); lcd_reset_all_SIG(); @@ -519,7 +519,7 @@ void lcd_init(void) lcd_write_cmd(LCDC_ONOFF | LCDC_CURSOROFF | LCDC_DISPLAYON); // LCD clear screen lcd_cls(); - // ENTRY MODe SET do not shift LCD shift cursor right after placing a char + // ENTRY MODe SET do not shift the LCD shift cursor right after placing a char lcd_write_cmd(LCDC_ENTRY_MODE | LCDC_ENTRYR); /*********************************END of BASIC LCD INIT***************************************/ #if LCD_BUFFERING == ON @@ -527,14 +527,14 @@ void lcd_init(void) lcd_buf_cls(); //copy lcd_buffer with spaces to prev_lcd_buffer copy_lcd_buf_2_prev_lcd_buf(); - // clear flag due to init procedure that reset lcd screan and buffers + // clear flag due to init procedure that reset LCD screen and buffers LCD_UPDATE_EVENT=false; #endif } /** - * @brief Function that clear the LCD screen and set the cursor on the position of first character in first line of LCD + * @brief Function that clears the LCD screen and sets the cursor on the position of the first character in the first line of the LCD * screen. */ void lcd_cls(void) @@ -548,7 +548,7 @@ void lcd_cls(void) #if USE_DEF_CHAR_FUNCTION == ON /** * @brief Function for defining custom user characters in CGRAM of the LCD. - * @param CGRAM_char_index Position/addres of the character in CGRAM of the LCD where defined char should be written. + * @param CGRAM_char_index Position/address of the character in CGRAM of the LCD where defined char should be written. * For the predefined example of special characters, taken values are defined in the type enum LCD_CGRAM that is defined * in lcd-hd44780.h * @param def_char Pointer to the predefined special character. @@ -579,9 +579,9 @@ void lcd_load_char_bank(const struct char_bank_struct *char_bank) #endif /** - * @brief Function for print the char on the LCD screen under current position of the LCD cursor. - * @param C char (for example '1') or it's ASCI code (0x31). - * @note For user defined char, place CGRAM_char_index (Position/addres of the character in CGRAM of the LCD where + * @brief Function for printing the char on the LCD screen under the current position of the LCD cursor. + * @param C char (for example '1') or its ASCI code (0x31). + * @note For user-defined char, place CGRAM_char_index (Position/address of the character in CGRAM of the LCD where * defined char was written). */ void lcd_char(const char C) @@ -591,8 +591,7 @@ void lcd_char(const char C) } /** - * @brief Function for printing/writing string on LCD screen. Writing the string on LCD screen start from current LCD - * cursor position. + * @brief Function for printing/writing the string on the LCD screen starting from the current LCD cursor position. * @param str string that should be printed/written on the LCD screen */ void lcd_str(const char *str) @@ -606,12 +605,12 @@ void lcd_str(const char *str) #if USE_LCD_INT == ON /** - * @brief Function for print the integer value on the LCD screen under current position of the LCD cursor. + * @brief Function for printing the integer value on the LCD screen under the current position of the LCD cursor. * @param val int type value to print on LCD screen * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the * result is padded with blank spaces. The value is not truncated even if the result is larger. - * @param alignment If the value to be printed is shorter than width, this parmaeter will specify aligment of the - * printed tekst value. This parameter can be set to "left" or "right" + * @param alignment If the value to be printed is shorter than the width, this parameter will specify the alignment of the + * printed text value. This parameter can be set to "left" or "right" * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_int(int val, uint8_t width, enum alignment alignment) @@ -632,14 +631,14 @@ void lcd_int(int val, uint8_t width, enum alignment alignment) #if USE_LCD_HEX == ON /** - * @brief Function for print the integer value in hexadecimal format on the LCD screen under current position of the LCD + * @brief Function for printing the integer value in hexadecimal format on the LCD screen under the current position of the LCD * cursor. * @param val int type value to print on LCD screen in hexadecimal format * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the - * result is padded with blank spaces. The value is not truncated even if the result is larger. Width should contain - * additional 2 characters for '0x' at the begining of the printed value. - * @param alignment If the value to be printed is shorter than width, this parmaeter will specify aligment of the - * printed tekst value. This parameter can be set to "left" or "right" + * result is padded with blank spaces. The value is not truncated even if the result is larger. The width should contain + * additional 2 characters for '0x' at the beginning of the printed value. + * @param alignment If the value to be printed is shorter than the width, this parameter will specify the alignment of the + * printed text value. This parameter can be set to "left" or "right" * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_hex(int val, uint8_t width, enum alignment alignment) @@ -660,12 +659,12 @@ void lcd_hex(int val, uint8_t width, enum alignment alignment) #if USE_LCD_BIN == ON /** - * @brief Function for print the integer value in hexadecimal format on the LCD screen under current position of the LCD + * @brief Function for printing the integer value in hexadecimal format on the LCD screen under the current position of the LCD * cursor. * @param val int type value to print on LCD screen in hexadecimal format * @param width Minimum number of characters to be printed. If the value to be printed is shorter than this number, the - * result is padded with blank spaces. The value is not truncated even if the result is larger. Width should contain - * additional 2 characters for '0x' at the begining of the printed value. + * result is padded with blank spaces. The value is not truncated even if the result is larger. The width should contain + * additional 2 characters for '0x' at the beginning of the printed value. * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_bin(int val, uint8_t width) @@ -692,7 +691,7 @@ void lcd_bin(int val, uint8_t width) #endif /** - * @brief Function that move LCD cursor to specific posiotion located under x and y coordinate + * @brief Function that moves LCD cursor to a specific position located under the x and y coordinate * @param y LCD row/line number. Defined enum value LINE_1, LINE_2,... etc. * @param x LCD column number. Defined enum value C1, C2, C3,... etc. */ @@ -726,7 +725,7 @@ void lcd_locate(enum LCD_LINES y, enum LCD_COLUMNS x) } #if USE_LCD_CURSOR_HOME == ON /** - * @brief Function that move lcd cursor to the first posision at first row of LCD screen + * @brief Function that moves LCD cursor to the first position at the first row of the LCD screen */ void lcd_home(void) { @@ -767,6 +766,10 @@ void lcd_blinking_cursor_on(void) #endif #if LCD_BUFFERING == ON +/** + * @brief Function that puts spaces(0x32) in the whole LCD buffer and sets the cursor on the position of the first character in the first line of the LCD + * buffer. + */ void lcd_buf_cls(void) { for(lcd_buf_position_ptr=&lcd_buffer[LINE_1][C1]; lcd_buf_position_ptr<=&lcd_buffer[LAST_LCD_LINE][LAST_CHAR_IN_LCD_LINE]; lcd_buf_position_ptr++) @@ -777,6 +780,12 @@ void lcd_buf_cls(void) LCD_UPDATE_EVENT=true; } +/** + * @brief Function for adding the char to the LCD buffer under the current position of the LCD buffer. + * @param C char (for example '1') or its ASCI code (0x31). + * @note For user-defined char, place CGRAM_char_index (Position/address of the character in CGRAM of the LCD where + * defined char was written). + */ void lcd_buf_char(const char c) { *lcd_buf_position_ptr=c; @@ -784,11 +793,20 @@ void lcd_buf_char(const char c) LCD_UPDATE_EVENT=true; } +/** + * @brief Function that changes the current LCD buffer position pointer to a specific position located under the x and y coordinate + * @param y LCD row/line number. Defined enum value LINE_1, LINE_2,... etc. + * @param x LCD column number. Defined enum value C1, C2, C3,... etc. + */ void lcd_buf_locate(enum LCD_LINES y, enum LCD_COLUMNS x) { lcd_buf_position_ptr=&lcd_buffer[y][x]; } +/** + * @brief Function for placing the string in the LCD buffer starts from the current LCD buffer position pointer. + * @param str string that should be placed in the LCD buffer + */ void lcd_buf_str(const char *str) { while (*str) @@ -799,6 +817,10 @@ void lcd_buf_str(const char *str) LCD_UPDATE_EVENT=true; } +/** + * @brief Function that prints on the LCD screen the content of The LCD buffer. + * The function sets also The LCD buffer position pointer to the First line's first character. + */ void lcd_update(void) { uint8_t lcd_cursor_position=0; @@ -820,12 +842,12 @@ void lcd_update(void) #if USE_LCD_BUF_INT == ON /** - * @brief Function for adding intiger value as string to the LCD buffer under current position of the LCD buffer pointer. + * @brief Function for adding integer value as string to the LCD buffer under the current position of the LCD buffer pointer. * @param val int type value to add to LCD buffer * @param width Minimum number of characters to be added to LCD buffer. If the value to be added to the LCD buffer is shorter than width, the - * result is padded with blank spaces. The value to be added to buffer as string is not truncated if the string lenght is larger then width value. - * @param alignment If the value to be added to LCD buffer as string is shorter than width, this parameter will specify alignment of the - * tekst represented the value. This parameter can be set to "left" or "right" + * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length is larger than the width value. + * @param alignment If the value is to be added to the LCD buffer as a string is shorter than the width, this parameter will specify the alignment of the + * text representing the value. This parameter can be set to "left" or "right" * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_buf_int(int val, uint8_t width, enum alignment alignment) @@ -846,13 +868,13 @@ void lcd_buf_int(int val, uint8_t width, enum alignment alignment) #if USE_LCD_BUF_HEX == ON /** - * @brief Function for adding intiger value in hexadecimal format as string to the LCD buffer under current position of the LCD buffer pointer. - * @param val int type value to add to LCD buffer as string in hexadecimal format - * @param width Minimum number of characters to be added to lcd buffer. If the value to be added to buffer is shorter than width, the - * result is padded with blank spaces. The value to be added to buffer as string is not truncated if the string lenght is larger then width value. Width should contain - * additional 2 characters for "0x" at the begining of the value represented as string. example: 0x01-> width=4 - * @param alignment If the value to be added to LCD buffer as string is shorter than width, this parameter will specify alignment of the -* tekst represented the value. This parameter can be set to "left" or "right" + * @brief Function for adding integer value in hexadecimal format as a string to the LCD buffer under the current position of the LCD buffer pointer. + * @param val int type value to add to LCD buffer as a string in hexadecimal format + * @param width Minimum number of characters to be added to lcd buffer. If the value to be added to the buffer is shorter than the width, the + * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length is larger than the width value. Width should contain + * additional 2 characters for "0x" at the beginning of the value represented as a string. example: 0x01-> width=4 + * @param alignment If the value to be added to the LCD buffer as a string is shorter than the width, this parameter will specify the alignment of the +* text represented the value. This parameter can be set to "left" or "right" * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_buf_hex(int val, uint8_t width, enum alignment alignment) @@ -873,11 +895,11 @@ void lcd_buf_hex(int val, uint8_t width, enum alignment alignment) #if USE_LCD_BUF_BIN == ON /** - * @brief Function for adding to the LCD buffer the integer value in binary format as string under current position of the LCD buffer pointer - * @param val int type value to be added to the LCD buffer as string in hexadecimal format - * @param width Minimum number of characters to be added to LCD buffer. If the value to be added to buffer as string lenght is shorter than width, the - * result is padded with blank spaces. The value to be added to buffer as string is not truncated if the string lenght represented the value i binary format lenght - * is larger then width value. Width should contain additional 2 characters for "0b" at the begining of the value represented as string. example: 0b01-> width=4 + * @brief Function for adding to the LCD buffer the integer value in binary format as a string under the current position of the LCD buffer pointer + * @param val int type value to be added to the LCD buffer as a string in hexadecimal format + * @param width Minimum number of characters to be added to LCD buffer. If the value to be added to the buffer as string length is shorter than width, the + * result is padded with blank spaces. The value to be added to the buffer as a string is not truncated if the string length represents the value in binary format length + * is larger than the width value. The width should contain an additional 2 characters for "0b" at the beginning of the value represented as a string. example: 0b01-> width=4 * @attention to compile for AVR ucontrollers definition of flag AVR is required. */ void lcd_buf_bin(int val, uint8_t width)