Compare commits
16 Commits
19dec1ee05
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9170524d33 | ||
|
|
cda395d6b9 | ||
|
|
d8da84cffc | ||
|
|
f6a13309f7 | ||
|
|
9c93179bf0 | ||
|
|
38b8bb0657 | ||
|
|
b147d92423 | ||
|
|
13f01d13f8 | ||
|
|
ebe03f42b6 | ||
|
|
a1c742c1cd | ||
|
|
3e0018d1cb | ||
|
|
1f5bc11ddd | ||
|
|
79db5bb8a0 | ||
|
|
bb1a24e7b3 | ||
|
|
04085c97f1 | ||
|
|
b52c78d056 |
@@ -54,6 +54,8 @@
|
||||
pkgs.probe-rs
|
||||
pkgs.probe-rs-tools
|
||||
pkgs.bear
|
||||
pkgs.chafa
|
||||
pkgs.imagemagick
|
||||
mbedTools
|
||||
pyOcd
|
||||
];
|
||||
|
||||
8
semestralka1/.clangd
Normal file
@@ -0,0 +1,8 @@
|
||||
CompileFlags:
|
||||
Add:
|
||||
-isystem
|
||||
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/arm-none-eabi/include
|
||||
-isystem
|
||||
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include
|
||||
-isystem
|
||||
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include-fixed
|
||||
25
semestralka1/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
.build
|
||||
.mbed
|
||||
projectfiles
|
||||
*.py*
|
||||
|
||||
# Local build directories
|
||||
cmake_build/
|
||||
BUILD/
|
||||
mbed-os/
|
||||
.mbed/
|
||||
.mbedignore
|
||||
*.elf
|
||||
*.bin
|
||||
*.hex
|
||||
*.map
|
||||
|
||||
# IDE and temporary files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.log
|
||||
*.pyc
|
||||
__pycache__/
|
||||
.cache/
|
||||
|
||||
compile_commands.json
|
||||
42
semestralka1/CMakeLists.txt
Normal file
@@ -0,0 +1,42 @@
|
||||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||
|
||||
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
|
||||
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||
set(APP_TARGET mbed-os-example-blinky)
|
||||
|
||||
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||
|
||||
project(${APP_TARGET})
|
||||
|
||||
add_subdirectory(${MBED_PATH})
|
||||
|
||||
add_executable(${APP_TARGET})
|
||||
|
||||
# Recursively collect all .cpp files under src/
|
||||
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
|
||||
target_sources(${APP_TARGET}
|
||||
PRIVATE
|
||||
${SRC_FILES}
|
||||
)
|
||||
|
||||
# Make includes of headers work
|
||||
target_include_directories(${APP_TARGET}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(${APP_TARGET}
|
||||
PRIVATE
|
||||
mbed-os
|
||||
)
|
||||
|
||||
mbed_set_post_build(${APP_TARGET})
|
||||
|
||||
option(VERBOSE_BUILD "Have a verbose build process")
|
||||
if(VERBOSE_BUILD)
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif()
|
||||
5
semestralka1/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Semestralka na VPS
|
||||
|
||||
Tato hra je najsamlepsejsia na celom svete.
|
||||
Iba si treba matchnut baudrate a moze sa gamesit.
|
||||
|
||||
BIN
semestralka1/chafa/background/background.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
semestralka1/chafa/background/background_dark.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
19
semestralka1/chafa/background/background_dark_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
~`````````````````````````````````````````````````````````````````````````````````````"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````
|
||||
...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................
|
||||
..........................."............................................._................................+...........................................................................................................,..............................................`..............................................................!........................
|
||||
.......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....
|
||||
...`......................"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....
|
||||
,,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,
|
||||
,,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''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FFF5@@@R#=PFFF~~~,,,,aggy_..,__,.._,_$@PPRRRRR#$4GRRRRR@@@@@@@@@@F
|
||||
...,,,:::::4@@@@@@~...,,,,,,,,,,$@$:_@@@@@_ggaggg@@F~.::::,,,,,,,,,,,yyyyyy,_yggg@@@@@@@@MF#$ggagggyww::$@M@@@@..~$.,,:3@@@$A::::,"@@g$_:d@@..~~@~`,,,,,,,,,,yyyx,,,,,,,ggg_......,,::::::@@@@@@$....:,,,,,,,,,@@:_$@@@@yg$g$ggg@@~`::::,,,,,,,,,,,yyyyyy_,yygg$@@@@@@@@F5aagggggyyw,:d@P@@@@L.`5r,,,:@@@@UL`:::,N@@gy.:@@F.>~5F~,,,,,,,,,,,yyy,,,,,,,,ggy...
|
||||
...,,,,,,,,4@@@$g@....,7^=sa@@$a@@@@@@@@@@@@@@@@@@~``.`,,,,,,,,:::`,g@R@BZa$TTTTF5PM@@@@^:`'`~T5#@@y_`,u@~$@$@@g_,F,,,,`@@@@'':^na$g@@@=_:@@.`,.4__,,,,,,,,,g@@K:,,,,,,g@@@@w....,,,,,,,,,$@@$g@F...,,^=#aa@$gg@@@@@@@@@@@@@@@@@F``.`,,,,,,,,,::`,:@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..
|
||||
..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'"``':,!$FP~:,,,,,~~7@y.~A@mg@'."@F::,,,,,,4ER~,,,,,,,g@@@@@..
|
||||
..:`::':''~F@@@@@....:````:`:,``"FB@P~5@@@$~~3@@L....::``',:``,:::,`g@@@@@@@@.```.:7@@@F:`````````::,:`@Fy@@$@@@F.::`:::`$@@L`````````~%.`$F.B`..`B::::````4PF````````@@@@@@B...,:,,:::``TM@@@@$...:````:,`````7M$@F~@@@@~~"@@@.....:,`',:'`':::,,x@@@@@@@@,....`:@@@@:``````````:::,g@ya@@@@@@.,'`'::`4@@g,```,`````4.."@.$^...4~`::````_RP~```````g@@@@@@L.
|
||||
.,,`,```,,``@@@@@,,.``````````,,4@~,,,"$@@$,,$@@m',..,,,``,,````,``g@@@@@@@@@,'`,..,"Z@F``````````````_a@@@@@@@@'.`,,````~@@F``,````,,,,,,4(``....`'```,,,g@~,,``````g@@@@@@@,,.,,,```,,,`4@@@@~,.,```````'`,,`B$,,,,$gZ$r,:@@@',...,,,``,````,``:@@@@$@@@@@.',...`~@@```````````````D$@@@@@@@E,``:`````@@R``,````,,,,,,`R'['.,..,````,,`@B,,``````g@@@@@@@L,
|
||||
.',,,,,,,,,,4@@@E,,,,,,,,,,,,,,,,@,,,,,5@@@,,$@@@,,..,,,,,,,,,,,,,,@@@@@@@@@@@,,,..`,,@F,,,,,,,,,,,,,,@@@@@@@@@@,,',,,,,,,~,,,,,,,,,,,,,,,,L,..,,.':,,,,,y@~,,,,,,,,g@@@@@@@@,,.',,,,,,,,,,@@@@,,.:,,,,,,,,,,,,$F,,,,"@@@F,d@@@,,,..,,,,,,,,,,,,,d@@@@@@@@@@L,,,..,,4@,,,,,,,,,,,,,,g@@@@@@@@@F,,',,,,,,~^,,,,,,,,,,,,,,,T,...,..,,,,,,,$E,,,,,,,,y@@@@@@@@$,
|
||||
19
semestralka1/chafa/background/background_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
......................````````````````````................................`````````````````````.....................................................................................................````````````````````...............................`````````````````````.................................................................................
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
......................................................................................`..................................................'..........................................................................................................................`..................................................'.....................................
|
||||
.............................................................................................................................................................................................................................................................................................................................................................
|
||||
........................................................................................................................................................................................................................................................`....................................................................................................
|
||||
........................'''`'''''``............'`'''''......._,_yr,..._,,........................................................................_,,,,................................................'''`'''''``............'`'''''......,_,yy+,..._,,........................................................................_,,,,.........................
|
||||
..................```.......................................```~~``^?~"``::.,,,,,,,,,,,::::````'````..........``'''...`......,,,,,,,:,,:,,,,..,,:~````:,,,............,,,,......................```.......................................``"~~``^?~```:..,,,,,,,,,,,:::'`````````..........````'...`......,,,,,,::,,:,,,,..,,:~```',,,,............,,,,.....
|
||||
.''``''`....`..............................................................._..`````.......................................```````'`````````''`````````..............``````````'''`''`....`..............................................................._..`````.......................................````'``'`````````''`````````..............`````````'
|
||||
._.............................____yyyyyyyagggggggggggggggggggggga_..........~Th=ay__.............._____yyyyyyyyyyyyyyyyy___...+_.........................agyy_yyyyyyyyyyyyyyy_,.............................____yyyyyyyagggggggggggggggggggggga,..........~T=*wy_,.............,_____yyyyyyyyyyyyyyyy____..:._.........................agyy_yyyyyyyyyyyyyyy_
|
||||
.@@$gyy_,.....__yyyyyaggg$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@@@@$gyy_,.....__yyyyyagg$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@$
|
||||
.@@@@@@@@@$g@@@@@@@@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@@@@@@@@@@@@@@$
|
||||
.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$
|
||||
.RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR4RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRF
|
||||
4
semestralka1/chafa/chafa_commands.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
nix-shell -p imagemagick
|
||||
identify background.jpg
|
||||
chafa --symbols ascii --fill none --size=6912x793 background.jpg > out.txt
|
||||
chafa --symbols ascii-block -c none --fill none --invert --size=349x40 background_dark.jpg > background_dark_inverted.txt
|
||||
7
semestralka1/chafa/character/2out.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
.....a@$..
|
||||
.....7PF..
|
||||
..yaM@@__y
|
||||
..@.y@FFF~
|
||||
..._$M@_..
|
||||
yaa@~.`@y.
|
||||
........@r
|
||||
7
semestralka1/chafa/character/3out.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
.g@$
|
||||
.7PF
|
||||
y@$.
|
||||
0@F.
|
||||
4@$.
|
||||
y$@.
|
||||
u@..
|
||||
9
semestralka1/chafa/character/out.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
......_g@$w..
|
||||
......4@@@F..
|
||||
.....yyyy`...
|
||||
...g@~@@@y_ys
|
||||
..4F..@@FTF~.
|
||||
.....g@@g,...
|
||||
..._a@^.4@_..
|
||||
4R@F~....7@y.
|
||||
..........~@.
|
||||
4
semestralka1/chafa/character/out_crawl1.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
.._$@.
|
||||
.$By`.
|
||||
4@$@@a
|
||||
aa@W@.
|
||||
3
semestralka1/chafa/character/out_crawl2.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
a@@Bw_,
|
||||
7@@Db@$
|
||||
4@@PF#@
|
||||
BIN
semestralka1/chafa/character/predloha.jpg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
semestralka1/chafa/character/predloha2.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
semestralka1/chafa/character/predloha2_scaled.xcf
Normal file
BIN
semestralka1/chafa/character/predloha_crawl1.jpg
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
semestralka1/chafa/character/predloha_crawl2.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
semestralka1/chafa/character/predloha_run_a.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
semestralka1/chafa/character/predloha_run_b.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
4
semestralka1/chafa/character/run_chafa.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
chafa --symbols ascii-block -c none --fill none --invert --size=13x20 predloha_run_a.jpg > out.txt
|
||||
|
||||
a = 78x111
|
||||
b = 34x111
|
||||
1
semestralka1/mbed-os.lib
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
|
||||
BIN
semestralka1/resources/official_armmbed_example_badge.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
22
semestralka1/src/background_dark_inverted.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// background_dark_inverted.h
|
||||
#pragma once
|
||||
|
||||
static const char *BACKGROUND_MASK[] = {
|
||||
"~`````````````````````````````````````````````````````````````````````````````````````\"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````",
|
||||
"...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................",
|
||||
"...........................\"............................................._................................+...........................................................................................................,..............................................`..............................................................!........................",
|
||||
".......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....",
|
||||
"...`......................\"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........\".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....",
|
||||
",,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,",
|
||||
",,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''',,,,,,,yy___ygR^,.,`'`,,,,,,wa###$@R@:,,,,,,,,,,,,,,,,,,,,,,,,,,'''''',,X,,~T@@R,,,,,,,,",
|
||||
"@@@@@@@@@@@@@@$~`,'________~TF?5#@@@@@@@``4@@E,,,4@@@@@@@@@@@@@#MT~yg$^$P_____..,...:_________@@______;'...'.?@@@@@@@@@@@@@@@@@@@@@@@@@@@MR@@@@@@@@@@B,,,,,,,4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@P...________~TFFF#R@@@@@@F,`$@@,,,,@@RR@@@@@@@@@RPF~_g$Mb$______..,..,_________9@y______',....~$@@@@@@@@@@@@@@@@@@@@@@@@@@##R@@@@@@@@@@~,,,,,,~@@@@@@@@@@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@yggy@@@@@@@@@@@@@@@@@@@@$$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@g$@@@@@@yy$ggg$@@@@@@@@@g$@@@@@@$$_g____@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ggggggg@@@@@@@@@PM@@@@@@@@@@@@@@@@@@@@@@gygy$@@@@@@@@@@@@@@@@@@@@$$$@@@@@@@@@@@@@@@@@@@@@@@@@@@gg@@@@@@gyg$ggg@@@@@@@@@F$$@@@@@@$Fyw___4@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ggggg$gg@@@@@@@@@F@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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~`,,,,ggg,_.,___..._,y@PPPRRRR###5RRRRRR@@@@@@@@@PFFT~~~~~``..___yyyg....,,,,,,,,,,yy,,yyyyy,.,....._g@PPPPPP4PPPPPPRRRRRRRRRRRR@@@@@@@@@@@ETTT~~~~~~~~~~FFFFFFFFF5@@@R#=PFFF~~~,,,,aggy_..,__,.._,_$@PPRRRRR#$4GRRRRR@@@@@@@@@@F",
|
||||
"...,,,:::::4@@@@@@~...,,,,,,,,,,$@$:_@@@@@_ggaggg@@F~.::::,,,,,,,,,,,yyyyyy,_yggg@@@@@@@@MF#$ggagggyww::$@M@@@@..~$.,,:3@@@$A::::,\"@@g$_:d@@..~~@~`,,,,,,,,,,yyyx,,,,,,,ggg_......,,::::::@@@@@@$....:,,,,,,,,,@@:_$@@@@yg$g$ggg@@~`::::,,,,,,,,,,,yyyyyy_,yygg$@@@@@@@@F5aagggggyyw,:d@P@@@@L.`5r,,,:@@@@UL`:::,N@@gy.:@@F.>~5F~,,,,,,,,,,,yyy,,,,,,,,ggy...",
|
||||
"...,,,,,,,,4@@@$g@....,7^=sa@@$a@@@@@@@@@@@@@@@@@@~``.`,,,,,,,,:::`,g@R@BZa$TTTTF5PM@@@@^:`'`~T5#@@y_`,u@~$@$@@g_,F,,,,`@@@@'':^na$g@@@=_:@@.`,.4__,,,,,,,,,g@@K:,,,,,,g@@@@w....,,,,,,,,,$@@$g@F...,,^=#aa@$gg@@@@@@@@@@@@@@@@@F``.`,,,,,,,,,::`,:@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..",
|
||||
"..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,\"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'\"``':,!$FP~:,,,,,~~7@y.~A@mg@'.\"@F::,,,,,,4ER~,,,,,,,g@@@@@..",
|
||||
};
|
||||
static const int VIEW_HEIGHT = sizeof(BACKGROUND_MASK) / sizeof(BACKGROUND_MASK[0]);
|
||||
26
semestralka1/src/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// main.cpp
|
||||
|
||||
#include "mbed.h"
|
||||
#include "background_dark_inverted.h"
|
||||
#include "render/loop.h"
|
||||
|
||||
#define TARGET_TX_PIN USBTX
|
||||
#define TARGET_RX_PIN USBRX
|
||||
#define BAUD_RATE 460800
|
||||
|
||||
BufferedSerial serial_port(TARGET_TX_PIN, TARGET_RX_PIN, BAUD_RATE);
|
||||
|
||||
FileHandle *mbed::mbed_override_console(int fd)
|
||||
{
|
||||
return &serial_port;
|
||||
}
|
||||
|
||||
DigitalOut led(LED1);
|
||||
|
||||
int main(void) {
|
||||
serial_port.set_format(8, BufferedSerial::None, 1);
|
||||
printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE);
|
||||
|
||||
// Just call into render feature
|
||||
render_loop(4);
|
||||
}
|
||||
35
semestralka1/src/render/background.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
// src/render/background.cpp
|
||||
|
||||
#include "../background_dark_inverted.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text) {
|
||||
const int view_width = 90;
|
||||
const int view_height = 16;
|
||||
|
||||
// Terminal clear + home
|
||||
printf("\033[2J\033[H");
|
||||
|
||||
for (int i = 0; i < view_height && i < VIEW_HEIGHT; i++) {
|
||||
const char *row = BACKGROUND_MASK[i];
|
||||
int width = strlen(row);
|
||||
if (width == 0) {
|
||||
printf("\r\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
int start = shift % width;
|
||||
|
||||
for (int j = 0; j < view_width; j++) {
|
||||
printf("%c", row[(start + j) % width]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
if (text && text[0] != '\0') {
|
||||
printf("\r\n[RX] %s\r\n", text);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
6
semestralka1/src/render/background.h
Normal file
@@ -0,0 +1,6 @@
|
||||
// src/render/background.h
|
||||
|
||||
#pragma once
|
||||
|
||||
// Draws the ASCII art background with optional message
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr);
|
||||
174
semestralka1/src/render/loop.cpp
Normal file
@@ -0,0 +1,174 @@
|
||||
// src/render/loop.cpp
|
||||
#include "loop.h"
|
||||
#include "../background_dark_inverted.h"
|
||||
#include "player_positioning.h"
|
||||
#include "background.h"
|
||||
#include "mbed.h"
|
||||
#include "player.h"
|
||||
#include "player_mask.h"
|
||||
#include <cstring>
|
||||
|
||||
extern BufferedSerial serial_port;
|
||||
extern DigitalOut led;
|
||||
|
||||
// Constants
|
||||
constexpr size_t BUFFER_SIZE = 64;
|
||||
constexpr auto CRAWL_DURATION = 300ms;
|
||||
constexpr auto ANIMATION_TICK = 170ms;
|
||||
constexpr auto MESSAGE_DISPLAY_DURATION = 1s;
|
||||
constexpr int PLAYER_X = 9;
|
||||
constexpr int PLAYER_Y = 6;
|
||||
|
||||
enum class PlayerState { Walk1, Walk2, Crawl1 };
|
||||
|
||||
struct WalkingState {
|
||||
PlayerState current_state = PlayerState::Walk1;
|
||||
Timer state_timer;
|
||||
};
|
||||
|
||||
static char rx_buffer[BUFFER_SIZE];
|
||||
static char message[BUFFER_SIZE];
|
||||
static bool message_active = false;
|
||||
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text);
|
||||
|
||||
// Returns:
|
||||
// 0 = no change - walk1
|
||||
// 1 = normal redraw - walk2
|
||||
// 2 = button triggered - crawl1
|
||||
static int read_uart() {
|
||||
bool changed = false;
|
||||
bool triggered = false;
|
||||
|
||||
// cita spravu z uartu
|
||||
if (serial_port.readable()) {
|
||||
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||
ssize_t num = serial_port.read(rx_buffer, sizeof(rx_buffer) - 1);
|
||||
if (num > 0) {
|
||||
led = !led; // toogle ledky
|
||||
strncpy(message, rx_buffer, sizeof(message) - 1);
|
||||
message_active = true;
|
||||
changed = true;
|
||||
triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
// casovac na 1s zobrazenia spravy
|
||||
static Timer msg_timer;
|
||||
static bool timer_started = false;
|
||||
if (!timer_started) {
|
||||
msg_timer.start();
|
||||
timer_started = true;
|
||||
}
|
||||
|
||||
// po jednu sekundu sa sprava zobrazi
|
||||
if (message_active && msg_timer.elapsed_time() > MESSAGE_DISPLAY_DURATION) {
|
||||
message_active = false;
|
||||
memset(message, 0, sizeof(message));
|
||||
msg_timer.reset();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (triggered)
|
||||
return 2; // LED toggled press
|
||||
if (changed)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool update_animation(Timer &anim_timer, int &shift, int speed) {
|
||||
if (anim_timer.elapsed_time() >= ANIMATION_TICK) {
|
||||
// speed determines scroll steps per tick
|
||||
shift += speed;
|
||||
anim_timer.reset();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int get_player_frame(PlayerState state) {
|
||||
switch (state) {
|
||||
case PlayerState::Walk1:
|
||||
return 0;
|
||||
case PlayerState::Walk2:
|
||||
return 1;
|
||||
case PlayerState::Crawl1:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void update_player_state(WalkingState &state) {
|
||||
// stop crawling
|
||||
if (state.current_state == PlayerState::Crawl1 &&
|
||||
state.state_timer.elapsed_time() >= CRAWL_DURATION) {
|
||||
state.current_state = PlayerState::Walk1;
|
||||
state.state_timer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
static void toggle_walk_frame(WalkingState &state) {
|
||||
if (state.current_state == PlayerState::Walk1) {
|
||||
state.current_state = PlayerState::Walk2;
|
||||
} else if (state.current_state == PlayerState::Walk2) {
|
||||
state.current_state = PlayerState::Walk1;
|
||||
}
|
||||
}
|
||||
|
||||
static void start_crawl(WalkingState &state) {
|
||||
state.current_state = PlayerState::Crawl1;
|
||||
state.state_timer.reset();
|
||||
state.state_timer.start();
|
||||
}
|
||||
|
||||
void render_loop(int speed) {
|
||||
WalkingState player_state;
|
||||
|
||||
Timer anim_timer;
|
||||
anim_timer.start();
|
||||
int shift = 0;
|
||||
|
||||
PlayerPosition pos = {PLAYER_X, PLAYER_Y};
|
||||
|
||||
const char *bg_file = "background_dark_inverted.txt";
|
||||
bool need_redraw = false;
|
||||
|
||||
while (true) {
|
||||
need_redraw = false;
|
||||
int uart_state = read_uart(); // returns 0/1/2
|
||||
|
||||
if (uart_state == 1) {
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
if (uart_state == 2) {
|
||||
// start crawl frame for x time
|
||||
start_crawl(player_state);
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
// Check if crawl duration expired
|
||||
update_player_state(player_state);
|
||||
|
||||
if (update_animation(anim_timer, shift, speed)) {
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
if (need_redraw) {
|
||||
draw_mask(bg_file, shift, message_active ? message : nullptr);
|
||||
int player_frame = get_player_frame(player_state.current_state);
|
||||
PlayerPosition draw_pos = get_aligned_frame_position(pos, player_frame);
|
||||
draw_player(draw_pos.x, draw_pos.y, player_frame);
|
||||
|
||||
// alternate between frame 0 and 1 when not crawling
|
||||
if (player_state.current_state != PlayerState::Crawl1) {
|
||||
toggle_walk_frame(player_state);
|
||||
}
|
||||
|
||||
ThisThread::sleep_for(50ms);
|
||||
}
|
||||
|
||||
ThisThread::sleep_for(25ms);
|
||||
}
|
||||
}
|
||||
6
semestralka1/src/render/loop.h
Normal file
@@ -0,0 +1,6 @@
|
||||
// src/render/loop.h
|
||||
|
||||
#pragma once
|
||||
|
||||
// Runs the render loop: reads UART, animates, and draws output
|
||||
void render_loop(int speed);
|
||||
25
semestralka1/src/render/player.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// src/render/player.cpp
|
||||
|
||||
#include "player.h"
|
||||
#include "player_mask.h"
|
||||
#include <cstdio>
|
||||
|
||||
void draw_player(int x, int y, int frame_index) {
|
||||
if (frame_index < 0 || frame_index >= PLAYER_FRAME_COUNT)
|
||||
frame_index = 0; // fallback safety
|
||||
|
||||
const char **sprite = PLAYER_FRAMES[frame_index];
|
||||
int sprite_height = 0;
|
||||
if (frame_index == 0)
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_1;
|
||||
else if (frame_index == 1)
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_2;
|
||||
else
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_3;
|
||||
|
||||
// Draw the sprite starting from (x, y)
|
||||
for (int i = 0; i < sprite_height; i++) {
|
||||
printf("\033[%d;%dH%s", y + i + 1, x + 1, sprite[i]);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
5
semestralka1/src/render/player.h
Normal file
@@ -0,0 +1,5 @@
|
||||
// src/render/player.h
|
||||
#pragma once
|
||||
|
||||
// Draw the player object starting at given (x, y)
|
||||
void draw_player(int x, int y, int frame_index);
|
||||
50
semestralka1/src/render/player_mask.h
Normal file
@@ -0,0 +1,50 @@
|
||||
// src/render/player_mask.h
|
||||
|
||||
#pragma once
|
||||
|
||||
// Player frame 1
|
||||
static const char *PLAYER_MASK_FRAME_1[] = {
|
||||
".....a@$..",
|
||||
".....7PF..",
|
||||
"..yaM@@__y",
|
||||
"..@.y@FFF~",
|
||||
"..._$M@_..",
|
||||
"yaa@~.`@y.",
|
||||
"........@r"
|
||||
};
|
||||
|
||||
// Player frame 2
|
||||
static const char *PLAYER_MASK_FRAME_2[] = {
|
||||
".g@$",
|
||||
".7PF",
|
||||
"y@$.",
|
||||
"0@F.",
|
||||
"4@$.",
|
||||
"y$@.",
|
||||
"u@.."
|
||||
};
|
||||
|
||||
// Player frame 3 (triggered)
|
||||
static const char *PLAYER_MASK_FRAME_3[] = {
|
||||
".._$@.",
|
||||
".$By`.",
|
||||
"4@$@@a",
|
||||
"aa@W@."
|
||||
};
|
||||
|
||||
// Combine frames for easy access
|
||||
static const char **PLAYER_FRAMES[] = {
|
||||
PLAYER_MASK_FRAME_1, // 0
|
||||
PLAYER_MASK_FRAME_2, // 1
|
||||
PLAYER_MASK_FRAME_3 // 2 (triggered)
|
||||
};
|
||||
|
||||
static const int PLAYER_FRAME_COUNT = sizeof(PLAYER_FRAMES) / sizeof(PLAYER_FRAMES[0]);
|
||||
|
||||
// Line counts per frame
|
||||
static const int PLAYER_MASK_LINES_FRAME_1 =
|
||||
sizeof(PLAYER_MASK_FRAME_1) / sizeof(PLAYER_MASK_FRAME_1[0]);
|
||||
static const int PLAYER_MASK_LINES_FRAME_2 =
|
||||
sizeof(PLAYER_MASK_FRAME_2) / sizeof(PLAYER_MASK_FRAME_2[0]);
|
||||
static const int PLAYER_MASK_LINES_FRAME_3 =
|
||||
sizeof(PLAYER_MASK_FRAME_3) / sizeof(PLAYER_MASK_FRAME_3[0]);
|
||||
24
semestralka1/src/render/player_positioning.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// src/render/player_positioning.cpp
|
||||
#include "player_positioning.h"
|
||||
#include "../background_dark_inverted.h"
|
||||
#include <cstdio>
|
||||
|
||||
// Convert a pivot coordinate (bottom-left) to the top-left draw position
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index) {
|
||||
if (frame_index < 0 || frame_index >= PLAYER_FRAME_COUNT)
|
||||
frame_index = 0;
|
||||
|
||||
int sprite_height = 0;
|
||||
if (frame_index == 0)
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_1;
|
||||
else if (frame_index == 1)
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_2;
|
||||
else
|
||||
sprite_height = PLAYER_MASK_LINES_FRAME_3;
|
||||
|
||||
PlayerPosition draw_pos;
|
||||
draw_pos.x = base.x;
|
||||
draw_pos.y = (VIEW_HEIGHT - base.y) - sprite_height;
|
||||
|
||||
return draw_pos;
|
||||
}
|
||||
11
semestralka1/src/render/player_positioning.h
Normal file
@@ -0,0 +1,11 @@
|
||||
// src/render/player_positioning.h
|
||||
#pragma once
|
||||
#include "player_mask.h"
|
||||
|
||||
struct PlayerPosition {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
// Calculates drawing position relative to bottom-left pivot
|
||||
PlayerPosition get_aligned_frame_position(PlayerPosition base, int frame_index);
|
||||