-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from petrmadecki/main
Přidání podpory pro vlastní znak.
- Loading branch information
Showing
7 changed files
with
259 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
************************************************************************************************* | ||
* @file example_04-LCD_02-customChar.c | ||
* @author SPSE Havirov | ||
* @version 1.0.0 | ||
* @date 11-April-2023 [v0.1] | ||
* @history Viz CHANGELOG.md | ||
* @brief Testovaci program pro zobrazeni vlastniho znaku na LCD s radicem HD44780. | ||
* | ||
************************************************************************************************* | ||
* @attention | ||
* | ||
* Pripojeni LCD viz driver "LCD.h". | ||
* | ||
************************************************************************************************* | ||
* @copyright Copyright SPSE Havirov (c) 2023 * | ||
*********************************************** | ||
*/ | ||
|
||
#include "stm32f4xx.h" // Device header | ||
|
||
#define STEP 500 // Krok v ms pro pozdrzeni programu. | ||
#define CLK_DIV 1000 // Hodnota pro upravu CLK, viz hl. popisek v driveru pro praci s CLK. | ||
|
||
#define LCD_COLS 8 // Pocet sloupcu pouziteho LCD. | ||
#define LCD_ROWS 2 // Pocet radku pouziteho LCD. | ||
|
||
#include "chrono.h" // Pripojeni driveru pro praci s CLK. | ||
#include "LCD.h" // Pripojeni driveru pro praci s LCD. | ||
|
||
#include "LCD_customChar_table.h" // Pripojeni tabulky s vlastnimi znaky. | ||
|
||
int main() { | ||
SystemCoreClockUpdate(); // Do SystemCoreClock se nahraje frekvence jadra, viz hl. popisek v driveru pro praci s CLK. | ||
SysTick_Config(SystemCoreClock / CLK_DIV); // Konfigurace SysTick timeru, viz hl. popisek v driveru pro praci s CLK. | ||
|
||
LCD_setup(); // Pocatecni nastaveni LCD, nutne pro dalsi praci s LCD. | ||
|
||
LCD_customChar_write(0, batteryFull); // Ulozeni noveho znaku na zadanou pozici do CGRAM. | ||
|
||
LCD_customChar_read(0); // Zobrazeni vlastniho znaku ze zadane pozice v pameti. | ||
|
||
return 0; // Tento krok nebude nikdy vykonan z duvodu pouziti nekonecne smycky vyse (viz varovani pri kompilaci). | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
************************************************************************************************* | ||
* @file LCD_customChar_table.h | ||
* @author SPSE Havirov | ||
* @version 1.0.0 | ||
* @date 11-April-2023 [v0.1] | ||
* @history Viz CHANGELOG.md | ||
* @brief Definovani vlastnich znaku pro LCD s radicem HD44780. | ||
* | ||
************************************************************************************************* | ||
* @attention | ||
* | ||
* Pro generovani vlastnich znaku a jejich hexa kodu mozno vyuzit napriklad: | ||
* https://maxpromer.github.io/LCD-Character-Creator/ | ||
* | ||
************************************************************************************************* | ||
* @copyright Copyright SPSE Havirov (c) 2023 * | ||
*********************************************** | ||
*/ | ||
|
||
uint8_t fullChar[] = | ||
{ | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F // xxx 11111 | ||
}; | ||
|
||
uint8_t emptyChar[] = | ||
{ | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
0x00, // xxx 00000 | ||
}; | ||
|
||
uint8_t batteryFull[] = | ||
{ | ||
0x0E, // xxx 01110 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F, // xxx 11111 | ||
0x1F // xxx 11111 | ||
}; |