Compare commits
39 Commits
04085c97f1
...
v1.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd410c6f6c | ||
|
|
967b377e76 | ||
|
|
cf30946c0d | ||
|
|
2af725bfe7 | ||
|
|
c56dac3b6a | ||
|
|
ae2b8b91aa | ||
|
|
34c9d76389 | ||
|
|
09454e3ab4 | ||
|
|
07e295f2d9 | ||
|
|
42ad5ee7a2 | ||
|
|
cf07c9c47a | ||
|
|
ace0e2d706 | ||
|
|
8cb6892d30 | ||
|
|
de6facff03 | ||
|
|
2753aed573 | ||
|
|
0ff2be6564 | ||
|
|
11f5eb7fd1 | ||
|
|
285840b521 | ||
|
|
761b86585a | ||
|
|
528e38b428 | ||
|
|
a59192cf05 | ||
|
|
fa7e18e4d5 | ||
|
|
4ed4452fae | ||
|
|
b9ca8df59b | ||
|
|
8fa8bf392b | ||
|
|
9170524d33 | ||
|
|
cda395d6b9 | ||
|
|
d8da84cffc | ||
|
|
f6a13309f7 | ||
|
|
9c93179bf0 | ||
|
|
38b8bb0657 | ||
|
|
b147d92423 | ||
|
|
13f01d13f8 | ||
|
|
ebe03f42b6 | ||
|
|
a1c742c1cd | ||
|
|
3e0018d1cb | ||
|
|
1f5bc11ddd | ||
|
|
79db5bb8a0 | ||
|
|
bb1a24e7b3 |
@@ -55,6 +55,7 @@
|
||||
pkgs.probe-rs-tools
|
||||
pkgs.bear
|
||||
pkgs.chafa
|
||||
pkgs.imagemagick
|
||||
mbedTools
|
||||
pyOcd
|
||||
];
|
||||
|
||||
2
semestralka1/.gitignore
vendored
@@ -21,3 +21,5 @@ mbed-os/
|
||||
*.pyc
|
||||
__pycache__/
|
||||
.cache/
|
||||
|
||||
compile_commands.json
|
||||
|
||||
@@ -15,9 +15,18 @@ 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
|
||||
main.cpp
|
||||
${SRC_FILES}
|
||||
)
|
||||
|
||||
# Make includes of headers work
|
||||
target_include_directories(${APP_TARGET}
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(${APP_TARGET}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# Contributing to Mbed OS
|
||||
|
||||
Mbed OS is an open-source, device software platform for the Internet of Things. Contributions are an important part of the platform, and our goal is to make it as simple as possible to become a contributor.
|
||||
|
||||
To encourage productive collaboration, as well as robust, consistent and maintainable code, we have a set of guidelines for [contributing to Mbed OS](https://os.mbed.com/docs/mbed-os/latest/contributing/index.html).
|
||||
@@ -1,165 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
@@ -1,73 +1,5 @@
|
||||

|
||||
# Blinky Mbed OS example
|
||||
# Semestralka na VPS
|
||||
|
||||
The example project is part of the [Arm Mbed OS Official Examples](https://os.mbed.com/code/) and is the [getting started example for Mbed OS](https://os.mbed.com/docs/mbed-os/latest/quick-start/index.html). It contains an application that repeatedly blinks an LED on supported [Mbed boards](https://os.mbed.com/platforms/).
|
||||
Tato hra je najsamlepsejsia na celom svete.
|
||||
Iba si treba matchnut baudrate a moze sa gamesit.
|
||||
|
||||
You can build the project with all supported [Mbed OS build tools](https://os.mbed.com/docs/mbed-os/latest/tools/index.html). However, this example project specifically refers to the command-line interface tools, [Arm Mbed CLI 1](https://github.com/ARMmbed/mbed-cli#installing-mbed-cli) and [Mbed CLI 2](https://github.com/ARMmbed/mbed-tools#installation).
|
||||
|
||||
(Note: To see a rendered example you can import into the Arm Online Compiler, please see our [import quick start](https://os.mbed.com/docs/mbed-os/latest/quick-start/online-with-the-online-compiler.html#importing-the-code).)
|
||||
|
||||
## Mbed OS build tools
|
||||
|
||||
### Mbed CLI 2
|
||||
Starting with version 6.5, Mbed OS uses Mbed CLI 2. It uses Ninja as a build system, and CMake to generate the build environment and manage the build process in a compiler-independent manner. If you are working with Mbed OS version prior to 6.5 then check the section [Mbed CLI 1](#mbed-cli-1).
|
||||
1. [Install Mbed CLI 2](https://os.mbed.com/docs/mbed-os/latest/build-tools/install-or-upgrade.html).
|
||||
1. From the command-line, import the example: `mbed-tools import mbed-os-example-blinky`
|
||||
1. Change the current directory to where the project was imported.
|
||||
|
||||
### Mbed CLI 1
|
||||
1. [Install Mbed CLI 1](https://os.mbed.com/docs/mbed-os/latest/quick-start/offline-with-mbed-cli.html).
|
||||
1. From the command-line, import the example: `mbed import mbed-os-example-blinky`
|
||||
1. Change the current directory to where the project was imported.
|
||||
|
||||
## Application functionality
|
||||
|
||||
The `main()` function is the single thread in the application. It toggles the state of a digital output connected to an LED on the board.
|
||||
|
||||
**Note**: This example requires a target with RTOS support, i.e. one with `rtos` declared in `supported_application_profiles` in `targets/targets.json` in [mbed-os](https://github.com/ARMmbed/mbed-os). For non-RTOS targets (usually with small memory sizes), please use [mbed-os-example-blinky-baremetal](https://github.com/ARMmbed/mbed-os-example-blinky-baremetal) instead.
|
||||
|
||||
## Building and running
|
||||
|
||||
1. Connect a USB cable between the USB port on the board and the host computer.
|
||||
1. Run the following command to build the example project and program the microcontroller flash memory:
|
||||
|
||||
* Mbed CLI 2
|
||||
|
||||
```bash
|
||||
$ mbed-tools compile -m <TARGET> -t <TOOLCHAIN> --flash
|
||||
```
|
||||
|
||||
* Mbed CLI 1
|
||||
|
||||
```bash
|
||||
$ mbed compile -m <TARGET> -t <TOOLCHAIN> --flash
|
||||
```
|
||||
|
||||
Your PC may take a few minutes to compile your code.
|
||||
|
||||
The binary is located at:
|
||||
* **Mbed CLI 2** - `./cmake_build/<TARGET>/develop/<TOOLCHAIN>/mbed-os-example-blinky.bin`
|
||||
* **Mbed CLI 1** - `./BUILD/<TARGET>/<TOOLCHAIN>/mbed-os-example-blinky.bin`
|
||||
|
||||
Alternatively, you can manually copy the binary to the board, which you mount on the host computer over USB.
|
||||
|
||||
## Expected output
|
||||
The LED on your target turns on and off every 500 milliseconds.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
If you have problems, you can review the [documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.
|
||||
|
||||
## Related Links
|
||||
|
||||
* [Mbed OS Stats API](https://os.mbed.com/docs/latest/apis/mbed-statistics.html).
|
||||
* [Mbed OS Configuration](https://os.mbed.com/docs/latest/reference/configuration.html).
|
||||
* [Mbed OS Serial Communication](https://os.mbed.com/docs/latest/tutorials/serial-communication.html).
|
||||
* [Mbed OS bare metal](https://os.mbed.com/docs/mbed-os/latest/reference/mbed-os-bare-metal.html).
|
||||
* [Mbed boards](https://os.mbed.com/platforms/).
|
||||
|
||||
### License and contributions
|
||||
|
||||
The software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more info.
|
||||
|
||||
This project contains code from other projects. The original license text is included in those source files. They must comply with our license guide.
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// background_dark_inverted.h
|
||||
#pragma once
|
||||
|
||||
// embedded ASCII art background
|
||||
static const char *BACKGROUND_DARK_INVERTED[] = {
|
||||
"##################################################",
|
||||
"# #",
|
||||
"# example ASCII background line 1 #",
|
||||
"# replace this content with your real art #",
|
||||
"# #",
|
||||
"#================================================#",
|
||||
"# #",
|
||||
"# #",
|
||||
"##################################################"
|
||||
};
|
||||
static const int BACKGROUND_DARK_INVERTED_LINES =
|
||||
sizeof(BACKGROUND_DARK_INVERTED) / sizeof(BACKGROUND_DARK_INVERTED[0]);
|
||||
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
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@..
|
||||
BIN
semestralka1/chafa/character/crawl/crawl1.jpg
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
semestralka1/chafa/character/crawl/crawl2.jpg
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
6
semestralka1/chafa/character/crawl/out_crawl1.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
........
|
||||
........
|
||||
...y4@W.
|
||||
..a@a`..
|
||||
..@@R@=.
|
||||
.aa@s@..
|
||||
6
semestralka1/chafa/character/crawl/out_crawl2.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
........
|
||||
........
|
||||
........
|
||||
.____...
|
||||
.@@@@yg,
|
||||
.a@@PR@L
|
||||
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 |
6
semestralka1/chafa/character/run/out_run1.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
....g@w.
|
||||
..._ZF~.
|
||||
..@~@@y=
|
||||
.".g@_`.
|
||||
_ygF.Ry.
|
||||
`~`...4L
|
||||
6
semestralka1/chafa/character/run/out_run2.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
....g@w.
|
||||
..._Z~~.
|
||||
..aM@$y,
|
||||
..~a@_`.
|
||||
.yy@`$..
|
||||
..`..@..
|
||||
6
semestralka1/chafa/character/run/out_run3.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
...a@$..
|
||||
..._Z~..
|
||||
..a@@...
|
||||
..R@@=..
|
||||
.yy@@...
|
||||
.``u@...
|
||||
6
semestralka1/chafa/character/run/out_run4.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..g@$...
|
||||
..yT`...
|
||||
.g@F....
|
||||
.4@L....
|
||||
._$$....
|
||||
.`@~....
|
||||
6
semestralka1/chafa/character/run/out_run5.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
...@@...
|
||||
.._Z~...
|
||||
..@@....
|
||||
..$@#...
|
||||
..g@L...
|
||||
.yFP....
|
||||
6
semestralka1/chafa/character/run/out_run6.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
....@@..
|
||||
..._Z~..
|
||||
..y@@,_.
|
||||
..@$@~~.
|
||||
..y@~$..
|
||||
.aF~.4L.
|
||||
6
semestralka1/chafa/character/run/out_run7.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
....a@e.
|
||||
..._ZF`.
|
||||
..a~@@y=
|
||||
..'y@L`.
|
||||
_yyP.4y.
|
||||
`~`...4L
|
||||
BIN
semestralka1/chafa/character/run/run1.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
semestralka1/chafa/character/run/run2.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run3.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run4.jpg
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
semestralka1/chafa/character/run/run5.jpg
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
BIN
semestralka1/chafa/character/run/run6.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
semestralka1/chafa/character/run/run7.jpg
Normal file
|
After Width: | Height: | Size: 11 KiB |
5
semestralka1/chafa/character/run_chafa.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
chafa --symbols ascii-block -c none --fill none --invert --size=13x20 predloha_run_a.jpg > out.txt
|
||||
|
||||
a = 78x111
|
||||
b = 34x111
|
||||
walk = 60x111
|
||||
6
semestralka1/chafa/character/walk/out_walk1.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..a@w.
|
||||
.._T`.
|
||||
.s@@y.
|
||||
.^$$~T
|
||||
.y@`$.
|
||||
=F..?K
|
||||
6
semestralka1/chafa/character/walk/out_walk2.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..y@$.
|
||||
.._Z~.
|
||||
.y@@L.
|
||||
.4W@Z!
|
||||
._$~$.
|
||||
~~`.0.
|
||||
6
semestralka1/chafa/character/walk/out_walk3.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..g@L.
|
||||
.._T~.
|
||||
.g@$..
|
||||
.J@@..
|
||||
_y$4L.
|
||||
~~.4~.
|
||||
6
semestralka1/chafa/character/walk/out_walk4.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..a@w.
|
||||
..~T~.
|
||||
..@$..
|
||||
..@$..
|
||||
..y@..
|
||||
."~@..
|
||||
6
semestralka1/chafa/character/walk/out_walk5.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..@@..
|
||||
..Z~..
|
||||
..@L..
|
||||
..@L..
|
||||
..$%..
|
||||
.4F...
|
||||
6
semestralka1/chafa/character/walk/out_walk6.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
.u@$..
|
||||
..Z~..
|
||||
.g@_..
|
||||
.$@5+.
|
||||
._BL..
|
||||
uP.@..
|
||||
6
semestralka1/chafa/character/walk/out_walk7.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
..a@w.
|
||||
.._T`.
|
||||
.s@@y.
|
||||
.^$$~T
|
||||
.yE`$.
|
||||
=F..JK
|
||||
BIN
semestralka1/chafa/character/walk/walk1.jpg
Normal file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
semestralka1/chafa/character/walk/walk2.jpg
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
semestralka1/chafa/character/walk/walk3.jpg
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
semestralka1/chafa/character/walk/walk4.jpg
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
semestralka1/chafa/character/walk/walk5.jpg
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
semestralka1/chafa/character/walk/walk6.jpg
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
semestralka1/chafa/character/walk/walk7.jpg
Normal file
|
After Width: | Height: | Size: 10 KiB |
@@ -1,522 +0,0 @@
|
||||
[
|
||||
{
|
||||
"arguments": [
|
||||
"/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/bin/arm-none-eabi-g++",
|
||||
"-DARM_MATH_ARMV8MML",
|
||||
"-DCLOCK_SOURCE=USE_PLL_MSI",
|
||||
"-DCOMPONENT_FLASHIAP=1",
|
||||
"-DDEVICE_ANALOGIN=1",
|
||||
"-DDEVICE_ANALOGOUT=1",
|
||||
"-DDEVICE_CAN=1",
|
||||
"-DDEVICE_CRC=1",
|
||||
"-DDEVICE_FLASH=1",
|
||||
"-DDEVICE_I2C=1",
|
||||
"-DDEVICE_I2CSLAVE=1",
|
||||
"-DDEVICE_I2C_ASYNCH=1",
|
||||
"-DDEVICE_INTERRUPTIN=1",
|
||||
"-DDEVICE_LPTICKER=1",
|
||||
"-DDEVICE_MPU=1",
|
||||
"-DDEVICE_PORTIN=1",
|
||||
"-DDEVICE_PORTINOUT=1",
|
||||
"-DDEVICE_PORTOUT=1",
|
||||
"-DDEVICE_PWMOUT=1",
|
||||
"-DDEVICE_RESET_REASON=1",
|
||||
"-DDEVICE_RTC=1",
|
||||
"-DDEVICE_SERIAL=1",
|
||||
"-DDEVICE_SERIAL_ASYNCH=1",
|
||||
"-DDEVICE_SERIAL_FC=1",
|
||||
"-DDEVICE_SLEEP=1",
|
||||
"-DDEVICE_SPI=1",
|
||||
"-DDEVICE_SPISLAVE=1",
|
||||
"-DDEVICE_SPI_ASYNCH=1",
|
||||
"-DDEVICE_STDIO_MESSAGES=1",
|
||||
"-DDEVICE_TRNG=1",
|
||||
"-DDEVICE_USTICKER=1",
|
||||
"-DDEVICE_WATCHDOG=1",
|
||||
"-DEXTRA_IDLE_STACK_REQUIRED",
|
||||
"-DLPTICKER_DELAY_TICKS=0",
|
||||
"-DMBEDTLS_CIPHER_MODE_CTR",
|
||||
"-DMBED_CONF_ALT1250_PPP_BAUDRATE=115200",
|
||||
"-DMBED_CONF_ALT1250_PPP_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_ATMEL_RF_ASSUME_SPACED_SPI=1",
|
||||
"-DMBED_CONF_ATMEL_RF_FULL_SPI_SPEED=7500000",
|
||||
"-DMBED_CONF_ATMEL_RF_FULL_SPI_SPEED_BYTE_SPACING=250",
|
||||
"-DMBED_CONF_ATMEL_RF_IRQ_THREAD_STACK_SIZE=1024",
|
||||
"-DMBED_CONF_ATMEL_RF_LOW_SPI_SPEED=3750000",
|
||||
"-DMBED_CONF_ATMEL_RF_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_ATMEL_RF_USE_SPI_SPACING_API=0",
|
||||
"-DMBED_CONF_CELLULAR_AT_HANDLER_BUFFER_SIZE=32",
|
||||
"-DMBED_CONF_CELLULAR_CONTROL_PLANE_OPT=0",
|
||||
"-DMBED_CONF_CELLULAR_DEBUG_AT=0",
|
||||
"-DMBED_CONF_CELLULAR_MAX_CP_DATA_RECV_LEN=1358",
|
||||
"-DMBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY=0",
|
||||
"-DMBED_CONF_CELLULAR_USE_APN_LOOKUP=0",
|
||||
"-DMBED_CONF_CELLULAR_USE_SMS=0",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_CSN=OSPI_FLASH1_CSN",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_DQS=OSPI_FLASH1_DQS",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO0=OSPI_FLASH1_IO0",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO1=OSPI_FLASH1_IO1",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO2=OSPI_FLASH1_IO2",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO3=OSPI_FLASH1_IO3",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO4=OSPI_FLASH1_IO4",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO5=OSPI_FLASH1_IO5",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO6=OSPI_FLASH1_IO6",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_IO7=OSPI_FLASH1_IO7",
|
||||
"-DMBED_CONF_DRIVERS_OSPI_SCK=OSPI_FLASH1_SCK",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_CSN=QSPI_FLASH1_CSN",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_IO0=QSPI_FLASH1_IO0",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_IO1=QSPI_FLASH1_IO1",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_IO2=QSPI_FLASH1_IO2",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_IO3=QSPI_FLASH1_IO3",
|
||||
"-DMBED_CONF_DRIVERS_QSPI_SCK=QSPI_FLASH1_SCK",
|
||||
"-DMBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE=256",
|
||||
"-DMBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE=256",
|
||||
"-DMBED_CONF_ESP8266_BUILT_IN_DNS=0",
|
||||
"-DMBED_CONF_ESP8266_DEBUG=0",
|
||||
"-DMBED_CONF_ESP8266_POWER_OFF_TIME_MS=3",
|
||||
"-DMBED_CONF_ESP8266_POWER_ON_POLARITY=0",
|
||||
"-DMBED_CONF_ESP8266_POWER_ON_TIME_MS=3",
|
||||
"-DMBED_CONF_ESP8266_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_ESP8266_SERIAL_BAUDRATE=115200",
|
||||
"-DMBED_CONF_ESP8266_SNTP_ENABLE=0",
|
||||
"-DMBED_CONF_ESP8266_SNTP_SERVER0=\"\"",
|
||||
"-DMBED_CONF_ESP8266_SNTP_SERVER1=\"\"",
|
||||
"-DMBED_CONF_ESP8266_SNTP_SERVER2=\"\"",
|
||||
"-DMBED_CONF_ESP8266_SNTP_TIMEZONE=0",
|
||||
"-DMBED_CONF_ESP8266_SOCKET_BUFSIZE=8192",
|
||||
"-DMBED_CONF_EVENTS_SHARED_DISPATCH_FROM_APPLICATION=0",
|
||||
"-DMBED_CONF_EVENTS_SHARED_EVENTSIZE=768",
|
||||
"-DMBED_CONF_EVENTS_SHARED_HIGHPRIO_EVENTSIZE=256",
|
||||
"-DMBED_CONF_EVENTS_SHARED_HIGHPRIO_STACKSIZE=1024",
|
||||
"-DMBED_CONF_EVENTS_SHARED_STACKSIZE=2048",
|
||||
"-DMBED_CONF_EVENTS_USE_LOWPOWER_TIMER_TICKER=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FFS_DBG=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_CODE_PAGE=437",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_EXFAT=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_HEAPBUF=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_LOCK=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_MINIMIZE=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_NOFSINFO=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_NORTC=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_READONLY=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_REENTRANT=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_RPATH=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_TIMEOUT=1000",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_FS_TINY=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_LFN_BUF=255",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_LFN_UNICODE=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_MAX_LFN=255",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_MAX_SS=4096",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_MIN_SS=512",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_MULTI_PARTITION=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_NORTC_MDAY=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_NORTC_MON=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_NORTC_YEAR=2017",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_PRINT_FLOAT=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_PRINT_LLI=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_SFN_BUF=12",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_STRF_ENCODE=3",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_STR_VOLUME_ID=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_SYNC_T=HANDLE",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_CHMOD=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_EXPAND=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_FASTSEEK=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_FIND=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_FORWARD=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_LABEL=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_LFN=3",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_MKFS=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_STRFUNC=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_USE_TRIM=1",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_VOLUMES=4",
|
||||
"-DMBED_CONF_FAT_CHAN_FF_VOLUME_STRS=\"RAM\",\"NAND\",\"CF\",\"SD\",\"SD2\",\"USB\",\"USB2\",\"USB3\"",
|
||||
"-DMBED_CONF_FAT_CHAN_FLUSH_ON_NEW_CLUSTER=0",
|
||||
"-DMBED_CONF_FAT_CHAN_FLUSH_ON_NEW_SECTOR=1",
|
||||
"-DMBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS=0xFFFFFFFF",
|
||||
"-DMBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE=0",
|
||||
"-DMBED_CONF_GEMALTO_CINTERION_BAUDRATE=115200",
|
||||
"-DMBED_CONF_GEMALTO_CINTERION_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_GENERIC_AT3GPP_BAUDRATE=115200",
|
||||
"-DMBED_CONF_GENERIC_AT3GPP_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_LORA_ADR_ON=1",
|
||||
"-DMBED_CONF_LORA_APPLICATION_EUI={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}",
|
||||
"-DMBED_CONF_LORA_APPLICATION_KEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}",
|
||||
"-DMBED_CONF_LORA_APPSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}",
|
||||
"-DMBED_CONF_LORA_APP_PORT=15",
|
||||
"-DMBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE=1",
|
||||
"-DMBED_CONF_LORA_DEVICE_ADDRESS=0x00000000",
|
||||
"-DMBED_CONF_LORA_DEVICE_EUI={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}",
|
||||
"-DMBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH=5",
|
||||
"-DMBED_CONF_LORA_DUTY_CYCLE_ON=1",
|
||||
"-DMBED_CONF_LORA_DUTY_CYCLE_ON_JOIN=1",
|
||||
"-DMBED_CONF_LORA_FSB_MASK={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00FF}",
|
||||
"-DMBED_CONF_LORA_FSB_MASK_CHINA={0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}",
|
||||
"-DMBED_CONF_LORA_LBT_ON=0",
|
||||
"-DMBED_CONF_LORA_MAX_SYS_RX_ERROR=5",
|
||||
"-DMBED_CONF_LORA_NB_TRIALS=12",
|
||||
"-DMBED_CONF_LORA_NWKSKEY={0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}",
|
||||
"-DMBED_CONF_LORA_OVER_THE_AIR_ACTIVATION=1",
|
||||
"-DMBED_CONF_LORA_PHY=EU868",
|
||||
"-DMBED_CONF_LORA_PHY_AS923_SUB_REGION=AS1",
|
||||
"-DMBED_CONF_LORA_PUBLIC_NETWORK=1",
|
||||
"-DMBED_CONF_LORA_TX_MAX_SIZE=64",
|
||||
"-DMBED_CONF_LORA_UPLINK_PREAMBLE_LENGTH=8",
|
||||
"-DMBED_CONF_LORA_WAKEUP_TIME=5",
|
||||
"-DMBED_CONF_LWIP_ADDR_TIMEOUT=5",
|
||||
"-DMBED_CONF_LWIP_ADDR_TIMEOUT_MODE=1",
|
||||
"-DMBED_CONF_LWIP_DEBUG_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE=512",
|
||||
"-DMBED_CONF_LWIP_DHCP_TIMEOUT=60",
|
||||
"-DMBED_CONF_LWIP_ENABLE_PPP_TRACE=0",
|
||||
"-DMBED_CONF_LWIP_ETHERNET_ENABLED=1",
|
||||
"-DMBED_CONF_LWIP_IPV4_ENABLED=1",
|
||||
"-DMBED_CONF_LWIP_IPV6_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_IP_VER_PREF=4",
|
||||
"-DMBED_CONF_LWIP_L3IP_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_MBOX_SIZE=8",
|
||||
"-DMBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT=8",
|
||||
"-DMBED_CONF_LWIP_MEMP_NUM_TCP_SEG=16",
|
||||
"-DMBED_CONF_LWIP_MEM_SIZE=2310",
|
||||
"-DMBED_CONF_LWIP_ND6_QUEUEING=0",
|
||||
"-DMBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS=0",
|
||||
"-DMBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_NUM_NETBUF=8",
|
||||
"-DMBED_CONF_LWIP_NUM_PBUF=8",
|
||||
"-DMBED_CONF_LWIP_PBUF_POOL_SIZE=5",
|
||||
"-DMBED_CONF_LWIP_PPP_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_PPP_IPV4_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_PPP_IPV6_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_PPP_THREAD_STACKSIZE=768",
|
||||
"-DMBED_CONF_LWIP_RAW_SOCKET_ENABLED=0",
|
||||
"-DMBED_CONF_LWIP_SOCKET_MAX=4",
|
||||
"-DMBED_CONF_LWIP_TCPIP_THREAD_PRIORITY=osPriorityNormal",
|
||||
"-DMBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE=1200",
|
||||
"-DMBED_CONF_LWIP_TCP_CLOSE_TIMEOUT=1000",
|
||||
"-DMBED_CONF_LWIP_TCP_ENABLED=1",
|
||||
"-DMBED_CONF_LWIP_TCP_MAXRTX=6",
|
||||
"-DMBED_CONF_LWIP_TCP_MSS=536",
|
||||
"-DMBED_CONF_LWIP_TCP_SERVER_MAX=4",
|
||||
"-DMBED_CONF_LWIP_TCP_SND_BUF=(2 * TCP_MSS)",
|
||||
"-DMBED_CONF_LWIP_TCP_SOCKET_MAX=4",
|
||||
"-DMBED_CONF_LWIP_TCP_SYNMAXRTX=6",
|
||||
"-DMBED_CONF_LWIP_TCP_WND=(4 * TCP_MSS)",
|
||||
"-DMBED_CONF_LWIP_UDP_SOCKET_MAX=4",
|
||||
"-DMBED_CONF_LWIP_USE_MBED_TRACE=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_CHANNEL=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_CHANNEL_MASK=0x7fff800",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_CHANNEL_PAGE=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_DEVICE_TYPE=NET_6LOWPAN_ROUTER",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_PANID_FILTER=0xffff",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_PSK_KEY={0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf}",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_PSK_KEY_ID=1",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_SECURITY_MODE=NONE",
|
||||
"-DMBED_CONF_MBED_MESH_API_6LOWPAN_ND_SEC_LEVEL=5",
|
||||
"-DMBED_CONF_MBED_MESH_API_HEAP_SIZE=32500",
|
||||
"-DMBED_CONF_MBED_MESH_API_HEAP_STAT_INFO=NULL",
|
||||
"-DMBED_CONF_MBED_MESH_API_MAC_NEIGH_TABLE_SIZE=32",
|
||||
"-DMBED_CONF_MBED_MESH_API_RADIUS_RETRY_COUNT=3",
|
||||
"-DMBED_CONF_MBED_MESH_API_RADIUS_RETRY_IMAX=30",
|
||||
"-DMBED_CONF_MBED_MESH_API_RADIUS_RETRY_IMIN=20",
|
||||
"-DMBED_CONF_MBED_MESH_API_SYSTEM_TIME_UPDATE_FROM_NANOSTACK=1",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_CHANNEL=22",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_CHANNEL_MASK=0x7fff800",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_CHANNEL_PAGE=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_COMMISSIONING_DATASET_TIMESTAMP=0x10000",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_EXTENDED_PANID={0xf1, 0xb5, 0xa1, 0xb2,0xc4, 0xd5, 0xa1, 0xbd }",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_ML_PREFIX={0xfd, 0x0, 0x0d, 0xb8, 0x0, 0x0, 0x0, 0x0}",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_NETWORK_NAME=\"Thread Network\"",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_PANID=0x0700",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_CONFIG_PSKC={0xc8, 0xa6, 0x2e, 0xae, 0xf3, 0x68, 0xf3, 0x46, 0xa9, 0x9e, 0x57, 0x85, 0x98, 0x9d, 0x1c, 0xd0}",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_DEVICE_TYPE=MESH_DEVICE_TYPE_THREAD_ROUTER",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_MASTER_KEY={0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_PSKD=\"ABCDEFGH\"",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_SECURITY_POLICY=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_THREAD_USE_STATIC_LINK_CONFIG=1",
|
||||
"-DMBED_CONF_MBED_MESH_API_USE_MALLOC_FOR_HEAP=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_BC_CHANNEL_FUNCTION=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_BC_DWELL_INTERVAL=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_BC_FIXED_CHANNEL=65535",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_BC_INTERVAL=0",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_CHANNEL_PLAN_ID=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_DEVICE_TYPE=MESH_DEVICE_TYPE_WISUN_ROUTER",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_NETWORK_NAME=\"Wi-SUN Network\"",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_OPERATING_CLASS=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_OPERATING_MODE=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_PHY_MODE_ID=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_REGULATORY_DOMAIN=3",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_UC_CHANNEL_FUNCTION=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_UC_DWELL_INTERVAL=255",
|
||||
"-DMBED_CONF_MBED_MESH_API_WISUN_UC_FIXED_CHANNEL=65535",
|
||||
"-DMBED_CONF_MCR20A_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_NANOSTACK_CONFIGURATION=nanostack_full",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_CRITICAL_SECTION_USABLE_FROM_INTERRUPT=0",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_EVENT_LOOP_DISPATCH_FROM_APPLICATION=0",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_EVENT_LOOP_THREAD_STACK_SIZE=6144",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_EVENT_LOOP_USE_MBED_EVENTS=0",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_KVSTORE_PATH=\"/kv/\"",
|
||||
"-DMBED_CONF_NANOSTACK_HAL_USE_KVSTORE=0",
|
||||
"-DMBED_CONF_NANOSTACK_LIBSERVICE_NSDYNMEM_TRACKER_ENABLED=0",
|
||||
"-DMBED_CONF_NANOSTACK_LIBSERVICE_PRESENT=1",
|
||||
"-DMBED_CONF_NSAPI_ADD_EVENT_LISTENER_RETURN_CHANGE=0",
|
||||
"-DMBED_CONF_NSAPI_DEFAULT_MESH_TYPE=THREAD",
|
||||
"-DMBED_CONF_NSAPI_DEFAULT_STACK=LWIP",
|
||||
"-DMBED_CONF_NSAPI_DEFAULT_WIFI_SECURITY=NONE",
|
||||
"-DMBED_CONF_NSAPI_DNS_ADDRESSES_LIMIT=10",
|
||||
"-DMBED_CONF_NSAPI_DNS_CACHE_SIZE=3",
|
||||
"-DMBED_CONF_NSAPI_DNS_RESPONSE_WAIT_TIME=10000",
|
||||
"-DMBED_CONF_NSAPI_DNS_RETRIES=1",
|
||||
"-DMBED_CONF_NSAPI_DNS_TOTAL_ATTEMPTS=10",
|
||||
"-DMBED_CONF_NSAPI_SOCKET_STATS_ENABLED=0",
|
||||
"-DMBED_CONF_NSAPI_SOCKET_STATS_MAX_COUNT=10",
|
||||
"-DMBED_CONF_PLATFORM_CALLBACK_COMPARABLE=1",
|
||||
"-DMBED_CONF_PLATFORM_CALLBACK_NONTRIVIAL=0",
|
||||
"-DMBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED=0",
|
||||
"-DMBED_CONF_PLATFORM_CTHUNK_COUNT_MAX=8",
|
||||
"-DMBED_CONF_PLATFORM_DEEPSLEEP_STATS_VERBOSE=0",
|
||||
"-DMBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE=9600",
|
||||
"-DMBED_CONF_PLATFORM_ERROR_ALL_THREADS_INFO=0",
|
||||
"-DMBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED=0",
|
||||
"-DMBED_CONF_PLATFORM_ERROR_HIST_ENABLED=0",
|
||||
"-DMBED_CONF_PLATFORM_ERROR_HIST_SIZE=4",
|
||||
"-DMBED_CONF_PLATFORM_ERROR_REBOOT_MAX=1",
|
||||
"-DMBED_CONF_PLATFORM_FATAL_ERROR_AUTO_REBOOT_ENABLED=0",
|
||||
"-DMBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN=16",
|
||||
"-DMBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_64_BIT=1",
|
||||
"-DMBED_CONF_PLATFORM_MINIMAL_PRINTF_ENABLE_FLOATING_POINT=0",
|
||||
"-DMBED_CONF_PLATFORM_MINIMAL_PRINTF_SET_FLOATING_POINT_MAX_DECIMALS=6",
|
||||
"-DMBED_CONF_PLATFORM_POLL_USE_LOWPOWER_TIMER=0",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_BAUD_RATE=9600",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_BUFFERED_SERIAL=0",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES=1",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_CONVERT_TTY_NEWLINES=1",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT=1",
|
||||
"-DMBED_CONF_PLATFORM_STDIO_MINIMAL_CONSOLE_ONLY=0",
|
||||
"-DMBED_CONF_PLATFORM_USE_MPU=1",
|
||||
"-DMBED_CONF_PPP_ENABLED=0",
|
||||
"-DMBED_CONF_PPP_ENABLE_TRACE=0",
|
||||
"-DMBED_CONF_PPP_IPV4_ENABLED=1",
|
||||
"-DMBED_CONF_PPP_IPV6_ENABLED=0",
|
||||
"-DMBED_CONF_PPP_MBED_EVENT_QUEUE=0",
|
||||
"-DMBED_CONF_PPP_THREAD_STACKSIZE=816",
|
||||
"-DMBED_CONF_QUECTEL_BC95_BAUDRATE=9600",
|
||||
"-DMBED_CONF_QUECTEL_BC95_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_QUECTEL_BG96_BAUDRATE=115200",
|
||||
"-DMBED_CONF_QUECTEL_BG96_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_QUECTEL_EC2X_BAUDRATE=115200",
|
||||
"-DMBED_CONF_QUECTEL_EC2X_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_QUECTEL_EC2X_START_TIMEOUT=15000",
|
||||
"-DMBED_CONF_QUECTEL_M26_BAUDRATE=115200",
|
||||
"-DMBED_CONF_QUECTEL_M26_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_QUECTEL_UG96_BAUDRATE=115200",
|
||||
"-DMBED_CONF_QUECTEL_UG96_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_RM1000_AT_BAUDRATE=230400",
|
||||
"-DMBED_CONF_RM1000_AT_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_RTOS_API_PRESENT=1",
|
||||
"-DMBED_CONF_RTOS_ENABLE_ALL_RTX_EVENTS=0",
|
||||
"-DMBED_CONF_RTOS_EVFLAGS_NUM=0",
|
||||
"-DMBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE=512",
|
||||
"-DMBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE_DEBUG_EXTRA=128",
|
||||
"-DMBED_CONF_RTOS_IDLE_THREAD_STACK_SIZE_TICKLESS_EXTRA=256",
|
||||
"-DMBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE=4096",
|
||||
"-DMBED_CONF_RTOS_MSGQUEUE_DATA_SIZE=0",
|
||||
"-DMBED_CONF_RTOS_MSGQUEUE_NUM=0",
|
||||
"-DMBED_CONF_RTOS_MUTEX_NUM=0",
|
||||
"-DMBED_CONF_RTOS_PRESENT=1",
|
||||
"-DMBED_CONF_RTOS_SEMAPHORE_NUM=0",
|
||||
"-DMBED_CONF_RTOS_THREAD_NUM=0",
|
||||
"-DMBED_CONF_RTOS_THREAD_STACK_SIZE=4096",
|
||||
"-DMBED_CONF_RTOS_THREAD_USER_STACK_SIZE=0",
|
||||
"-DMBED_CONF_RTOS_TIMER_NUM=0",
|
||||
"-DMBED_CONF_RTOS_TIMER_THREAD_STACK_SIZE=768",
|
||||
"-DMBED_CONF_S2LP_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_SARA4_PPP_BAUDRATE=115200",
|
||||
"-DMBED_CONF_SARA4_PPP_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_ADDRESS=0",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_AUTONEGOTIATION=ETH_AUTONEGOTIATION_ENABLE",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_DUPLEXMODE=ETH_MODE_FULLDUPLEX",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_DUPLEX_STATUS=0x0010",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_MEDIA_INTERFACE=ETH_MEDIA_INTERFACE_RMII",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_RESET_DELAY=500",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_SPEED=ETH_SPEED_100M",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_SPEED_STATUS=0x0004",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_PHY_STATUS_REGISTER=31",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_RXBUFNB=4",
|
||||
"-DMBED_CONF_STM32_EMAC_ETH_TXBUFNB=4",
|
||||
"-DMBED_CONF_STM32_EMAC_THREAD_STACKSIZE=1024",
|
||||
"-DMBED_CONF_STORAGE_DEFAULT_KV=kv",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_BLOCKDEVICE=default",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_EXTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_EXTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_FILESYSTEM=default",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_FOLDER_PATH=kvstore",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_INTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_MOUNT_POINT=kv",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_BLOCKDEVICE=default",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_EXTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FILESYSTEM=default",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_FOLDER_PATH=kvstore",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_NO_RBP_MOUNT_POINT=kv",
|
||||
"-DMBED_CONF_STORAGE_FILESYSTEM_RBP_INTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_STORAGE_TYPE=default",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_BLOCKDEVICE=default",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_EXTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_EXTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_INTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_BLOCKDEVICE=default",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_NO_RBP_EXTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_EXTERNAL_RBP_INTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS=0",
|
||||
"-DMBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE=0",
|
||||
"-DMBED_CONF_TARGET_BOOT_STACK_SIZE=0x400",
|
||||
"-DMBED_CONF_TARGET_CONSOLE_UART=1",
|
||||
"-DMBED_CONF_TARGET_CUSTOM_TICKERS=1",
|
||||
"-DMBED_CONF_TARGET_DEEP_SLEEP_LATENCY=4",
|
||||
"-DMBED_CONF_TARGET_DEFAULT_ADC_VREF=NAN",
|
||||
"-DMBED_CONF_TARGET_GPIO_RESET_AT_INIT=0",
|
||||
"-DMBED_CONF_TARGET_I2C_TIMING_VALUE_ALGO=0",
|
||||
"-DMBED_CONF_TARGET_INIT_US_TICKER_AT_BOOT=1",
|
||||
"-DMBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS=1",
|
||||
"-DMBED_CONF_TARGET_LPTICKER_LPTIM=1",
|
||||
"-DMBED_CONF_TARGET_LPTICKER_LPTIM_CLOCK=1",
|
||||
"-DMBED_CONF_TARGET_LPUART_CLOCK_SOURCE=USE_LPUART_CLK_HSI",
|
||||
"-DMBED_CONF_TARGET_LSE_AVAILABLE=1",
|
||||
"-DMBED_CONF_TARGET_LSE_DRIVE_LOAD_LEVEL=RCC_LSEDRIVE_LOW",
|
||||
"-DMBED_CONF_TARGET_MPU_ROM_END=0x0fffffff",
|
||||
"-DMBED_CONF_TARGET_RTC_CLOCK_SOURCE=USE_RTC_CLK_LSE_OR_LSI",
|
||||
"-DMBED_CONF_TARGET_TICKLESS_FROM_US_TICKER=0",
|
||||
"-DMBED_CONF_TARGET_XIP_ENABLE=0",
|
||||
"-DMBED_CONF_TELIT_HE910_BAUDRATE=115200",
|
||||
"-DMBED_CONF_TELIT_HE910_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_TELIT_ME310_BAUDRATE=115200",
|
||||
"-DMBED_CONF_TELIT_ME310_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_TELIT_ME910_BAUDRATE=115200",
|
||||
"-DMBED_CONF_TELIT_ME910_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_UBLOX_AT_BAUDRATE=115200",
|
||||
"-DMBED_CONF_UBLOX_AT_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_UBLOX_N2XX_BAUDRATE=9600",
|
||||
"-DMBED_CONF_UBLOX_N2XX_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CONF_UBLOX_PPP_BAUDRATE=115200",
|
||||
"-DMBED_CONF_UBLOX_PPP_PROVIDE_DEFAULT=0",
|
||||
"-DMBED_CRC_TABLE_SIZE=16",
|
||||
"-DMBED_LFS2_BLOCK_CYCLES=1024",
|
||||
"-DMBED_LFS2_BLOCK_SIZE=512",
|
||||
"-DMBED_LFS2_CACHE_SIZE=64",
|
||||
"-DMBED_LFS2_ENABLE_INFO=0",
|
||||
"-DMBED_LFS2_INTRINSICS=1",
|
||||
"-DMBED_LFS2_LOOKAHEAD_SIZE=64",
|
||||
"-DMBED_LFS_BLOCK_SIZE=512",
|
||||
"-DMBED_LFS_ENABLE_INFO=0",
|
||||
"-DMBED_LFS_INTRINSICS=1",
|
||||
"-DMBED_LFS_LOOKAHEAD=512",
|
||||
"-DMBED_LFS_PROG_SIZE=64",
|
||||
"-DMBED_LFS_READ_SIZE=64",
|
||||
"-DMBED_MINIMAL_PRINTF",
|
||||
"-DMBED_STACK_DUMP_ENABLED=0",
|
||||
"-DMBED_TICKLESS",
|
||||
"-DMBED_TRACE_COLOR_THEME=0",
|
||||
"-DMBED_TRAP_ERRORS_ENABLED=1",
|
||||
"-DMEM_ALLOC=malloc",
|
||||
"-DMEM_FREE=free",
|
||||
"-DNSAPI_PPP_AVAILABLE=(MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED)",
|
||||
"-DNSDYNMEM_TRACKER_ENABLED=MBED_CONF_NANOSTACK_LIBSERVICE_NSDYNMEM_TRACKER_ENABLED",
|
||||
"-DNS_USE_EXTERNAL_MBED_TLS",
|
||||
"-DPPP_DEBUG=0",
|
||||
"-DSTM32U575xx",
|
||||
"-DTARGET_CORTEX",
|
||||
"-DTARGET_CORTEX_M",
|
||||
"-DTARGET_FF_ARDUINO_UNO",
|
||||
"-DTARGET_LIKE_CORTEX_M33",
|
||||
"-DTARGET_LIKE_MBED",
|
||||
"-DTARGET_M33",
|
||||
"-DTARGET_MCU_STM32",
|
||||
"-DTARGET_MCU_STM32U5",
|
||||
"-DTARGET_MCU_STM32U575xI",
|
||||
"-DTARGET_NAME=NUCLEO_U575ZI_Q",
|
||||
"-DTARGET_NUCLEO_U575ZI_Q",
|
||||
"-DTARGET_STM",
|
||||
"-DTARGET_STM32U5",
|
||||
"-DTARGET_STM32U575xI",
|
||||
"-DTARGET_Target",
|
||||
"-DTOOLCHAIN_GCC",
|
||||
"-DTOOLCHAIN_GCC_ARM",
|
||||
"-DTRANSACTION_QUEUE_SIZE_SPI=2",
|
||||
"-DUNITY_INCLUDE_CONFIG_H",
|
||||
"-DUSE_FULL_LL_DRIVER",
|
||||
"-DUSE_HAL_DRIVER",
|
||||
"-D_RTE_",
|
||||
"-D__CMSIS_RTOS",
|
||||
"-D__CORTEX_M33",
|
||||
"-D__DSP_PRESENT=1U",
|
||||
"-D__FPU_PRESENT=1U",
|
||||
"-D__MBED__=1",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Config",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Include1",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/RTX/Source",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/RTOS2/Include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/device/rtos/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/device/RTE/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/device/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/drivers/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/drivers/./include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/drivers/./include/drivers",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/drivers/./include/drivers/internal",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/hal/usb/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/hal/usb/include/usb",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/hal/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/hal/include/hal",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/cxxsupport/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/mbed-trace/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/mbed-trace/include/mbed-trace",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/source/minimal-printf/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/source/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/include/platform",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/platform/include/platform/internal",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/rtos/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/rtos/./include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/rtos/./include/rtos",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/rtos/./include/rtos/internal",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/rtos/./source",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/connectivity/libraries/nanostack-libservice/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/connectivity/libraries/nanostack-libservice/./mbed-client-libservice",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/TARGET_STM32U575xI/TARGET_NUCLEO_U575ZI_Q/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/TARGET_STM32U575xI/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/cmsis/CMSIS_5/CMSIS/TARGET_CORTEX_M/Include",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/STM32Cube_FW/.",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/STM32Cube_FW/CMSIS",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/STM32Cube_FW/STM32U5xx_HAL_Driver",
|
||||
"-I/home/filip/Documents/programming/uni/pvs/semestralka1/mbed-os/targets/TARGET_STM/TARGET_STM32U5/STM32Cube_FW/STM32U5xx_HAL_Driver/Legacy",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wno-missing-field-initializers",
|
||||
"-fmessage-length=0",
|
||||
"-fno-exceptions",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-funsigned-char",
|
||||
"-fomit-frame-pointer",
|
||||
"-g3",
|
||||
"-mthumb",
|
||||
"-mfpu=fpv5-sp-d16",
|
||||
"-mfloat-abi=softfp",
|
||||
"-mcpu=cortex-m33",
|
||||
"-fno-rtti",
|
||||
"-Wvla",
|
||||
"-Os",
|
||||
"-c",
|
||||
"-o",
|
||||
"CMakeFiles/mbed-os-example-blinky.dir/main.cpp.obj",
|
||||
"/home/filip/Documents/programming/uni/pvs/semestralka1/main.cpp"
|
||||
],
|
||||
"directory": "/home/filip/Documents/programming/uni/pvs/semestralka1/cmake_build/NUCLEO_U575ZI_Q/develop/GCC_ARM",
|
||||
"file": "/home/filip/Documents/programming/uni/pvs/semestralka1/main.cpp",
|
||||
"output": "/home/filip/Documents/programming/uni/pvs/semestralka1/cmake_build/NUCLEO_U575ZI_Q/develop/GCC_ARM/CMakeFiles/mbed-os-example-blinky.dir/main.cpp.obj"
|
||||
}
|
||||
]
|
||||
@@ -1,103 +0,0 @@
|
||||
// main.cpp
|
||||
|
||||
#include "mbed.h"
|
||||
#include "background_dark_inverted.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define TARGET_TX_PIN USBTX
|
||||
#define TARGET_RX_PIN USBRX
|
||||
// #define BAUD_RATE 1843200
|
||||
// #define BAUD_RATE 921600
|
||||
// #define BAUD_RATE 460800
|
||||
#define BAUD_RATE 115200
|
||||
|
||||
static BufferedSerial serial_port(TARGET_TX_PIN, TARGET_RX_PIN, BAUD_RATE);
|
||||
|
||||
FileHandle *mbed::mbed_override_console(int fd)
|
||||
{
|
||||
return &serial_port;
|
||||
}
|
||||
|
||||
DigitalOut led(LED1);
|
||||
|
||||
#define BUFFER_SIZE 64
|
||||
static char rx_buffer[BUFFER_SIZE];
|
||||
|
||||
// ASCII fart background
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr) {
|
||||
const int view_width = 50; // visible width
|
||||
const int view_height = 24;
|
||||
|
||||
// Terminal clear + home
|
||||
printf("\033[2J\033[H");
|
||||
|
||||
for (int i = 0; i < view_height && i < BACKGROUND_DARK_INVERTED_LINES; i++) {
|
||||
const char *row = BACKGROUND_DARK_INVERTED[i];
|
||||
int width = strlen(row);
|
||||
if (width == 0) {
|
||||
printf("\r\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
int start = shift % width;
|
||||
|
||||
// Print visible window (wrap around)
|
||||
for (int j = 0; j < view_width; j++) {
|
||||
char c = row[(start + j) % width];
|
||||
printf("%c", c);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
if (text && text[0] != '\0')
|
||||
printf("\r\n[RX] %s\r\n", text);
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
serial_port.set_format(8, BufferedSerial::None, 1);
|
||||
printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE);
|
||||
|
||||
int shift = 0;
|
||||
char message[BUFFER_SIZE] = {0};
|
||||
bool message_active = false;
|
||||
Timer msg_timer;
|
||||
Timer anim_timer;
|
||||
msg_timer.start();
|
||||
anim_timer.start();
|
||||
|
||||
const char *bg_file = "background_dark_inverted.txt";
|
||||
|
||||
while (true) {
|
||||
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;
|
||||
|
||||
strncpy(message, rx_buffer, sizeof(message) - 1);
|
||||
message_active = true;
|
||||
msg_timer.reset();
|
||||
}
|
||||
}
|
||||
|
||||
if (message_active && msg_timer.elapsed_time() > 1s) {
|
||||
message_active = false;
|
||||
memset(message, 0, sizeof(message));
|
||||
}
|
||||
|
||||
// if (message_active && msg_timer.elapsed_time() > 100ms) {
|
||||
// shift = (shift + 1) % 8;
|
||||
|
||||
// }
|
||||
if (anim_timer.elapsed_time() >= 400ms) {
|
||||
shift++;
|
||||
anim_timer.reset();
|
||||
|
||||
draw_mask(bg_file, shift, message_active ? message : nullptr);
|
||||
}
|
||||
ThisThread::sleep_for(20ms);
|
||||
}
|
||||
}
|
||||
22
semestralka1/src/assets/background_frame.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// src/assets/background_frame.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@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
|
||||
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@##@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@R@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
|
||||
"MRRRRRRRRRRAA#PPF=FFF~~~~~~~~~~~~~~~~~~~~~~~FFPPRR@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@$@@@@@@@@$$@@@@@@@@@@@@@g@@@@@@@@@@@$@@@@@@@@@RRRRRRRRRRRRRPPPP@@@@@@@R@@@@@@@@@@@@@@@@@@@$$RRRRRRRRRRR@0#PPPPFFFF~~~~~~~~~~~~~~~~~~~~~~FFFPPR@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@g$@@@@@@$@$@@@@@@@@@@@@@@g@@@@@@@@@@@$@@@@@@@@@RRRRRRRRRRRRPP=MA@@@@@@@R@@@@@@@@@@@@@@@@@@@@R",
|
||||
"MF~~~~~~``.___yyyam....,,,,,,,,,yyw,-yyyyy.,,....,yg@PPPPPPPPPPPPRRRRRRRRRR#RR$@@@@@@@@@@ETT~~~~~~~~~~~FFFFFFFFFR@@@#=PPFF~~~`,,,,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]);
|
||||
57
semestralka1/src/assets/character_crawl_frames.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// src/assets/character_crawl_frames.h
|
||||
#pragma once
|
||||
|
||||
// Crawl1 frame 1
|
||||
static const char *CRAWL1_FRAME_1[] = {
|
||||
"........",
|
||||
"........",
|
||||
"...y4@W.",
|
||||
"..a@a`..",
|
||||
"..@@R@=.",
|
||||
".aa@s@.."
|
||||
};
|
||||
|
||||
// Crawl2 frame 1
|
||||
static const char *CRAWL2_FRAME_1[] = {
|
||||
"........",
|
||||
"........",
|
||||
"........",
|
||||
".____...",
|
||||
".@@@@yg,",
|
||||
".a@@PR@L"
|
||||
};
|
||||
|
||||
enum class CrawlType {
|
||||
Crawl1 = 0,
|
||||
Crawl2,
|
||||
COUNT
|
||||
};
|
||||
|
||||
static const char **CHARACTER_CRAWL1_FRAMES[] = {
|
||||
CRAWL1_FRAME_1,
|
||||
};
|
||||
static const char **CHARACTER_CRAWL2_FRAMES[] = {
|
||||
CRAWL2_FRAME_1,
|
||||
};
|
||||
|
||||
static const int CHARACTER_CRAWL1_FRAME_COUNT = sizeof(CHARACTER_CRAWL1_FRAMES) / sizeof(CHARACTER_CRAWL1_FRAMES[0]);
|
||||
static const int CHARACTER_CRAWL2_FRAME_COUNT = sizeof(CHARACTER_CRAWL2_FRAMES) / sizeof(CHARACTER_CRAWL2_FRAMES[0]);
|
||||
|
||||
// Height (rows per crawl frame)
|
||||
static const int CHARACTER_CRAWL1_FRAME_HEIGHT = sizeof(CRAWL1_FRAME_1) / sizeof(CRAWL1_FRAME_1[0]);
|
||||
static const int CHARACTER_CRAWL2_FRAME_HEIGHT = sizeof(CRAWL2_FRAME_1) / sizeof(CRAWL2_FRAME_1[0]);
|
||||
|
||||
|
||||
// Crawl1 collision box
|
||||
static const int CHARACTER_CRAWL1_FRAME_WIDTH = 8;
|
||||
static const int CHARACTER_CRAWL1_COLLISION_LEFT_OFFSET = 1;
|
||||
static const int CHARACTER_CRAWL1_COLLISION_RIGHT_OFFSET = 1;
|
||||
static const int CHARACTER_CRAWL1_COLLISION_WIDTH = CHARACTER_CRAWL1_FRAME_WIDTH - (CHARACTER_CRAWL1_COLLISION_LEFT_OFFSET + CHARACTER_CRAWL1_COLLISION_RIGHT_OFFSET);
|
||||
static const int CHARACTER_CRAWL1_COLLISION_HEIGHT = CHARACTER_CRAWL1_FRAME_HEIGHT - 2;
|
||||
|
||||
// Crawl2 collision box (lower posture → smaller collision height)
|
||||
static const int CHARACTER_CRAWL2_FRAME_WIDTH = 8;
|
||||
static const int CHARACTER_CRAWL2_COLLISION_LEFT_OFFSET = 1;
|
||||
static const int CHARACTER_CRAWL2_COLLISION_RIGHT_OFFSET = 0;
|
||||
static const int CHARACTER_CRAWL2_COLLISION_WIDTH = CHARACTER_CRAWL2_FRAME_WIDTH - (CHARACTER_CRAWL2_COLLISION_LEFT_OFFSET + CHARACTER_CRAWL2_COLLISION_RIGHT_OFFSET);
|
||||
static const int CHARACTER_CRAWL2_COLLISION_HEIGHT = CHARACTER_CRAWL2_FRAME_HEIGHT - 4;
|
||||
106
semestralka1/src/assets/character_run_frames.h
Normal file
@@ -0,0 +1,106 @@
|
||||
// src/assets/character_run_frames.h
|
||||
#pragma once
|
||||
|
||||
// Run frame 1
|
||||
static const char *RUN_FRAME_1[] = {
|
||||
"....g@w.",
|
||||
"..._ZF~.",
|
||||
"..@~@@y=",
|
||||
"\".g@_`.",
|
||||
"_ygF.Ry.",
|
||||
"`~`...4L",
|
||||
};
|
||||
|
||||
// Run frame 2
|
||||
static const char *RUN_FRAME_2[] = {
|
||||
"....g@w.",
|
||||
"..._Z~~.",
|
||||
"..aM@$y,",
|
||||
"..~a@_`.",
|
||||
".yy@`$..",
|
||||
"..`..@..",
|
||||
};
|
||||
|
||||
// Run frame 3
|
||||
static const char *RUN_FRAME_3[] = {
|
||||
"...a@$..",
|
||||
"..._Z~..",
|
||||
"..a@@...",
|
||||
"..R@@=..",
|
||||
".yy@@...",
|
||||
".``u@...",
|
||||
};
|
||||
|
||||
// Run frame 4
|
||||
static const char *RUN_FRAME_4[] = {
|
||||
"..g@$...",
|
||||
"..yT`...",
|
||||
".g@F....",
|
||||
".4@L....",
|
||||
"._$$....",
|
||||
".`@~....",
|
||||
};
|
||||
|
||||
// Run frame 5
|
||||
static const char *RUN_FRAME_5[] = {
|
||||
"...@@...",
|
||||
".._Z~...",
|
||||
"..@@....",
|
||||
"..$@#...",
|
||||
"..g@L...",
|
||||
".yFP....",
|
||||
};
|
||||
|
||||
// Run frame 6
|
||||
static const char *RUN_FRAME_6[] = {
|
||||
"....@@..",
|
||||
"..._Z~..",
|
||||
"..y@@,_.",
|
||||
"..@$@~~.",
|
||||
"..y@~$..",
|
||||
".aF~.4L.",
|
||||
};
|
||||
|
||||
// Run frame 7
|
||||
static const char *RUN_FRAME_7[] = {
|
||||
"....a@e.",
|
||||
"..._ZF`.",
|
||||
"..a~@@y=",
|
||||
"..'y@L`.",
|
||||
"_yyP.4y.",
|
||||
"`~`...4L",
|
||||
};
|
||||
|
||||
enum class RunFrame {
|
||||
Run1 = 0,
|
||||
Run2,
|
||||
Run3,
|
||||
Run4,
|
||||
Run5,
|
||||
Run6,
|
||||
Run7,
|
||||
COUNT
|
||||
};
|
||||
|
||||
static const char **CHARACTER_RUN_FRAMES[] = {
|
||||
RUN_FRAME_1,
|
||||
RUN_FRAME_2,
|
||||
RUN_FRAME_3,
|
||||
RUN_FRAME_4,
|
||||
RUN_FRAME_5,
|
||||
RUN_FRAME_6,
|
||||
RUN_FRAME_7,
|
||||
};
|
||||
|
||||
static const int CHARACTER_RUN_FRAME_COUNT = sizeof(CHARACTER_RUN_FRAMES) / sizeof(CHARACTER_RUN_FRAMES[0]);
|
||||
|
||||
// Height (rows per run frame)
|
||||
static const int CHARACTER_RUN_FRAME_HEIGHT = sizeof(RUN_FRAME_1) / sizeof(RUN_FRAME_1[0]);
|
||||
|
||||
static const int CHARACTER_RUN_COLLISION_HEIGHT = CHARACTER_RUN_FRAME_HEIGHT;
|
||||
|
||||
static const int CHARACTER_RUN_FRAME_WIDTH = 8;
|
||||
static const int CHARACTER_RUN_COLLISION_LEFT_OFFSET = 2;
|
||||
static const int CHARACTER_RUN_COLLISION_RIGHT_OFFSET = 2;
|
||||
// 8 je width a 2 zlava a 2 zprava
|
||||
static const int CHARACTER_RUN_COLLISION_WIDTH = CHARACTER_RUN_FRAME_WIDTH - (CHARACTER_RUN_COLLISION_LEFT_OFFSET + CHARACTER_RUN_COLLISION_RIGHT_OFFSET);
|
||||
104
semestralka1/src/assets/character_walk_frames.h
Normal file
@@ -0,0 +1,104 @@
|
||||
// src/assets/character_walk_frames.h
|
||||
#pragma once
|
||||
|
||||
// Walk frame 1
|
||||
static const char *WALK_FRAME_1[] = {
|
||||
"..a@w.",
|
||||
".._T`.",
|
||||
".s@@y.",
|
||||
".^$$~T",
|
||||
".y@`$.",
|
||||
"=F..?K",
|
||||
};
|
||||
|
||||
// Walk frame 2
|
||||
static const char *WALK_FRAME_2[] = {
|
||||
"..y@$.",
|
||||
".._Z~.",
|
||||
".y@@L.",
|
||||
".4W@Z!",
|
||||
"._$~$.",
|
||||
"~~`.0.",
|
||||
};
|
||||
|
||||
// Walk frame 3
|
||||
static const char *WALK_FRAME_3[] = {
|
||||
"..g@L.",
|
||||
".._T~.",
|
||||
".g@$..",
|
||||
".J@@..",
|
||||
"_y$4L.",
|
||||
"~~.4~.",
|
||||
};
|
||||
|
||||
// Walk frame 4
|
||||
static const char *WALK_FRAME_4[] = {
|
||||
"..a@w.",
|
||||
"..~T~.",
|
||||
"..@$..",
|
||||
"..@$..",
|
||||
"..y@..",
|
||||
".\"~@..",
|
||||
};
|
||||
|
||||
// Walk frame 5
|
||||
static const char *WALK_FRAME_5[] = {
|
||||
"..@@..",
|
||||
"..Z~..",
|
||||
"..@L..",
|
||||
"..@L..",
|
||||
"..$%..",
|
||||
".4F...",
|
||||
};
|
||||
|
||||
// Walk frame 6
|
||||
static const char *WALK_FRAME_6[] = {
|
||||
".u@$..",
|
||||
"..Z~..",
|
||||
".g@_..",
|
||||
".$@5+.",
|
||||
"._BL..",
|
||||
"uP.@..",
|
||||
};
|
||||
|
||||
// Walk frame 7
|
||||
static const char *WALK_FRAME_7[] = {
|
||||
"..a@w.",
|
||||
".._T`.",
|
||||
".s@@y.",
|
||||
".^$$~T",
|
||||
".yE`$.",
|
||||
"=F..JK",
|
||||
};
|
||||
|
||||
enum class WalkFrame {
|
||||
Walk1 = 0,
|
||||
Walk2,
|
||||
Walk3,
|
||||
Walk4,
|
||||
Walk5,
|
||||
Walk6,
|
||||
Walk7,
|
||||
COUNT
|
||||
};
|
||||
|
||||
static const char **CHARACTER_WALK_FRAMES[] = {
|
||||
WALK_FRAME_1,
|
||||
WALK_FRAME_2,
|
||||
WALK_FRAME_3,
|
||||
WALK_FRAME_4,
|
||||
WALK_FRAME_5,
|
||||
WALK_FRAME_6,
|
||||
WALK_FRAME_7,
|
||||
};
|
||||
|
||||
static const int CHARACTER_WALK_FRAME_COUNT = sizeof(CHARACTER_WALK_FRAMES) / sizeof(CHARACTER_WALK_FRAMES[0]);
|
||||
|
||||
// Height (rows per walk frame)
|
||||
static const int CHARACTER_WALK_FRAME_HEIGHT = sizeof(WALK_FRAME_1) / sizeof(WALK_FRAME_1[0]);
|
||||
|
||||
static const int CHARACTER_WALK_FRAME_WIDTH = 6;
|
||||
static const int CHARACTER_WALK_COLLISION_LEFT_OFFSET = 1;
|
||||
static const int CHARACTER_WALK_COLLISION_RIGHT_OFFSET = 1;
|
||||
// 8 je width a 2 zlava a 2 zprava
|
||||
static const int CHARACTER_WALK_COLLISION_WIDTH = CHARACTER_WALK_FRAME_WIDTH - (CHARACTER_WALK_COLLISION_LEFT_OFFSET + CHARACTER_WALK_COLLISION_RIGHT_OFFSET);
|
||||
47
semestralka1/src/assets/obstacle_crawl_frames.h
Normal file
@@ -0,0 +1,47 @@
|
||||
// src/assets/obstacle_crawl_frames.h
|
||||
#pragma once
|
||||
#include <cstring>
|
||||
|
||||
// Crawl obstacle for CRAWL1 (2 lines tall)
|
||||
static const char *OBSTACLE_CRAWL1_FRAME[] = {
|
||||
"#########",
|
||||
".######",
|
||||
"..#####",
|
||||
"..####",
|
||||
"...###",
|
||||
"...###"
|
||||
};
|
||||
|
||||
// Crawl obstacle for CRAWL2 (4 lines tall)
|
||||
static const char *OBSTACLE_CRAWL2_FRAME[] = {
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
"###",
|
||||
"###"
|
||||
};
|
||||
|
||||
enum class CrawlObstacleType { Crawl1 = 0, Crawl2, COUNT };
|
||||
|
||||
static const char **OBSTACLE_CRAWL_FRAMES[] = { OBSTACLE_CRAWL1_FRAME, OBSTACLE_CRAWL2_FRAME };
|
||||
|
||||
// Crawl1 dimensions and collision
|
||||
static const int OBSTACLE_CRAWL1_FRAME_HEIGHT = sizeof(OBSTACLE_CRAWL1_FRAME) / sizeof(OBSTACLE_CRAWL1_FRAME[0]);
|
||||
static const int OBSTACLE_CRAWL1_FRAME_WIDTH = std::strlen(OBSTACLE_CRAWL1_FRAME[0]);
|
||||
static const int OBSTACLE_CRAWL1_COLLISION_LEFT_OFFSET = 3;
|
||||
static const int OBSTACLE_CRAWL1_COLLISION_RIGHT_OFFSET = 3;
|
||||
static const int OBSTACLE_CRAWL1_COLLISION_WIDTH = OBSTACLE_CRAWL1_FRAME_WIDTH - (OBSTACLE_CRAWL1_COLLISION_LEFT_OFFSET + OBSTACLE_CRAWL1_COLLISION_RIGHT_OFFSET);
|
||||
static const int OBSTACLE_CRAWL1_COLLISION_TOP_OFFSET = 4; // first 4 rows are just empty ('.')
|
||||
// collision box height = bottom 2 rows
|
||||
static const int OBSTACLE_CRAWL1_COLLISION_HEIGHT = 2;
|
||||
|
||||
// Crawl2 dimensions and collision
|
||||
static const int OBSTACLE_CRAWL2_FRAME_HEIGHT = sizeof(OBSTACLE_CRAWL2_FRAME) / sizeof(OBSTACLE_CRAWL2_FRAME[0]);
|
||||
static const int OBSTACLE_CRAWL2_FRAME_WIDTH = std::strlen(OBSTACLE_CRAWL2_FRAME[0]);
|
||||
static const int OBSTACLE_CRAWL2_COLLISION_LEFT_OFFSET = 0;
|
||||
static const int OBSTACLE_CRAWL2_COLLISION_RIGHT_OFFSET = 0;
|
||||
static const int OBSTACLE_CRAWL2_COLLISION_WIDTH = OBSTACLE_CRAWL2_FRAME_WIDTH - (OBSTACLE_CRAWL2_COLLISION_LEFT_OFFSET + OBSTACLE_CRAWL2_COLLISION_RIGHT_OFFSET);
|
||||
static const int OBSTACLE_CRAWL2_COLLISION_HEIGHT = OBSTACLE_CRAWL2_FRAME_HEIGHT;
|
||||
16
semestralka1/src/game/animation.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
// src/game/animation.cpp
|
||||
#include "animation.h"
|
||||
|
||||
AnimationController::AnimationController() {
|
||||
anim_timer.start();
|
||||
}
|
||||
|
||||
bool AnimationController::tick(int speed) {
|
||||
if (anim_timer.elapsed_time() >= ANIMATION_TICK) {
|
||||
// speed determines scroll steps per tick
|
||||
shift += speed;
|
||||
anim_timer.reset();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
20
semestralka1/src/game/animation.h
Normal file
@@ -0,0 +1,20 @@
|
||||
// src/game/animation.h
|
||||
#pragma once
|
||||
#include "mbed.h"
|
||||
|
||||
constexpr auto ANIMATION_TICK = 170ms;
|
||||
|
||||
class AnimationController {
|
||||
private:
|
||||
Timer anim_timer;
|
||||
int shift = 0;
|
||||
|
||||
public:
|
||||
AnimationController();
|
||||
|
||||
// Update animation, returns true if redraw needed
|
||||
bool tick(int speed);
|
||||
|
||||
// Getters
|
||||
int get_shift() const { return shift; }
|
||||
};
|
||||
66
semestralka1/src/game/collision.h
Normal file
@@ -0,0 +1,66 @@
|
||||
// src/game/collision.h
|
||||
#pragma once
|
||||
#include "../render/player_positioning.h"
|
||||
#include "../assets/character_walk_frames.h"
|
||||
#include "../assets/character_run_frames.h"
|
||||
#include "../assets/character_crawl_frames.h"
|
||||
|
||||
// Simple obstacle representation
|
||||
struct Obstacle {
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
// Axis-aligned bounding-box collision
|
||||
inline bool check_collision(const CharacterPosition& player,
|
||||
MovementType movement,
|
||||
const Obstacle& obs) {
|
||||
|
||||
// Player is given in bottom-based world coordinates (0 = bottom line)
|
||||
const int player_x = player.x;
|
||||
const int player_bottom = player.y;
|
||||
int box_x = 0;
|
||||
int box_w = 0;
|
||||
int box_h = 0;
|
||||
|
||||
switch (movement) {
|
||||
case MovementType::Walk:
|
||||
box_x = player_x + CHARACTER_WALK_COLLISION_LEFT_OFFSET;
|
||||
box_w = CHARACTER_WALK_COLLISION_WIDTH;
|
||||
box_h = CHARACTER_WALK_FRAME_HEIGHT;
|
||||
break;
|
||||
case MovementType::Run:
|
||||
box_x = player_x + CHARACTER_RUN_COLLISION_LEFT_OFFSET;
|
||||
box_w = CHARACTER_RUN_COLLISION_WIDTH;
|
||||
box_h = CHARACTER_RUN_COLLISION_HEIGHT;
|
||||
break;
|
||||
case MovementType::Crawl1:
|
||||
box_x = player_x + CHARACTER_CRAWL1_COLLISION_LEFT_OFFSET;
|
||||
box_w = CHARACTER_CRAWL1_COLLISION_WIDTH;
|
||||
box_h = CHARACTER_CRAWL1_COLLISION_HEIGHT;
|
||||
break;
|
||||
case MovementType::Crawl2:
|
||||
box_x = player_x + CHARACTER_CRAWL2_COLLISION_LEFT_OFFSET;
|
||||
box_w = CHARACTER_CRAWL2_COLLISION_WIDTH;
|
||||
box_h = CHARACTER_CRAWL2_COLLISION_HEIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
// Player's bounding box
|
||||
const int player_left = box_x;
|
||||
const int player_right = player_left + box_w;
|
||||
const int player_top = player_bottom + box_h;
|
||||
|
||||
// Obstacle bounding box
|
||||
const int obs_left = obs.x;
|
||||
const int obs_right = obs.x + obs.width;
|
||||
const int obs_bottom = obs.y;
|
||||
const int obs_top = obs_bottom + obs.height;
|
||||
|
||||
// Simple overlap check
|
||||
bool horizontal = player_left < obs_right && player_right > obs_left;
|
||||
bool vertical = player_bottom < obs_top && player_top > obs_bottom;
|
||||
return horizontal && vertical;
|
||||
}
|
||||
56
semestralka1/src/game/obstacle_manager.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// src/game/obstacle_manager.h
|
||||
#pragma once
|
||||
#include "../game/collision.h"
|
||||
#include "../assets/obstacle_crawl_frames.h"
|
||||
#include "../assets/background_frame.h"
|
||||
|
||||
// One movable obstacle
|
||||
struct MovingObstacle {
|
||||
Obstacle data;
|
||||
CrawlObstacleType type;
|
||||
bool active;
|
||||
};
|
||||
|
||||
// Fixed obstacle pool
|
||||
constexpr int MAX_OBSTACLES = 6;
|
||||
static MovingObstacle obstacle_pool[MAX_OBSTACLES];
|
||||
|
||||
// Create / reset obstacle in one slot
|
||||
inline int spawn_obstacle(CrawlObstacleType type, int x_start) {
|
||||
for (int i = 0; i < MAX_OBSTACLES; i++) {
|
||||
if (!obstacle_pool[i].active) {
|
||||
obstacle_pool[i].active = true;
|
||||
obstacle_pool[i].type = type;
|
||||
obstacle_pool[i].data.x = x_start;
|
||||
|
||||
obstacle_pool[i].data.width = (type == CrawlObstacleType::Crawl1) ? OBSTACLE_CRAWL1_COLLISION_WIDTH : OBSTACLE_CRAWL2_COLLISION_WIDTH;
|
||||
obstacle_pool[i].data.height = (type == CrawlObstacleType::Crawl1) ? OBSTACLE_CRAWL1_COLLISION_HEIGHT : OBSTACLE_CRAWL2_COLLISION_HEIGHT;
|
||||
|
||||
// Default Y so that the SPRITE touches the top of the screen.
|
||||
// We store Y as the bottom of the COLLISION BOX in bottom-based world coords.
|
||||
int top_offset = 0;
|
||||
if (type == CrawlObstacleType::Crawl1) {
|
||||
top_offset = OBSTACLE_CRAWL1_COLLISION_TOP_OFFSET;
|
||||
} else {
|
||||
top_offset = 0;
|
||||
}
|
||||
const int i_bottom_of_collision = top_offset + obstacle_pool[i].data.height - 1;
|
||||
// Top of screen in world coords is VIEW_HEIGHT - 1
|
||||
const int collision_bottom_world_y = (VIEW_HEIGHT - 1) - i_bottom_of_collision;
|
||||
obstacle_pool[i].data.y = collision_bottom_world_y;
|
||||
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Update X positions; mark inactive if offscreen
|
||||
inline void update_obstacles(int shift_speed) {
|
||||
for (int i = 0; i < MAX_OBSTACLES; i++) {
|
||||
if (!obstacle_pool[i].active) continue;
|
||||
obstacle_pool[i].data.x -= shift_speed;
|
||||
if (obstacle_pool[i].data.x + obstacle_pool[i].data.width < 0)
|
||||
obstacle_pool[i].active = false;
|
||||
}
|
||||
}
|
||||
78
semestralka1/src/game/obstacle_system.h
Normal file
@@ -0,0 +1,78 @@
|
||||
// src/game/obstacle_system.h
|
||||
#pragma once
|
||||
#include "obstacle_manager.h"
|
||||
#include "../render/player_positioning.h"
|
||||
#include "../assets/obstacle_crawl_frames.h"
|
||||
#include "collision.h"
|
||||
#include "mbed.h"
|
||||
|
||||
// Small helper for minimal mbed-safe clamp
|
||||
inline int clamp_min(int a, int b) { return (a > b) ? a : b; }
|
||||
inline int clamp_max(int a, int b) { return (a < b) ? a : b; }
|
||||
|
||||
// Handles spawning, movement, rendering, and collision of obstacles
|
||||
class ObstacleSystem {
|
||||
public:
|
||||
ObstacleSystem() : tick_counter_(0), spawn_index_(0) {}
|
||||
|
||||
// Called once per frame
|
||||
bool update_and_draw(const CharacterPosition &player_pos,
|
||||
MovementType player_movement) {
|
||||
// Update timers, move existing obstacles
|
||||
tick_counter_++;
|
||||
if (tick_counter_ % UPDATE_INTERVAL == 0) {
|
||||
update_obstacles(1);
|
||||
}
|
||||
|
||||
// Periodically spawn new obstacle
|
||||
if (tick_counter_ % SPAWN_EVERY_TICKS == 0) {
|
||||
auto type = (spawn_index_++ % 2 == 0)
|
||||
? CrawlObstacleType::Crawl1
|
||||
: CrawlObstacleType::Crawl2;
|
||||
const int w = (type == CrawlObstacleType::Crawl1)
|
||||
? OBSTACLE_CRAWL1_FRAME_WIDTH
|
||||
: OBSTACLE_CRAWL2_FRAME_WIDTH;
|
||||
spawn_obstacle(type, VIEW_WIDTH - w - 1);
|
||||
}
|
||||
|
||||
// Draw & collision check
|
||||
for (int i = 0; i < MAX_OBSTACLES; i++) {
|
||||
if (!obstacle_pool[i].active)
|
||||
continue;
|
||||
|
||||
const char **frame = nullptr;
|
||||
int height = 0;
|
||||
if (obstacle_pool[i].type == CrawlObstacleType::Crawl1) {
|
||||
frame = OBSTACLE_CRAWL1_FRAME;
|
||||
height = OBSTACLE_CRAWL1_FRAME_HEIGHT;
|
||||
} else {
|
||||
frame = OBSTACLE_CRAWL2_FRAME;
|
||||
height = OBSTACLE_CRAWL2_FRAME_HEIGHT;
|
||||
}
|
||||
|
||||
draw_clipped_obstacle(obstacle_pool[i], frame, height);
|
||||
|
||||
// Collision check
|
||||
if (check_collision(player_pos, player_movement,
|
||||
obstacle_pool[i].data)) {
|
||||
printf("\033[2J\033[H");
|
||||
printf("GAME OVER\r\n");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr int SPAWN_EVERY_TICKS = 35;
|
||||
static constexpr int UPDATE_INTERVAL = 1; // move obstacles each frame
|
||||
int tick_counter_;
|
||||
int spawn_index_;
|
||||
|
||||
static void draw_clipped_obstacle(const MovingObstacle &obs,
|
||||
const char ** /*frame*/,
|
||||
int /*frame_height*/) {
|
||||
draw_obstacle(obs.data.x, obs.data.y, obs.type);
|
||||
}
|
||||
};
|
||||
178
semestralka1/src/game/state.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
// src/game/state.cpp
|
||||
#include "state.h"
|
||||
#include "../render/player.h"
|
||||
#include "../timing/speed_controller.h"
|
||||
#include "../assets/character_run_frames.h"
|
||||
#include "../assets/character_walk_frames.h"
|
||||
#include "../assets/character_crawl_frames.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace {
|
||||
// Vygenerovane AI, proste to nahodne vymiena obrazky - assests
|
||||
// Frame selector with two regimes:
|
||||
// 1) Normal (speed <= 6): ping‑pong with holds at both ends
|
||||
// 2) High‑speed (speed >= 7): 0, random(1..last-1), last, random(1..last-1)...
|
||||
static inline int compute_frame_index(int frame_count,
|
||||
float player_speed,
|
||||
int tick_counter) {
|
||||
if (frame_count <= 1) return 0;
|
||||
if (player_speed <= 0.0f) return 0;
|
||||
|
||||
const int last = frame_count - 1;
|
||||
|
||||
// High-speed pattern: 0, rand(1..last-1), last, rand(1..last-1), ...
|
||||
if (player_speed >= 7.0f) {
|
||||
// Special-case 2-frame animations
|
||||
if (frame_count <= 2) {
|
||||
return (tick_counter & 1) ? 1 : 0;
|
||||
}
|
||||
|
||||
// Even ticks → extremes (0 or last), alternating each time.
|
||||
// Odd ticks → pseudo-random mid in [1..last-1].
|
||||
if ((tick_counter & 1) == 0) {
|
||||
// Alternate 0 and last on even ticks
|
||||
bool choose_zero = ((tick_counter >> 1) & 1) == 0;
|
||||
return choose_zero ? 0 : last;
|
||||
} else {
|
||||
// Simple deterministic PRNG from tick_counter and speed
|
||||
unsigned int seed =
|
||||
static_cast<unsigned int>(tick_counter) * 1664525u + 1013904223u;
|
||||
seed ^= static_cast<unsigned int>(frame_count) * 2654435761u;
|
||||
seed ^= static_cast<unsigned int>(player_speed * 997.0f);
|
||||
int range = last - 1; // size of 1..last-1
|
||||
if (range <= 0) return 0; // safety
|
||||
int mid = 1 + static_cast<int>(seed % static_cast<unsigned int>(range));
|
||||
return mid;
|
||||
}
|
||||
}
|
||||
|
||||
// Normal-speed regime: discrete ping‑pong with holds at both ends.
|
||||
// - speed 1 => 0,1,2,...,last, last, ..., 2,1, 0,0 ...
|
||||
// - speed 2 => advances 2 steps per tick (skipping every second timeline entry)
|
||||
// - holds at ends make 0 and last appear more frequently
|
||||
const int hold = 2; // how many extra steps to hold at each end
|
||||
|
||||
// One full ping‑pong cycle length:
|
||||
// [hold at 0] + [ascend 1..last] + [hold at last] + [descend last-1..0]
|
||||
const int ascend_len = last; // produces 1..last (length = last)
|
||||
const int descend_len = last; // produces last-1..0 (length = last)
|
||||
const int cycle_len = hold + ascend_len + hold + descend_len;
|
||||
|
||||
// Advance by an integer number of steps per tick based on speed
|
||||
int step = static_cast<int>(floorf(player_speed + 0.5f));
|
||||
if (step < 1) step = 1;
|
||||
|
||||
// Use 64-bit for safety, then fold into cycle length
|
||||
const long long pos64 =
|
||||
(static_cast<long long>(tick_counter) *
|
||||
static_cast<long long>(step)) %
|
||||
static_cast<long long>(cycle_len);
|
||||
int pos = static_cast<int>(pos64);
|
||||
|
||||
// Map timeline position to frame index
|
||||
if (pos < hold) {
|
||||
return 0; // hold at 0
|
||||
}
|
||||
pos -= hold;
|
||||
|
||||
if (pos < ascend_len) {
|
||||
// ascend: 1..last
|
||||
return (pos + 1);
|
||||
}
|
||||
pos -= ascend_len;
|
||||
|
||||
if (pos < hold) {
|
||||
return last; // hold at last
|
||||
}
|
||||
pos -= hold;
|
||||
|
||||
// descend: last-1 .. 0
|
||||
return last - 1 - pos;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void WalkingState::update() {
|
||||
// stop crawling after duration
|
||||
if ((current_state == PlayerState::Crawl1 ||
|
||||
current_state == PlayerState::Crawl2) &&
|
||||
state_timer.elapsed_time() >= CRAWL_DURATION) {
|
||||
current_state = PlayerState::Walk;
|
||||
state_timer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void WalkingState::start_crawl(PlayerState crawl_type) {
|
||||
if (crawl_type != PlayerState::Crawl1 && crawl_type != PlayerState::Crawl2)
|
||||
return;
|
||||
|
||||
current_state = crawl_type;
|
||||
state_timer.stop();
|
||||
state_timer.reset();
|
||||
state_timer.start();
|
||||
}
|
||||
|
||||
void WalkingState::set_state(PlayerState s) {
|
||||
if (current_state != s) {
|
||||
walk_index = run_index = crawl1_index = crawl2_index = 0;
|
||||
phase = 0.0f;
|
||||
}
|
||||
current_state = s;
|
||||
}
|
||||
|
||||
void WalkingState::set_motion_state_for_speed(int player_speed, int ground_speed) {
|
||||
int relative = player_speed - ground_speed;
|
||||
PlayerState new_state = (relative > 1) ? PlayerState::Run : PlayerState::Walk;
|
||||
if (new_state != current_state) {
|
||||
run_index = 0;
|
||||
walk_index = 0;
|
||||
}
|
||||
current_state = new_state;
|
||||
}
|
||||
|
||||
// TODO THIS NEEDS REDESIGN FOR WALK/RUN
|
||||
void WalkingState::toggle_walk_frame(float player_speed, int tick_counter) {
|
||||
switch (current_state) {
|
||||
case PlayerState::Run:
|
||||
run_index = compute_frame_index(CHARACTER_RUN_FRAME_COUNT, player_speed, tick_counter);
|
||||
break;
|
||||
|
||||
case PlayerState::Walk:
|
||||
walk_index = compute_frame_index(CHARACTER_WALK_FRAME_COUNT, player_speed, tick_counter);
|
||||
break;
|
||||
|
||||
case PlayerState::Crawl1:
|
||||
crawl1_index = compute_frame_index(CHARACTER_CRAWL1_FRAME_COUNT, player_speed, tick_counter);
|
||||
break;
|
||||
|
||||
case PlayerState::Crawl2:
|
||||
crawl2_index = compute_frame_index(CHARACTER_CRAWL2_FRAME_COUNT, player_speed, tick_counter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FrameSelection WalkingState::get_frame_selection() const {
|
||||
FrameSelection f{};
|
||||
switch (current_state) {
|
||||
case PlayerState::Walk:
|
||||
f.movement = MovementType::Walk;
|
||||
f.frame_index = walk_index;
|
||||
break;
|
||||
case PlayerState::Run:
|
||||
f.movement = MovementType::Run;
|
||||
f.frame_index = run_index;
|
||||
break;
|
||||
case PlayerState::Crawl1:
|
||||
f.movement = MovementType::Crawl1;
|
||||
f.frame_index = crawl1_index;
|
||||
break;
|
||||
case PlayerState::Crawl2:
|
||||
f.movement = MovementType::Crawl2;
|
||||
f.frame_index = crawl2_index;
|
||||
break;
|
||||
default:
|
||||
f.movement = MovementType::Walk;
|
||||
f.frame_index = walk_index;
|
||||
break;
|
||||
}
|
||||
return f;
|
||||
}
|
||||
36
semestralka1/src/game/state.h
Normal file
@@ -0,0 +1,36 @@
|
||||
// src/game/state.h
|
||||
#pragma once
|
||||
#include "mbed.h"
|
||||
#include "../render/player.h"
|
||||
|
||||
constexpr auto CRAWL_DURATION = 300ms;
|
||||
|
||||
enum class PlayerState { Walk, Run, Crawl1, Crawl2 };
|
||||
|
||||
struct FrameSelection {
|
||||
MovementType movement;
|
||||
int frame_index;
|
||||
};
|
||||
|
||||
class WalkingState {
|
||||
private:
|
||||
PlayerState current_state = PlayerState::Walk;
|
||||
Timer state_timer;
|
||||
int walk_index = 0; // cycles 0‑6
|
||||
int run_index = 0; // cycles 0‑6
|
||||
int crawl1_index = 0; // cycles 0‑1
|
||||
int crawl2_index = 0; // cycles 0‑1
|
||||
float phase = 0.0f;
|
||||
|
||||
public:
|
||||
void update();
|
||||
void start_crawl(PlayerState crawl_type);
|
||||
|
||||
void set_motion_state_for_speed(int player_speed, int ground_speed);
|
||||
void toggle_walk_frame(float player_speed, int tick_counter);
|
||||
|
||||
FrameSelection get_frame_selection() const;
|
||||
PlayerState get_state() const { return current_state; }
|
||||
|
||||
void set_state(PlayerState s);
|
||||
};
|
||||
49
semestralka1/src/hardware/uart.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
// src/hardware/uart.cpp
|
||||
#include "uart.h"
|
||||
#include <cstring>
|
||||
|
||||
UartReader::UartReader(BufferedSerial &serial) : serial_port(serial) {
|
||||
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||
memset(message, 0, sizeof(message));
|
||||
}
|
||||
|
||||
UartEvent UartReader::poll() {
|
||||
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) {
|
||||
strncpy(message, rx_buffer, sizeof(message) - 1);
|
||||
message_active = true;
|
||||
changed = true;
|
||||
triggered = true;
|
||||
}
|
||||
}
|
||||
|
||||
// casovac na 1s zobrazenia spravy
|
||||
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 UartEvent::Triggered;
|
||||
if (changed)
|
||||
return UartEvent::MessageUpdate;
|
||||
return UartEvent::NoChange;
|
||||
}
|
||||
|
||||
const char* UartReader::get_message() const {
|
||||
return message_active ? message : nullptr;
|
||||
}
|
||||
35
semestralka1/src/hardware/uart.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// src/hardware/uart.h
|
||||
#pragma once
|
||||
#include "mbed.h"
|
||||
#include <cstddef>
|
||||
|
||||
constexpr size_t UART_BUFFER_SIZE = 64;
|
||||
constexpr auto MESSAGE_DISPLAY_DURATION = 1s;
|
||||
|
||||
enum class UartEvent {
|
||||
NoChange = 0, // No new data
|
||||
MessageUpdate = 1, // Message changed (received or expired)
|
||||
Triggered = 2 // New message received (trigger action)
|
||||
};
|
||||
|
||||
class UartReader {
|
||||
private:
|
||||
BufferedSerial &serial_port;
|
||||
|
||||
char rx_buffer[UART_BUFFER_SIZE];
|
||||
char message[UART_BUFFER_SIZE];
|
||||
bool message_active = false;
|
||||
|
||||
Timer msg_timer;
|
||||
bool timer_started = false;
|
||||
|
||||
public:
|
||||
UartReader(BufferedSerial &serial);
|
||||
|
||||
// Poll for UART events
|
||||
UartEvent poll();
|
||||
|
||||
// Get current message (nullptr if no active message)
|
||||
const char* get_message() const;
|
||||
bool has_message() const { return message_active; }
|
||||
};
|
||||
26
semestralka1/src/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// main.cpp
|
||||
|
||||
#include "mbed.h"
|
||||
#include "assets/background_frame.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(6);
|
||||
}
|
||||
33
semestralka1/src/render/background.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
// src/render/background.cpp
|
||||
|
||||
#include "background.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text) {
|
||||
// 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);
|
||||
}
|
||||
7
semestralka1/src/render/background.h
Normal file
@@ -0,0 +1,7 @@
|
||||
// src/render/background.h
|
||||
|
||||
#pragma once
|
||||
constexpr int VIEW_WIDTH = 90;
|
||||
|
||||
// Draws the ASCII art background with optional message
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr);
|
||||
141
semestralka1/src/render/loop.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
// src/render/loop.cpp
|
||||
#include "loop.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include "player_positioning.h"
|
||||
#include "background.h"
|
||||
#include "mbed.h"
|
||||
#include "player.h"
|
||||
#include "../game/state.h"
|
||||
#include "../game/animation.h"
|
||||
#include "../game/collision.h"
|
||||
#include "../hardware/uart.h"
|
||||
#include "../render/player.h"
|
||||
#include "../render/obstacle.h"
|
||||
#include "../timing/speed_controller.h"
|
||||
#include "../timing/movement_controller.h"
|
||||
#include "../game/obstacle_system.h"
|
||||
|
||||
extern BufferedSerial serial_port;
|
||||
extern DigitalOut led;
|
||||
|
||||
// Constants
|
||||
// constexpr int PLAYER_X = 9;
|
||||
constexpr int PLAYER_X = 29;
|
||||
constexpr int PLAYER_Y = 6;
|
||||
|
||||
void draw_mask(const char *unused_filename, int shift, const char *text);
|
||||
|
||||
void render_loop(int speed) {
|
||||
WalkingState player_state;
|
||||
AnimationController animation;
|
||||
UartReader uart(serial_port);
|
||||
MovementController mover(PLAYER_X, VIEW_WIDTH);
|
||||
SpeedController timing;
|
||||
timing.set_ground_speed(speed);
|
||||
|
||||
CharacterPosition pos = {PLAYER_X, PLAYER_Y};
|
||||
|
||||
const char *bg_file = "background_dark_inverted.txt";
|
||||
bool need_redraw = false;
|
||||
|
||||
int anim_tick_counter = 0;
|
||||
int tick_counter = 0;
|
||||
int player_speed = 6;
|
||||
bool game_over = false;
|
||||
|
||||
player_state.set_state(PlayerState::Run);
|
||||
|
||||
CrawlObstacleType type = CrawlObstacleType::Crawl1;
|
||||
int start_x = VIEW_WIDTH + 10;
|
||||
spawn_obstacle(type, start_x);
|
||||
|
||||
Timer spawn_timer;
|
||||
spawn_timer.start();
|
||||
|
||||
while (!game_over) {
|
||||
tick_counter++;
|
||||
|
||||
mover.update_position(player_speed, timing.get_ground_speed());
|
||||
pos.x = mover.get_position();
|
||||
|
||||
if (spawn_timer.elapsed_time() > 2s) {
|
||||
spawn_timer.reset();
|
||||
CrawlObstacleType s_type = CrawlObstacleType::Crawl1;
|
||||
int spawn_x = VIEW_WIDTH;
|
||||
int idx = spawn_obstacle(s_type, spawn_x);
|
||||
if (idx >= 0) {
|
||||
obstacle_pool[idx].active = true;
|
||||
}
|
||||
}
|
||||
|
||||
need_redraw = false;
|
||||
UartEvent uart_event = uart.poll();
|
||||
|
||||
if (uart_event == UartEvent::MessageUpdate) {
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
if (uart_event == UartEvent::Triggered) {
|
||||
PlayerState current = player_state.get_state();
|
||||
|
||||
if (current == PlayerState::Walk || current == PlayerState::Run) {
|
||||
player_state.start_crawl(PlayerState::Crawl1);
|
||||
}
|
||||
else if (current == PlayerState::Crawl1) {
|
||||
player_state.start_crawl(PlayerState::Crawl2);
|
||||
}
|
||||
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
// Check if crawl duration expired
|
||||
player_state.update();
|
||||
|
||||
if (animation.tick(speed)) {
|
||||
anim_tick_counter++;
|
||||
int ground_speed = timing.get_ground_speed();
|
||||
for (int i = 0; i < MAX_OBSTACLES; i++) {
|
||||
if (obstacle_pool[i].active) {
|
||||
obstacle_pool[i].data.x -= ground_speed;
|
||||
// deactivate when offscreen
|
||||
if (obstacle_pool[i].data.x + obstacle_pool[i].data.width < 0)
|
||||
obstacle_pool[i].active = false;
|
||||
}
|
||||
}
|
||||
|
||||
need_redraw = true;
|
||||
}
|
||||
|
||||
if (need_redraw) {
|
||||
player_state.toggle_walk_frame(player_speed, anim_tick_counter);
|
||||
draw_mask(bg_file, animation.get_shift(), uart.get_message());
|
||||
FrameSelection frame = player_state.get_frame_selection();
|
||||
|
||||
CharacterPosition draw_pos = get_aligned_frame_position(pos, frame.movement, frame.frame_index);
|
||||
draw_character(draw_pos.x, draw_pos.y, frame.movement, frame.frame_index);
|
||||
|
||||
for (int i = 0; i < MAX_OBSTACLES; i++) {
|
||||
if (!obstacle_pool[i].active)
|
||||
continue;
|
||||
|
||||
draw_obstacle(obstacle_pool[i].data.x,
|
||||
obstacle_pool[i].data.y,
|
||||
obstacle_pool[i].type);
|
||||
|
||||
if (check_collision(pos, frame.movement, obstacle_pool[i].data)) {
|
||||
printf("\033[2J\033[H");
|
||||
printf("GAME OVER\r\n");
|
||||
game_over = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (game_over)
|
||||
break;
|
||||
|
||||
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);
|
||||
56
semestralka1/src/render/obstacle.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
// src/render/obstacle.cpp
|
||||
#include "obstacle.h"
|
||||
#include "../assets/obstacle_crawl_frames.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include <cstdio>
|
||||
|
||||
// Draws an obstacle using bottom‑based world coordinates.
|
||||
// x = left edge of the collision box in world space
|
||||
// y = bottom edge of the collision box in world space (0 = ground)
|
||||
void draw_obstacle(int x, int y, CrawlObstacleType type) {
|
||||
const char **obstacle_frame = nullptr;
|
||||
int frame_total_height = 0;
|
||||
|
||||
// Collision‑model parameters for this obstacle
|
||||
int collision_top_offset = 0; // rows from visual top to top of collision box
|
||||
int collision_height = 0; // rows tall
|
||||
int collision_left_offset = 0; // columns from visual left to collision left
|
||||
|
||||
switch (type) {
|
||||
case CrawlObstacleType::Crawl1:
|
||||
obstacle_frame = OBSTACLE_CRAWL1_FRAME;
|
||||
frame_total_height = OBSTACLE_CRAWL1_FRAME_HEIGHT;
|
||||
collision_top_offset = OBSTACLE_CRAWL1_COLLISION_TOP_OFFSET;
|
||||
collision_height = OBSTACLE_CRAWL1_COLLISION_HEIGHT;
|
||||
collision_left_offset = OBSTACLE_CRAWL1_COLLISION_LEFT_OFFSET;
|
||||
break;
|
||||
|
||||
case CrawlObstacleType::Crawl2:
|
||||
obstacle_frame = OBSTACLE_CRAWL2_FRAME;
|
||||
frame_total_height = OBSTACLE_CRAWL2_FRAME_HEIGHT;
|
||||
collision_top_offset = 0;
|
||||
collision_height = OBSTACLE_CRAWL2_COLLISION_HEIGHT;
|
||||
collision_left_offset = OBSTACLE_CRAWL2_COLLISION_LEFT_OFFSET;
|
||||
break;
|
||||
|
||||
default:
|
||||
return; // no rendering for invalid type
|
||||
}
|
||||
|
||||
// Convert bottom‑based (world) coordinates to screen coordinates.
|
||||
// Y of the collision bottom is given; translate to where to start drawing the visual frame.
|
||||
const int frame_row_index_bottom = collision_top_offset + collision_height - 1;
|
||||
const int frame_top_world_y = y + frame_row_index_bottom;
|
||||
const int frame_top_screen_row = VIEW_HEIGHT - frame_top_world_y;
|
||||
|
||||
// X of the collision box is given; shift left to the visual frame's starting column.
|
||||
const int frame_screen_x = x - collision_left_offset;
|
||||
|
||||
for (int i = 0; i < frame_total_height; i++) {
|
||||
const int screen_row = frame_top_screen_row + i;
|
||||
if (screen_row < 1 || screen_row > VIEW_HEIGHT) continue;
|
||||
printf("\033[%d;%dH%s", screen_row, frame_screen_x + 1, obstacle_frame[i]);
|
||||
}
|
||||
|
||||
fflush(stdout);
|
||||
}
|
||||
7
semestralka1/src/render/obstacle.h
Normal file
@@ -0,0 +1,7 @@
|
||||
// src/render/obstacle.h
|
||||
#pragma once
|
||||
|
||||
#include "../assets/obstacle_crawl_frames.h"
|
||||
|
||||
// Draw the obstacle ASCII block starting at given (x, y)
|
||||
void draw_obstacle(int x, int y, CrawlObstacleType type);
|
||||
51
semestralka1/src/render/player.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// src/render/player.cpp
|
||||
#include "player.h"
|
||||
#include "../assets/character_walk_frames.h"
|
||||
#include "../assets/character_run_frames.h"
|
||||
#include "../assets/character_crawl_frames.h"
|
||||
#include <cstdio>
|
||||
|
||||
void draw_character(int x, int y, MovementType movement, int frame_index) {
|
||||
const char **character = nullptr;
|
||||
int character_height = 0;
|
||||
int total_frames = 0;
|
||||
|
||||
switch (movement) {
|
||||
case MovementType::Walk:
|
||||
total_frames = CHARACTER_WALK_FRAME_COUNT;
|
||||
if (frame_index < 0 || frame_index >= total_frames)
|
||||
frame_index = 0;
|
||||
character = CHARACTER_WALK_FRAMES[frame_index];
|
||||
character_height = CHARACTER_WALK_FRAME_HEIGHT;
|
||||
break;
|
||||
|
||||
case MovementType::Run:
|
||||
total_frames = CHARACTER_RUN_FRAME_COUNT;
|
||||
if (frame_index < 0 || frame_index >= total_frames)
|
||||
frame_index = 0;
|
||||
character = CHARACTER_RUN_FRAMES[frame_index];
|
||||
character_height = CHARACTER_RUN_FRAME_HEIGHT;
|
||||
break;
|
||||
|
||||
case MovementType::Crawl1:
|
||||
total_frames = CHARACTER_CRAWL1_FRAME_COUNT;
|
||||
if (frame_index < 0 || frame_index >= total_frames)
|
||||
frame_index = 0;
|
||||
character = CHARACTER_CRAWL1_FRAMES[frame_index];
|
||||
character_height = CHARACTER_CRAWL1_FRAME_HEIGHT;
|
||||
break;
|
||||
|
||||
case MovementType::Crawl2:
|
||||
total_frames = CHARACTER_CRAWL2_FRAME_COUNT;
|
||||
if (frame_index < 0 || frame_index >= total_frames)
|
||||
frame_index = 0;
|
||||
character = CHARACTER_CRAWL2_FRAMES[frame_index];
|
||||
character_height = CHARACTER_CRAWL2_FRAME_HEIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < character_height; i++) {
|
||||
printf("\033[%d;%dH%s", y + i + 1, x + 1, character[i]);
|
||||
}
|
||||
fflush(stdout);
|
||||
}
|
||||
12
semestralka1/src/render/player.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// src/render/player.h
|
||||
#pragma once
|
||||
|
||||
enum class MovementType {
|
||||
Walk,
|
||||
Run,
|
||||
Crawl1,
|
||||
Crawl2
|
||||
};
|
||||
|
||||
// Draw the player object starting at given (x, y)
|
||||
void draw_character(int x, int y, MovementType movement, int frame_index);
|
||||
33
semestralka1/src/render/player_positioning.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
// src/render/player_positioning.cpp
|
||||
#include "player_positioning.h"
|
||||
#include "../assets/background_frame.h"
|
||||
#include "../assets/character_walk_frames.h"
|
||||
#include "../assets/character_run_frames.h"
|
||||
#include "../assets/character_crawl_frames.h"
|
||||
#include <cstdio>
|
||||
|
||||
CharacterPosition get_aligned_frame_position(CharacterPosition base,
|
||||
MovementType movement,
|
||||
int /*frame_index*/) {
|
||||
int character_height = 0;
|
||||
|
||||
switch (movement) {
|
||||
case MovementType::Walk:
|
||||
character_height = CHARACTER_WALK_FRAME_HEIGHT;
|
||||
break;
|
||||
case MovementType::Run:
|
||||
character_height = CHARACTER_RUN_FRAME_HEIGHT;
|
||||
break;
|
||||
case MovementType::Crawl1:
|
||||
character_height = CHARACTER_CRAWL1_FRAME_HEIGHT;
|
||||
break;
|
||||
case MovementType::Crawl2:
|
||||
character_height = CHARACTER_CRAWL2_FRAME_HEIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
CharacterPosition draw_pos{};
|
||||
draw_pos.x = base.x;
|
||||
draw_pos.y = (VIEW_HEIGHT - base.y) - character_height;
|
||||
return draw_pos;
|
||||
}
|
||||
12
semestralka1/src/render/player_positioning.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// src/render/player_positioning.h
|
||||
#pragma once
|
||||
#include "../assets/background_frame.h"
|
||||
#include "player.h"
|
||||
|
||||
struct CharacterPosition {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
// Calculates drawing position relative to bottom-left pivot
|
||||
CharacterPosition get_aligned_frame_position(CharacterPosition base, MovementType movement,int frame_index);
|
||||
29
semestralka1/src/timing/movement_controller.h
Normal file
@@ -0,0 +1,29 @@
|
||||
// src/timing/movement_controller.h
|
||||
|
||||
#pragma once
|
||||
#include "mbed.h"
|
||||
|
||||
// Handles position of the player relative to ground movement
|
||||
class MovementController {
|
||||
private:
|
||||
float x_pos;
|
||||
const int view_width;
|
||||
|
||||
// Scale factor for translating speed difference to pixel movement
|
||||
const float motion_scale = 0.2f;
|
||||
|
||||
public:
|
||||
MovementController(int start_x, int width) : x_pos(static_cast<float>(start_x)), view_width(width) {}
|
||||
|
||||
void reset(int start_x) { x_pos = static_cast<float>(start_x); }
|
||||
|
||||
void update_position(int player_speed, int ground_speed) {
|
||||
int delta = player_speed - ground_speed;
|
||||
x_pos += static_cast<float>(delta) * motion_scale;
|
||||
|
||||
if (x_pos < 0) x_pos = 0;
|
||||
if (x_pos > (VIEW_WIDTH - 10)) x_pos = static_cast<float>(VIEW_WIDTH - 10);
|
||||
}
|
||||
|
||||
int get_position() const { return static_cast<int>(x_pos); }
|
||||
};
|
||||
34
semestralka1/src/timing/speed_controller.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
// src/timing/speed_controller.cpp
|
||||
#include "speed_controller.h"
|
||||
|
||||
void SpeedController::set_ground_speed(int spd) {
|
||||
if (spd < 0) spd = 0;
|
||||
if (spd > 30) spd = 30;
|
||||
ground_speed = spd;
|
||||
}
|
||||
|
||||
int SpeedController::frame_advance_for(int object_speed, int tick_counter) const {
|
||||
if (object_speed <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ground_speed == 0) {
|
||||
return 1 + object_speed;
|
||||
}
|
||||
|
||||
const int delta = object_speed - ground_speed;
|
||||
|
||||
if (delta > 0) {
|
||||
return 1 + delta;
|
||||
}
|
||||
|
||||
if (delta == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
float ratio_f = static_cast<float>(ground_speed) / object_speed;
|
||||
int ratio = static_cast<int>(ratio_f + 0.3f);
|
||||
if (ratio < 1) ratio = 1;
|
||||
|
||||
return (tick_counter % ratio == 0) ? 1 : 0;
|
||||
}
|
||||
19
semestralka1/src/timing/speed_controller.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// src/timing/speed_controller.h
|
||||
#pragma once
|
||||
#include "mbed.h"
|
||||
|
||||
class SpeedController {
|
||||
private:
|
||||
int ground_speed = 1;
|
||||
|
||||
public:
|
||||
SpeedController() = default;
|
||||
|
||||
void set_ground_speed(int spd);
|
||||
int get_ground_speed() const { return ground_speed; }
|
||||
|
||||
// Calculates how many frames to advance for current tick.
|
||||
// Takes object’s current speed and a global tick counter
|
||||
// to automatically handle slower "wait" behavior.
|
||||
int frame_advance_for(int object_speed, int tick_counter) const;
|
||||
};
|
||||