Compare commits
29 Commits
7e7f4b471a
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ed4452fae | ||
|
|
b9ca8df59b | ||
|
|
8fa8bf392b | ||
|
|
9170524d33 | ||
|
|
cda395d6b9 | ||
|
|
d8da84cffc | ||
|
|
f6a13309f7 | ||
|
|
9c93179bf0 | ||
|
|
38b8bb0657 | ||
|
|
b147d92423 | ||
|
|
13f01d13f8 | ||
|
|
ebe03f42b6 | ||
|
|
a1c742c1cd | ||
|
|
3e0018d1cb | ||
|
|
1f5bc11ddd | ||
|
|
79db5bb8a0 | ||
|
|
bb1a24e7b3 | ||
|
|
04085c97f1 | ||
|
|
b52c78d056 | ||
|
|
19dec1ee05 | ||
|
|
071e344597 | ||
|
|
b3a228c3ac | ||
|
|
10e11858f3 | ||
|
|
662107fb28 | ||
|
|
88e68268f3 | ||
|
|
3c11e1dff8 | ||
|
|
bf058182f5 | ||
|
|
983c503caa | ||
|
|
915c573b27 |
79
.gitignore
vendored
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
|
||||||
|
# --- Build directories ---
|
||||||
|
cmake_build/
|
||||||
|
BUILD/
|
||||||
|
build/
|
||||||
|
out/
|
||||||
|
output/
|
||||||
|
*.map
|
||||||
|
*.bin
|
||||||
|
*.hex
|
||||||
|
*.elf
|
||||||
|
*.srec
|
||||||
|
|
||||||
|
# --- Object & dependency files ---
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.d
|
||||||
|
*.lst
|
||||||
|
*.dep
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
# --- CMake / Ninja / Make ---
|
||||||
|
CMakeFiles/
|
||||||
|
CMakeCache.txt
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
*.ninja
|
||||||
|
.ninja_deps
|
||||||
|
.ninja_log
|
||||||
|
CMakeUserPresets.json
|
||||||
|
|
||||||
|
# --- Logs ---
|
||||||
|
*.log
|
||||||
|
*.trace
|
||||||
|
*.i
|
||||||
|
*.ii
|
||||||
|
*.s
|
||||||
|
|
||||||
|
# --- IDE & editor configuration ---
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.launch
|
||||||
|
*.code-workspace
|
||||||
|
*.user
|
||||||
|
*.sublime*
|
||||||
|
*.orig
|
||||||
|
*.bak
|
||||||
|
|
||||||
|
# --- macOS & Windows system files ---
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# --- Python-related ---
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
.venv/
|
||||||
|
venv/
|
||||||
|
|
||||||
|
# --- Mbed tools generated files ---
|
||||||
|
.mbed/
|
||||||
|
.mbedignore
|
||||||
|
mbed_settings.py
|
||||||
|
mbed_config.cmake
|
||||||
|
*.mbedignore
|
||||||
|
mbed-os/tools/
|
||||||
|
mbed-os/cmake_build*/
|
||||||
|
*/cmake_build/
|
||||||
|
*/BUILD/
|
||||||
|
|
||||||
|
# --- Firmware output ---
|
||||||
|
*.axf
|
||||||
|
*.sb
|
||||||
|
*.s19
|
||||||
|
|
||||||
|
# --- Miscellaneous ---
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.tgz
|
||||||
BIN
Cvičenie_5.tar
Normal file
46
cvicenie_5/Button.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#include "Button.h"
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Button::Button(PinName pin)
|
||||||
|
: button(pin)
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
pressed = false;
|
||||||
|
button.rise(callback(this, &Button::interrupt)); // attach increment function of this counter instance
|
||||||
|
// set pin mode : PullUp / PullDown / PullNone / OpenDrain
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Button::interrupt()
|
||||||
|
{
|
||||||
|
pressed = true;
|
||||||
|
counter++;
|
||||||
|
if(counter >= 8)
|
||||||
|
counter=0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
Button::~Button()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Button::read(void)
|
||||||
|
{
|
||||||
|
return button.read();
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Button::wasPressed(void)
|
||||||
|
{
|
||||||
|
if(pressed)
|
||||||
|
{
|
||||||
|
pressed = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
uint16_t Button::getCount(void)
|
||||||
|
{
|
||||||
|
return counter;
|
||||||
|
};
|
||||||
31
cvicenie_5/Button.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef __BUTTON_H
|
||||||
|
#define __BUTTON_H
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
// class Led
|
||||||
|
class Button
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void interrupt();
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
Button(PinName pin);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~Button();
|
||||||
|
|
||||||
|
// get value
|
||||||
|
bool read(void);
|
||||||
|
|
||||||
|
bool wasPressed(void);
|
||||||
|
// get number of button pressed
|
||||||
|
uint16_t getCount(void);
|
||||||
|
|
||||||
|
private:
|
||||||
|
InterruptIn button;
|
||||||
|
volatile bool pressed;
|
||||||
|
volatile uint16_t counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
66
cvicenie_5/Led.cpp
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#include "Led.h"
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Led::Led(PinName pin)
|
||||||
|
: led(pin)
|
||||||
|
{
|
||||||
|
led.period_ms(10);
|
||||||
|
led = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
Led::~Led()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
void Led::set(bool s)
|
||||||
|
{
|
||||||
|
if(s)
|
||||||
|
led = 1;
|
||||||
|
else
|
||||||
|
led = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Led::setDuty(float duty)
|
||||||
|
{
|
||||||
|
led.write(duty);
|
||||||
|
};
|
||||||
|
|
||||||
|
float Led::getDuty()
|
||||||
|
{
|
||||||
|
return led.read(); // Return the current output duty-cycle setting
|
||||||
|
}
|
||||||
|
|
||||||
|
void Led::graduallyOn()
|
||||||
|
{
|
||||||
|
for(float i=0 ; i<=1; i=i+0.01)
|
||||||
|
{
|
||||||
|
this->setDuty(i);
|
||||||
|
ThisThread::sleep_for(20ms);
|
||||||
|
}
|
||||||
|
led = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
PwmOut* Led::getPwmOut()
|
||||||
|
{
|
||||||
|
return &led;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Led::tickerHandler(void)
|
||||||
|
{
|
||||||
|
led = !led;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Led::setBlinkPeriod(float period)
|
||||||
|
{
|
||||||
|
if(period<=0)
|
||||||
|
{
|
||||||
|
ticker.detach(); // turn off ticker
|
||||||
|
// set(false);
|
||||||
|
this->set(false); // turn off led
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// ticker.attach(callback(this, &Led::tickerHandler), period); // deprecated
|
||||||
|
auto float_interval = std::chrono::duration<float>(period);
|
||||||
|
ticker.attach(callback(this, &Led::tickerHandler), std::chrono::duration_cast<std::chrono::microseconds>(float_interval));
|
||||||
|
}
|
||||||
33
cvicenie_5/Led.h
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef __LED_H
|
||||||
|
#define __LED_H
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
// class Led
|
||||||
|
class Led
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
Led(PinName pin);
|
||||||
|
//! Destructor
|
||||||
|
~Led();
|
||||||
|
// set value
|
||||||
|
void set(bool s);
|
||||||
|
// set duty
|
||||||
|
void setDuty(float duty);
|
||||||
|
// get duty
|
||||||
|
float getDuty();
|
||||||
|
void graduallyOn();
|
||||||
|
PwmOut* getPwmOut();
|
||||||
|
void setBlinkPeriod(float period);
|
||||||
|
void tickerHandler();
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
PwmOut led;
|
||||||
|
Ticker ticker;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
57
cvicenie_5/Uart.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#include "Uart.h"
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Uart::Uart(PinName tx, PinName rx, int baud = 9600)
|
||||||
|
: serial(tx, rx, baud)
|
||||||
|
{
|
||||||
|
received = false;
|
||||||
|
received_character = ' ';
|
||||||
|
// Set desired properties
|
||||||
|
serial.baud(baud);
|
||||||
|
serial.format(
|
||||||
|
/* bits */ 8,
|
||||||
|
/* parity */ SerialBase::None,
|
||||||
|
/* stop bit */ 1
|
||||||
|
);
|
||||||
|
serial.attach(callback(this, &Uart::rxInterrupt), SerialBase::RxIrq);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Uart::rxInterrupt()
|
||||||
|
{
|
||||||
|
char c;
|
||||||
|
serial.read(&c, 1);
|
||||||
|
received_character = c;
|
||||||
|
received = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
Uart::~Uart()
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
bool Uart::isCharReceived()
|
||||||
|
{
|
||||||
|
if(received)
|
||||||
|
{
|
||||||
|
received = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
char Uart::getReceivedChar()
|
||||||
|
{
|
||||||
|
return received_character;
|
||||||
|
};
|
||||||
|
|
||||||
|
void Uart::writeChar(char c)
|
||||||
|
{
|
||||||
|
serial.write(&c, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
UnbufferedSerial* Uart::getSerial()
|
||||||
|
{
|
||||||
|
return &serial;
|
||||||
|
};
|
||||||
28
cvicenie_5/Uart.h
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef __UART_H
|
||||||
|
#define __UART_H
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
// class Led
|
||||||
|
class Uart
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
void rxInterrupt();
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
Uart(PinName rx, PinName tx, int baud);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
~Uart();
|
||||||
|
|
||||||
|
bool isCharReceived();
|
||||||
|
char getReceivedChar();
|
||||||
|
void writeChar(char c);
|
||||||
|
UnbufferedSerial* getSerial();
|
||||||
|
private:
|
||||||
|
UnbufferedSerial serial;
|
||||||
|
volatile char received_character;
|
||||||
|
volatile bool received;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
39
cvicenie_5/main.cpp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#include "mbed.h"
|
||||||
|
#include "Led.h"
|
||||||
|
#include "Button.h"
|
||||||
|
#include "Uart.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
//LED and button PIN names
|
||||||
|
#define LED_GREEN PC_7 // LD1 LED_GREEN
|
||||||
|
#define LED_BLUE PB_7 // LD2 LED_BLUE
|
||||||
|
#define LED_RED PG_2 // LD3 LED_RED
|
||||||
|
#define USER_BUTTON PC_13 // B1 USER_BUTTON
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
DigitalOut red_led(LED_RED); // NO PWM on this pin
|
||||||
|
Led green_led(LED_GREEN), blue_led(LED_BLUE);
|
||||||
|
Button btn(USER_BUTTON);
|
||||||
|
Uart pc(USBTX, USBRX, 115200); // Baud Rate = 115200
|
||||||
|
char c;
|
||||||
|
uint8_t num;
|
||||||
|
printf("---------START-------\r\n");
|
||||||
|
printf("Press number : \r\n");
|
||||||
|
while (true) {
|
||||||
|
if (pc.isCharReceived()) {
|
||||||
|
c = pc.getReceivedChar();
|
||||||
|
printf("\r\n");
|
||||||
|
//pc.writeChar(pc.getReceivedChar());
|
||||||
|
if((c >='0') && (c <= '9'))
|
||||||
|
{
|
||||||
|
num = c - '0'; // conversion of character to number
|
||||||
|
printf("Received number : %d \r\n", num);
|
||||||
|
green_led.setBlinkPeriod(num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,9 @@
|
|||||||
pkgs.stlink
|
pkgs.stlink
|
||||||
pkgs.probe-rs
|
pkgs.probe-rs
|
||||||
pkgs.probe-rs-tools
|
pkgs.probe-rs-tools
|
||||||
|
pkgs.bear
|
||||||
|
pkgs.chafa
|
||||||
|
pkgs.imagemagick
|
||||||
mbedTools
|
mbedTools
|
||||||
pyOcd
|
pyOcd
|
||||||
];
|
];
|
||||||
|
|||||||
0
hod5/.gitignore → hod5a/.gitignore
vendored
32
hod5a/main.cpp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// main.cpp
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
DigitalOut led(LED1);
|
||||||
|
Ticker ticker;
|
||||||
|
|
||||||
|
void toggle_led() { led = !led; }
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
BufferedSerial serial(USBTX, USBRX);
|
||||||
|
serial.set_baud(9600);
|
||||||
|
|
||||||
|
char buf[32];
|
||||||
|
char msg[] = "Zadajte cislicu 1-9:\r\n";
|
||||||
|
serial.write(msg, sizeof(msg));
|
||||||
|
|
||||||
|
// Use explicit chrono type for full compatibility
|
||||||
|
ticker.attach(&toggle_led, std::chrono::seconds(1));
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
if (uint32_t num = serial.read(buf, sizeof(buf))) {
|
||||||
|
char c = buf[0];
|
||||||
|
if (c >= '1' && c <= '9') {
|
||||||
|
int period = c - '0';
|
||||||
|
ticker.detach();
|
||||||
|
ticker.attach(&toggle_led, std::chrono::seconds(period));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ThisThread::sleep_for(100ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
22
hod5b/.gitignore
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.build
|
||||||
|
.mbed
|
||||||
|
projectfiles
|
||||||
|
*.py*
|
||||||
|
|
||||||
|
# Local build directories
|
||||||
|
cmake_build/
|
||||||
|
BUILD/
|
||||||
|
mbed-os/
|
||||||
|
.mbed/
|
||||||
|
.mbedignore
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.hex
|
||||||
|
*.map
|
||||||
|
|
||||||
|
# IDE and temporary files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
33
hod5b/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
|
||||||
|
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||||
|
set(APP_TARGET mbed-os-example-blinky)
|
||||||
|
|
||||||
|
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||||
|
|
||||||
|
project(${APP_TARGET})
|
||||||
|
|
||||||
|
add_subdirectory(${MBED_PATH})
|
||||||
|
|
||||||
|
add_executable(${APP_TARGET})
|
||||||
|
|
||||||
|
target_sources(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
mbed-os
|
||||||
|
)
|
||||||
|
|
||||||
|
mbed_set_post_build(${APP_TARGET})
|
||||||
|
|
||||||
|
option(VERBOSE_BUILD "Have a verbose build process")
|
||||||
|
if(VERBOSE_BUILD)
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif()
|
||||||
5
hod5b/CONTRIBUTING.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# 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).
|
||||||
165
hod5b/LICENSE
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
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.
|
||||||
73
hod5b/README.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|

|
||||||
|
# Blinky Mbed OS example
|
||||||
|
|
||||||
|
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/).
|
||||||
|
|
||||||
|
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
hod5b/mbed-os.lib
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
|
||||||
BIN
hod5b/resources/official_armmbed_example_badge.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
8
hod6/.clangd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CompileFlags:
|
||||||
|
Add:
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/arm-none-eabi/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include-fixed
|
||||||
23
hod6/.gitignore
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
.build
|
||||||
|
.mbed
|
||||||
|
projectfiles
|
||||||
|
*.py*
|
||||||
|
|
||||||
|
# Local build directories
|
||||||
|
cmake_build/
|
||||||
|
BUILD/
|
||||||
|
mbed-os/
|
||||||
|
.mbed/
|
||||||
|
.mbedignore
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.hex
|
||||||
|
*.map
|
||||||
|
|
||||||
|
# IDE and temporary files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
|
.cache/
|
||||||
33
hod6/CMakeLists.txt
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
|
||||||
|
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||||
|
set(APP_TARGET mbed-os-example-blinky)
|
||||||
|
|
||||||
|
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||||
|
|
||||||
|
project(${APP_TARGET})
|
||||||
|
|
||||||
|
add_subdirectory(${MBED_PATH})
|
||||||
|
|
||||||
|
add_executable(${APP_TARGET})
|
||||||
|
|
||||||
|
target_sources(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
mbed-os
|
||||||
|
)
|
||||||
|
|
||||||
|
mbed_set_post_build(${APP_TARGET})
|
||||||
|
|
||||||
|
option(VERBOSE_BUILD "Have a verbose build process")
|
||||||
|
if(VERBOSE_BUILD)
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif()
|
||||||
5
hod6/CONTRIBUTING.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# 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).
|
||||||
165
hod6/LICENSE
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
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.
|
||||||
73
hod6/README.md
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|

|
||||||
|
# Blinky Mbed OS example
|
||||||
|
|
||||||
|
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/).
|
||||||
|
|
||||||
|
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.
|
||||||
137272
hod6/compile_commands.json
Normal file
116
hod6/main.cpp
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
// main.cpp
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
|
||||||
|
#define TARGET_TX_PIN USBTX
|
||||||
|
#define TARGET_RX_PIN USBRX
|
||||||
|
// #define BAUD_RATE 1843200
|
||||||
|
// #define BAUD_RATE 921600
|
||||||
|
#define BAUD_RATE 460800
|
||||||
|
|
||||||
|
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];
|
||||||
|
|
||||||
|
// Draw a moving “sky + ground” background with optional message
|
||||||
|
void draw_mask(uint32_t mask, int shift, const char *text = nullptr)
|
||||||
|
{
|
||||||
|
const int width = 80; // terminal columns
|
||||||
|
const int height = 24; // terminal rows
|
||||||
|
const int horizon = 16; // sky ends here, ground below
|
||||||
|
|
||||||
|
printf("\033[2J\033[H"); // clear + home
|
||||||
|
|
||||||
|
// draw sky layer (moving clouds)
|
||||||
|
for (int y = 0; y < horizon; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
// Parallax: slower movement at top
|
||||||
|
int move = (shift / 2 + y) % width;
|
||||||
|
char c = ((x + move) % 11 == 0) ? '☁' : ' ';
|
||||||
|
printf("%c", c);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw horizon line
|
||||||
|
for (int i = 0; i < width; i++) printf("-");
|
||||||
|
printf("\r\n");
|
||||||
|
|
||||||
|
// draw ground (grass / terrain)
|
||||||
|
for (int y = horizon + 1; y < height; y++) {
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
int move = (shift * 2 + y) % width;
|
||||||
|
// simple wave pattern for terrain / hill
|
||||||
|
char c;
|
||||||
|
if (((x + move) % 7) == 0)
|
||||||
|
c = '^';
|
||||||
|
else if (((x + move) % 5) == 0)
|
||||||
|
c = '`';
|
||||||
|
else
|
||||||
|
c = ' ';
|
||||||
|
printf("%c", c);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional text overlay at bottom
|
||||||
|
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);
|
||||||
|
|
||||||
|
uint32_t mask = 0xF0F0A55A;
|
||||||
|
int shift = 0;
|
||||||
|
char message[BUFFER_SIZE] = {0};
|
||||||
|
bool message_active = false;
|
||||||
|
Timer msg_timer;
|
||||||
|
Timer anim_timer;
|
||||||
|
msg_timer.start();
|
||||||
|
anim_timer.start();
|
||||||
|
|
||||||
|
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() >= 200ms) {
|
||||||
|
shift = (shift + 1) % 8;
|
||||||
|
anim_timer.reset();
|
||||||
|
|
||||||
|
draw_mask(mask, shift, message_active ? message : nullptr);
|
||||||
|
}
|
||||||
|
ThisThread::sleep_for(20ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
hod6/mbed-os.lib
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
|
||||||
BIN
hod6/resources/official_armmbed_example_badge.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
1
mbed-os-example-blinky/mbed-os
Submodule
8
semestralka1/.clangd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
CompileFlags:
|
||||||
|
Add:
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/arm-none-eabi/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include
|
||||||
|
-isystem
|
||||||
|
/nix/store/ih9psjpxn2pbbzw4klr9s6hmmngc52n8-gcc-arm-embedded-14.3.rel1/lib/gcc/arm-none-eabi/14.3.0/include-fixed
|
||||||
25
semestralka1/.gitignore
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
.build
|
||||||
|
.mbed
|
||||||
|
projectfiles
|
||||||
|
*.py*
|
||||||
|
|
||||||
|
# Local build directories
|
||||||
|
cmake_build/
|
||||||
|
BUILD/
|
||||||
|
mbed-os/
|
||||||
|
.mbed/
|
||||||
|
.mbedignore
|
||||||
|
*.elf
|
||||||
|
*.bin
|
||||||
|
*.hex
|
||||||
|
*.map
|
||||||
|
|
||||||
|
# IDE and temporary files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
__pycache__/
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
compile_commands.json
|
||||||
42
semestralka1/CMakeLists.txt
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.19.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
set(MBED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/mbed-os CACHE INTERNAL "")
|
||||||
|
set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "")
|
||||||
|
set(APP_TARGET mbed-os-example-blinky)
|
||||||
|
|
||||||
|
include(${MBED_PATH}/tools/cmake/app.cmake)
|
||||||
|
|
||||||
|
project(${APP_TARGET})
|
||||||
|
|
||||||
|
add_subdirectory(${MBED_PATH})
|
||||||
|
|
||||||
|
add_executable(${APP_TARGET})
|
||||||
|
|
||||||
|
# Recursively collect all .cpp files under src/
|
||||||
|
file(GLOB_RECURSE SRC_FILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||||
|
|
||||||
|
target_sources(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
${SRC_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make includes of headers work
|
||||||
|
target_include_directories(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${APP_TARGET}
|
||||||
|
PRIVATE
|
||||||
|
mbed-os
|
||||||
|
)
|
||||||
|
|
||||||
|
mbed_set_post_build(${APP_TARGET})
|
||||||
|
|
||||||
|
option(VERBOSE_BUILD "Have a verbose build process")
|
||||||
|
if(VERBOSE_BUILD)
|
||||||
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif()
|
||||||
5
semestralka1/README.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
# Semestralka na VPS
|
||||||
|
|
||||||
|
Tato hra je najsamlepsejsia na celom svete.
|
||||||
|
Iba si treba matchnut baudrate a moze sa gamesit.
|
||||||
|
|
||||||
BIN
semestralka1/chafa/background/background.jpg
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
semestralka1/chafa/background/background_dark.jpg
Normal file
|
After Width: | Height: | Size: 1.6 MiB |
19
semestralka1/chafa/background/background_dark_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
~`````````````````````````````````````````````````````````````````````````````````````"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````
|
||||||
|
...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................
|
||||||
|
..........................."............................................._................................+...........................................................................................................,..............................................`..............................................................!........................
|
||||||
|
.......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....
|
||||||
|
...`......................"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....
|
||||||
|
,,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,
|
||||||
|
,,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''',,,,,,,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@@@@@@gy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@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..
|
||||||
|
..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'"``':,!$FP~:,,,,,~~7@y.~A@mg@'."@F::,,,,,,4ER~,,,,,,,g@@@@@..
|
||||||
|
..:`::':''~F@@@@@....:````:`:,``"FB@P~5@@@$~~3@@L....::``',:``,:::,`g@@@@@@@@.```.:7@@@F:`````````::,:`@Fy@@$@@@F.::`:::`$@@L`````````~%.`$F.B`..`B::::````4PF````````@@@@@@B...,:,,:::``TM@@@@$...:````:,`````7M$@F~@@@@~~"@@@.....:,`',:'`':::,,x@@@@@@@@,....`:@@@@:``````````:::,g@ya@@@@@@.,'`'::`4@@g,```,`````4.."@.$^...4~`::````_RP~```````g@@@@@@L.
|
||||||
|
.,,`,```,,``@@@@@,,.``````````,,4@~,,,"$@@$,,$@@m',..,,,``,,````,``g@@@@@@@@@,'`,..,"Z@F``````````````_a@@@@@@@@'.`,,````~@@F``,````,,,,,,4(``....`'```,,,g@~,,``````g@@@@@@@,,.,,,```,,,`4@@@@~,.,```````'`,,`B$,,,,$gZ$r,:@@@',...,,,``,````,``:@@@@$@@@@@.',...`~@@```````````````D$@@@@@@@E,``:`````@@R``,````,,,,,,`R'['.,..,````,,`@B,,``````g@@@@@@@L,
|
||||||
|
.',,,,,,,,,,4@@@E,,,,,,,,,,,,,,,,@,,,,,5@@@,,$@@@,,..,,,,,,,,,,,,,,@@@@@@@@@@@,,,..`,,@F,,,,,,,,,,,,,,@@@@@@@@@@,,',,,,,,,~,,,,,,,,,,,,,,,,L,..,,.':,,,,,y@~,,,,,,,,g@@@@@@@@,,.',,,,,,,,,,@@@@,,.:,,,,,,,,,,,,$F,,,,"@@@F,d@@@,,,..,,,,,,,,,,,,,d@@@@@@@@@@L,,,..,,4@,,,,,,,,,,,,,,g@@@@@@@@@F,,',,,,,,~^,,,,,,,,,,,,,,,T,...,..,,,,,,,$E,,,,,,,,y@@@@@@@@$,
|
||||||
19
semestralka1/chafa/background/background_inverted.txt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
......................````````````````````................................`````````````````````.....................................................................................................````````````````````...............................`````````````````````.................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
......................................................................................`..................................................'..........................................................................................................................`..................................................'.....................................
|
||||||
|
.............................................................................................................................................................................................................................................................................................................................................................
|
||||||
|
........................................................................................................................................................................................................................................................`....................................................................................................
|
||||||
|
........................'''`'''''``............'`'''''......._,_yr,..._,,........................................................................_,,,,................................................'''`'''''``............'`'''''......,_,yy+,..._,,........................................................................_,,,,.........................
|
||||||
|
..................```.......................................```~~``^?~"``::.,,,,,,,,,,,::::````'````..........``'''...`......,,,,,,,:,,:,,,,..,,:~````:,,,............,,,,......................```.......................................``"~~``^?~```:..,,,,,,,,,,,:::'`````````..........````'...`......,,,,,,::,,:,,,,..,,:~```',,,,............,,,,.....
|
||||||
|
.''``''`....`..............................................................._..`````.......................................```````'`````````''`````````..............``````````'''`''`....`..............................................................._..`````.......................................````'``'`````````''`````````..............`````````'
|
||||||
|
._.............................____yyyyyyyagggggggggggggggggggggga_..........~Th=ay__.............._____yyyyyyyyyyyyyyyyy___...+_.........................agyy_yyyyyyyyyyyyyyy_,.............................____yyyyyyyagggggggggggggggggggggga,..........~T=*wy_,.............,_____yyyyyyyyyyyyyyyy____..:._.........................agyy_yyyyyyyyyyyyyyy_
|
||||||
|
.@@$gyy_,.....__yyyyyaggg$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@@@@$gyy_,.....__yyyyyagg$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$$$$aaaaaa@@@$gga$$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$gZgyy_________yyyyyyyag$@@@@@@@@@@@@@@@@@@@@@@$
|
||||||
|
.@@@@@@@@@$g@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@$
|
||||||
|
.@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@B@@@@@@@@@@@@@@@@$@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M@$@@@@@B0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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RRRRRRRR4RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRF
|
||||||
4
semestralka1/chafa/chafa_commands.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
nix-shell -p imagemagick
|
||||||
|
identify background.jpg
|
||||||
|
chafa --symbols ascii --fill none --size=6912x793 background.jpg > out.txt
|
||||||
|
chafa --symbols ascii-block -c none --fill none --invert --size=349x40 background_dark.jpg > background_dark_inverted.txt
|
||||||
7
semestralka1/chafa/character/2out.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.....a@$..
|
||||||
|
.....7PF..
|
||||||
|
..yaM@@__y
|
||||||
|
..@.y@FFF~
|
||||||
|
..._$M@_..
|
||||||
|
yaa@~.`@y.
|
||||||
|
........@r
|
||||||
7
semestralka1/chafa/character/3out.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.g@$
|
||||||
|
.7PF
|
||||||
|
y@$.
|
||||||
|
0@F.
|
||||||
|
4@$.
|
||||||
|
y$@.
|
||||||
|
u@..
|
||||||
9
semestralka1/chafa/character/out.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
......_g@$w..
|
||||||
|
......4@@@F..
|
||||||
|
.....yyyy`...
|
||||||
|
...g@~@@@y_ys
|
||||||
|
..4F..@@FTF~.
|
||||||
|
.....g@@g,...
|
||||||
|
..._a@^.4@_..
|
||||||
|
4R@F~....7@y.
|
||||||
|
..........~@.
|
||||||
4
semestralka1/chafa/character/out_crawl1.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
.._$@.
|
||||||
|
.$By`.
|
||||||
|
4@$@@a
|
||||||
|
aa@W@.
|
||||||
3
semestralka1/chafa/character/out_crawl2.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
a@@Bw_,
|
||||||
|
7@@Db@$
|
||||||
|
4@@PF#@
|
||||||
BIN
semestralka1/chafa/character/predloha.jpg
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
semestralka1/chafa/character/predloha2.jpg
Normal file
|
After Width: | Height: | Size: 30 KiB |
BIN
semestralka1/chafa/character/predloha2_scaled.xcf
Normal file
BIN
semestralka1/chafa/character/predloha_crawl1.jpg
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
semestralka1/chafa/character/predloha_crawl2.jpg
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
semestralka1/chafa/character/predloha_run_a.jpg
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
semestralka1/chafa/character/predloha_run_b.jpg
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
4
semestralka1/chafa/character/run_chafa.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
chafa --symbols ascii-block -c none --fill none --invert --size=13x20 predloha_run_a.jpg > out.txt
|
||||||
|
|
||||||
|
a = 78x111
|
||||||
|
b = 34x111
|
||||||
1
semestralka1/mbed-os.lib
Normal file
@@ -0,0 +1 @@
|
|||||||
|
https://github.com/ARMmbed/mbed-os/#17dc3dc2e6e2817a8bd3df62f38583319f0e4fed
|
||||||
BIN
semestralka1/resources/official_armmbed_example_badge.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
22
semestralka1/src/background_dark_inverted.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// background_dark_inverted.h
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
static const char *BACKGROUND_MASK[] = {
|
||||||
|
"~`````````````````````````````````````````````````````````````````````````````````````\"````````````````````````````````~```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````+````````````````````~````````````````````````````````~```````````````````````````````````````````````````````",
|
||||||
|
"...................................................................,.......................:..........................................'.........`..:.....................................................................................................+...................................:...........:..,................................................",
|
||||||
|
"...........................\"............................................._................................+...........................................................................................................,..............................................`..............................................................!........................",
|
||||||
|
".......`...............!..:..............................................`,...,,,'........_.....................''::.....:........................^......................,,...........................................':.......'........................,....,,,.......................+...,...'::'.............................^......................,,....",
|
||||||
|
"...`......................\"...........`.....`...................._,....:,::::^.`::::::........'''``....`....y..^............-...........................................:'.....................,........\".....................................:_......,,:::..`'`::::.........'''`..........+....+........,............................................,:`....",
|
||||||
|
",,,,,,,,,,,`,,,,,,,^,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,`a',,,,,,',.+,,,''''`.........,,'?'!#R,,,,,,,,,,,,,y,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,__,,,_',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,y'`,,,,,'.,,,,,,.'''`........,,''^,s@^,,,,,,,,,,,,_;,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,_,,,_,`,,,,,,",
|
||||||
|
",,,,,,,,,,^,,,,,,','''':,,,,,,,,,,,,,,,,,,,,,,''',,,,,,,,,,+,,,,,,,,,:'!^'`,,``..'.'''`,,,,,,,yy_,_yaF,,.'`'',,,,,ym$###$@M@,,,,,;,,,,,,,,,,,,,,,,,,,,,''''':,y,,,7#@@~,,,,,,,,,,,,,,,,,~,,,,,,,::'''::,~,,,,,,,,,,,,,,,,,,,'''',,,,,,,,,,,,,,,,,,,::'~''`,```..``''',,,,,,,yy___ygR^,.,`'`,,,,,,wa###$@R@:,,,,,,,,,,,,,,,,,,,,,,,,,,'''''',,X,,~T@@R,,,,,,,,",
|
||||||
|
"@@@@@@@@@@@@@@$~`,'________~TF?5#@@@@@@@``4@@E,,,4@@@@@@@@@@@@@#MT~yg$^$P_____..,...:_________@@______;'...'.?@@@@@@@@@@@@@@@@@@@@@@@@@@@MR@@@@@@@@@@B,,,,,,,4@@@@@@@@@@@@@@@@@@@@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,yyyx,,,,,,,ggg_......,,::::::@@@@@@$....:,,,,,,,,,@@:_$@@@@yg$g$ggg@@~`::::,,,,,,,,,,,yyyyyy_,yygg$@@@@@@@@F5aagggggyyw,:d@P@@@@L.`5r,,,:@@@@UL`:::,N@@gy.:@@F.>~5F~,,,,,,,,,,,yyy,,,,,,,,ggy...",
|
||||||
|
"...,,,,,,,,4@@@$g@....,7^=sa@@$a@@@@@@@@@@@@@@@@@@~``.`,,,,,,,,:::`,g@R@BZa$TTTTF5PM@@@@^:`'`~T5#@@y_`,u@~$@$@@g_,F,,,,`@@@@'':^na$g@@@=_:@@.`,.4__,,,,,,,,,g@@K:,,,,,,g@@@@w....,,,,,,,,,$@@$g@F...,,^=#aa@$gg@@@@@@@@@@@@@@@@@F``.`,,,,,,,,,::`,:@@P@R5$T~TTFFPP5@@@$:'``~~7P@@y_``,$E4@W@$@y,4::,,`3@@@[`:,raagg@@Fk`@@L.,.`g_,,,,,,,,,,g@@~:,,,,,,g@@@$..",
|
||||||
|
"..,:''``a$gg@$@@ZF...:,,,,,,:`~T@@@@@@@@@@@@@A@@^``...:,,,,,`,,::,.,@@@@@@@@,`.`````@@@[',,,,,,,,,,`TR@@@@@@@$@@@`'''':,A@MP.,,,,,\"~TT@,`3@@*g'.`4@':,,,,,,:EDT,,,,,,,_@@@@@$....:':':H$$g@$@@$@....,,,,,`:`~7R@@@@@@@@@@@@AR@@```..,',,,'``,,::,,d@0@@@@@y`.`````g@@@`',,,,,,,,,:79@$@@@@@@@@@'\"``':,!$FP~:,,,,,~~7@y.~A@mg@'.\"@F::,,,,,,4ER~,,,,,,,g@@@@@..",
|
||||||
|
};
|
||||||
|
static const int VIEW_HEIGHT = sizeof(BACKGROUND_MASK) / sizeof(BACKGROUND_MASK[0]);
|
||||||
26
semestralka1/src/main.cpp
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// main.cpp
|
||||||
|
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "background_dark_inverted.h"
|
||||||
|
#include "render/loop.h"
|
||||||
|
|
||||||
|
#define TARGET_TX_PIN USBTX
|
||||||
|
#define TARGET_RX_PIN USBRX
|
||||||
|
#define BAUD_RATE 460800
|
||||||
|
|
||||||
|
BufferedSerial serial_port(TARGET_TX_PIN, TARGET_RX_PIN, BAUD_RATE);
|
||||||
|
|
||||||
|
FileHandle *mbed::mbed_override_console(int fd)
|
||||||
|
{
|
||||||
|
return &serial_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
DigitalOut led(LED1);
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
serial_port.set_format(8, BufferedSerial::None, 1);
|
||||||
|
printf("Baud: %d, Format: 8-N-1\r\n", BAUD_RATE);
|
||||||
|
|
||||||
|
// Just call into render feature
|
||||||
|
render_loop(4);
|
||||||
|
}
|
||||||
35
semestralka1/src/render/background.cpp
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
// src/render/background.cpp
|
||||||
|
|
||||||
|
#include "../background_dark_inverted.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text) {
|
||||||
|
const int view_width = 90;
|
||||||
|
const int view_height = 16;
|
||||||
|
|
||||||
|
// Terminal clear + home
|
||||||
|
printf("\033[2J\033[H");
|
||||||
|
|
||||||
|
for (int i = 0; i < view_height && i < VIEW_HEIGHT; i++) {
|
||||||
|
const char *row = BACKGROUND_MASK[i];
|
||||||
|
int width = strlen(row);
|
||||||
|
if (width == 0) {
|
||||||
|
printf("\r\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int start = shift % width;
|
||||||
|
|
||||||
|
for (int j = 0; j < view_width; j++) {
|
||||||
|
printf("%c", row[(start + j) % width]);
|
||||||
|
}
|
||||||
|
printf("\r\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (text && text[0] != '\0') {
|
||||||
|
printf("\r\n[RX] %s\r\n", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
6
semestralka1/src/render/background.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// src/render/background.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Draws the ASCII art background with optional message
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text = nullptr);
|
||||||
175
semestralka1/src/render/loop.cpp
Normal file
@@ -0,0 +1,175 @@
|
|||||||
|
// src/render/loop.cpp
|
||||||
|
#include "loop.h"
|
||||||
|
#include "../background_dark_inverted.h"
|
||||||
|
#include "player_positioning.h"
|
||||||
|
#include "background.h"
|
||||||
|
#include "mbed.h"
|
||||||
|
#include "player.h"
|
||||||
|
#include "player_mask.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
extern BufferedSerial serial_port;
|
||||||
|
extern DigitalOut led;
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
constexpr size_t BUFFER_SIZE = 64;
|
||||||
|
constexpr auto CRAWL_DURATION = 300ms;
|
||||||
|
constexpr auto ANIMATION_TICK = 170ms;
|
||||||
|
constexpr auto MESSAGE_DISPLAY_DURATION = 1s;
|
||||||
|
constexpr int PLAYER_X = 9;
|
||||||
|
constexpr int PLAYER_Y = 6;
|
||||||
|
|
||||||
|
// PlayerState is what user pressed. We are mapping CharacterState to it
|
||||||
|
enum class PlayerState { Walk1, Walk2, Crawl1 };
|
||||||
|
|
||||||
|
struct WalkingState {
|
||||||
|
PlayerState current_state = PlayerState::Walk1;
|
||||||
|
Timer state_timer;
|
||||||
|
};
|
||||||
|
|
||||||
|
static char rx_buffer[BUFFER_SIZE];
|
||||||
|
static char message[BUFFER_SIZE];
|
||||||
|
static bool message_active = false;
|
||||||
|
|
||||||
|
void draw_mask(const char *unused_filename, int shift, const char *text);
|
||||||
|
|
||||||
|
// Returns:
|
||||||
|
// 0 = no change - walk1
|
||||||
|
// 1 = normal redraw - walk2
|
||||||
|
// 2 = button triggered - crawl1
|
||||||
|
static int read_uart() {
|
||||||
|
bool changed = false;
|
||||||
|
bool triggered = false;
|
||||||
|
|
||||||
|
// cita spravu z uartu
|
||||||
|
if (serial_port.readable()) {
|
||||||
|
memset(rx_buffer, 0, sizeof(rx_buffer));
|
||||||
|
ssize_t num = serial_port.read(rx_buffer, sizeof(rx_buffer) - 1);
|
||||||
|
if (num > 0) {
|
||||||
|
led = !led; // toogle ledky
|
||||||
|
strncpy(message, rx_buffer, sizeof(message) - 1);
|
||||||
|
message_active = true;
|
||||||
|
changed = true;
|
||||||
|
triggered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// casovac na 1s zobrazenia spravy
|
||||||
|
static Timer msg_timer;
|
||||||
|
static bool timer_started = false;
|
||||||
|
if (!timer_started) {
|
||||||
|
msg_timer.start();
|
||||||
|
timer_started = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// po jednu sekundu sa sprava zobrazi
|
||||||
|
if (message_active && msg_timer.elapsed_time() > MESSAGE_DISPLAY_DURATION) {
|
||||||
|
message_active = false;
|
||||||
|
memset(message, 0, sizeof(message));
|
||||||
|
msg_timer.reset();
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (triggered)
|
||||||
|
return 2; // LED toggled press
|
||||||
|
if (changed)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool update_animation(Timer &anim_timer, int &shift, int speed) {
|
||||||
|
if (anim_timer.elapsed_time() >= ANIMATION_TICK) {
|
||||||
|
// speed determines scroll steps per tick
|
||||||
|
shift += speed;
|
||||||
|
anim_timer.reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CharacterFrame get_character_frame(PlayerState state) {
|
||||||
|
switch (state) {
|
||||||
|
case PlayerState::Walk1:
|
||||||
|
return CharacterFrame::Walk1;
|
||||||
|
case PlayerState::Walk2:
|
||||||
|
return CharacterFrame::Walk2;
|
||||||
|
case PlayerState::Crawl1:
|
||||||
|
return CharacterFrame::Crawl1;
|
||||||
|
default:
|
||||||
|
return CharacterFrame::Walk1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void update_player_state(WalkingState &state) {
|
||||||
|
// stop crawling
|
||||||
|
if (state.current_state == PlayerState::Crawl1 &&
|
||||||
|
state.state_timer.elapsed_time() >= CRAWL_DURATION) {
|
||||||
|
state.current_state = PlayerState::Walk1;
|
||||||
|
state.state_timer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void toggle_walk_frame(WalkingState &state) {
|
||||||
|
if (state.current_state == PlayerState::Walk1) {
|
||||||
|
state.current_state = PlayerState::Walk2;
|
||||||
|
} else if (state.current_state == PlayerState::Walk2) {
|
||||||
|
state.current_state = PlayerState::Walk1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void start_crawl(WalkingState &state) {
|
||||||
|
state.current_state = PlayerState::Crawl1;
|
||||||
|
state.state_timer.reset();
|
||||||
|
state.state_timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void render_loop(int speed) {
|
||||||
|
WalkingState player_state;
|
||||||
|
|
||||||
|
Timer anim_timer;
|
||||||
|
anim_timer.start();
|
||||||
|
int shift = 0;
|
||||||
|
|
||||||
|
CharacterPosition pos = {PLAYER_X, PLAYER_Y};
|
||||||
|
|
||||||
|
const char *bg_file = "background_dark_inverted.txt";
|
||||||
|
bool need_redraw = false;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
need_redraw = false;
|
||||||
|
int uart_state = read_uart(); // returns 0/1/2
|
||||||
|
|
||||||
|
if (uart_state == 1) {
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uart_state == 2) {
|
||||||
|
// start crawl frame for x time
|
||||||
|
start_crawl(player_state);
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if crawl duration expired
|
||||||
|
update_player_state(player_state);
|
||||||
|
|
||||||
|
if (update_animation(anim_timer, shift, speed)) {
|
||||||
|
need_redraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (need_redraw) {
|
||||||
|
draw_mask(bg_file, shift, message_active ? message : nullptr);
|
||||||
|
CharacterFrame player_frame = get_character_frame(player_state.current_state);
|
||||||
|
CharacterPosition draw_pos = get_aligned_frame_position(pos, player_frame);
|
||||||
|
draw_character(draw_pos.x, draw_pos.y, player_frame);
|
||||||
|
|
||||||
|
// alternate between frame 0 and 1 when not crawling
|
||||||
|
if (player_state.current_state != PlayerState::Crawl1) {
|
||||||
|
toggle_walk_frame(player_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThisThread::sleep_for(50ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
ThisThread::sleep_for(25ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
6
semestralka1/src/render/loop.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// src/render/loop.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Runs the render loop: reads UART, animates, and draws output
|
||||||
|
void render_loop(int speed);
|
||||||
33
semestralka1/src/render/player.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// src/render/player.cpp
|
||||||
|
#include "player.h"
|
||||||
|
#include "player_mask.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
void draw_character(int x, int y, CharacterFrame frame) {
|
||||||
|
int frame_index = static_cast<int>(frame);
|
||||||
|
if (frame_index < 0 || frame_index >= CHARACTER_FRAME_COUNT)
|
||||||
|
frame_index = 0; // fallback safety
|
||||||
|
|
||||||
|
const char **character = PLAYER_FRAMES[frame_index];
|
||||||
|
|
||||||
|
int character_height = 0;
|
||||||
|
switch (frame) {
|
||||||
|
case CharacterFrame::Walk1:
|
||||||
|
character_height = CHARACTER_HEIGHT_1;
|
||||||
|
break;
|
||||||
|
case CharacterFrame::Walk2:
|
||||||
|
character_height = CHARACTER_HEIGHT_2;
|
||||||
|
break;
|
||||||
|
case CharacterFrame::Crawl1:
|
||||||
|
character_height = CHARACTER_HEIGHT_3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
character_height = CHARACTER_HEIGHT_1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < character_height; i++) {
|
||||||
|
printf("\033[%d;%dH%s", y + i + 1, x + 1, character[i]);
|
||||||
|
}
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
6
semestralka1/src/render/player.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// src/render/player.h
|
||||||
|
#pragma once
|
||||||
|
#include "player_mask.h"
|
||||||
|
|
||||||
|
// Draw the player object starting at given (x, y)
|
||||||
|
void draw_character(int x, int y, CharacterFrame frame);
|
||||||
54
semestralka1/src/render/player_mask.h
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
// src/render/player_mask.h
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Player frame 1
|
||||||
|
static const char *CHARACTER_MASK_FRAME_1[] = {
|
||||||
|
".....a@$..",
|
||||||
|
".....7PF..",
|
||||||
|
"..yaM@@__y",
|
||||||
|
"..@.y@FFF~",
|
||||||
|
"..._$M@_..",
|
||||||
|
"yaa@~.`@y.",
|
||||||
|
"........@r"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Player frame 2
|
||||||
|
static const char *CHARACTER_MASK_FRAME_2[] = {
|
||||||
|
".g@$",
|
||||||
|
".7PF",
|
||||||
|
"y@$.",
|
||||||
|
"0@F.",
|
||||||
|
"4@$.",
|
||||||
|
"y$@.",
|
||||||
|
"u@.."
|
||||||
|
};
|
||||||
|
|
||||||
|
// Player frame 3 (triggered)
|
||||||
|
static const char *CHARACTER_MASK_FRAME_3[] = {
|
||||||
|
".._$@.",
|
||||||
|
".$By`.",
|
||||||
|
"4@$@@a",
|
||||||
|
"aa@W@."
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CharacterFrame {
|
||||||
|
Walk1 = 0,
|
||||||
|
Walk2,
|
||||||
|
Crawl1,
|
||||||
|
COUNT // number of frames, must stay last
|
||||||
|
};
|
||||||
|
|
||||||
|
// Combine frames for easy access
|
||||||
|
static const char **PLAYER_FRAMES[] = {
|
||||||
|
CHARACTER_MASK_FRAME_1, // Walk1
|
||||||
|
CHARACTER_MASK_FRAME_2, // Walk1
|
||||||
|
CHARACTER_MASK_FRAME_3 // Crawl1
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int CHARACTER_FRAME_COUNT = static_cast<int>(CharacterFrame::COUNT);
|
||||||
|
|
||||||
|
// Height per frame
|
||||||
|
static const int CHARACTER_HEIGHT_1 = sizeof(CHARACTER_MASK_FRAME_1) / sizeof(CHARACTER_MASK_FRAME_1[0]);
|
||||||
|
static const int CHARACTER_HEIGHT_2 = sizeof(CHARACTER_MASK_FRAME_2) / sizeof(CHARACTER_MASK_FRAME_2[0]);
|
||||||
|
static const int CHARACTER_HEIGHT_3 = sizeof(CHARACTER_MASK_FRAME_3) / sizeof(CHARACTER_MASK_FRAME_3[0]);
|
||||||
25
semestralka1/src/render/player_positioning.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// src/render/player_positioning.cpp
|
||||||
|
#include "player_positioning.h"
|
||||||
|
#include "../background_dark_inverted.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
|
// Convert a pivot coordinate (bottom-left) to the top-left draw position
|
||||||
|
CharacterPosition get_aligned_frame_position(CharacterPosition base, CharacterFrame frame) {
|
||||||
|
int frame_index = static_cast<int>(frame);
|
||||||
|
if (frame_index < 0 || frame_index >= CHARACTER_FRAME_COUNT)
|
||||||
|
frame_index = 0;
|
||||||
|
|
||||||
|
int character_height = 0;
|
||||||
|
if (frame_index == 0)
|
||||||
|
character_height = CHARACTER_HEIGHT_1;
|
||||||
|
else if (frame_index == 1)
|
||||||
|
character_height = CHARACTER_HEIGHT_2;
|
||||||
|
else
|
||||||
|
character_height = CHARACTER_HEIGHT_3;
|
||||||
|
|
||||||
|
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 "../background_dark_inverted.h"
|
||||||
|
#include "player_mask.h"
|
||||||
|
|
||||||
|
struct CharacterPosition {
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Calculates drawing position relative to bottom-left pivot
|
||||||
|
CharacterPosition get_aligned_frame_position(CharacterPosition base, CharacterFrame frame);
|
||||||