diff --git a/Main/.gitignore b/Lolin/.gitignore similarity index 100% rename from Main/.gitignore rename to Lolin/.gitignore diff --git a/Main/.vscode/extensions.json b/Lolin/.vscode/extensions.json similarity index 100% rename from Main/.vscode/extensions.json rename to Lolin/.vscode/extensions.json diff --git a/Main/.vscode/settings.json b/Lolin/.vscode/settings.json similarity index 100% rename from Main/.vscode/settings.json rename to Lolin/.vscode/settings.json diff --git a/Main/include/README b/Lolin/include/README similarity index 100% rename from Main/include/README rename to Lolin/include/README diff --git a/Main/include/button.h b/Lolin/include/button.h similarity index 100% rename from Main/include/button.h rename to Lolin/include/button.h diff --git a/Main/include/gps.h b/Lolin/include/gps.h similarity index 100% rename from Main/include/gps.h rename to Lolin/include/gps.h diff --git a/Main/include/interrupts.h b/Lolin/include/interrupts.h similarity index 100% rename from Main/include/interrupts.h rename to Lolin/include/interrupts.h diff --git a/Main/include/led.h b/Lolin/include/led.h similarity index 100% rename from Main/include/led.h rename to Lolin/include/led.h diff --git a/Main/include/utilities.h b/Lolin/include/utilities.h similarity index 100% rename from Main/include/utilities.h rename to Lolin/include/utilities.h diff --git a/Main/lib/README b/Lolin/lib/README similarity index 100% rename from Main/lib/README rename to Lolin/lib/README diff --git a/Main/platformio.ini b/Lolin/platformio.ini similarity index 100% rename from Main/platformio.ini rename to Lolin/platformio.ini diff --git a/Main/src/button.cpp b/Lolin/src/button.cpp similarity index 100% rename from Main/src/button.cpp rename to Lolin/src/button.cpp diff --git a/Main/src/gps.cpp b/Lolin/src/gps.cpp similarity index 100% rename from Main/src/gps.cpp rename to Lolin/src/gps.cpp diff --git a/Main/src/interrupts.cpp b/Lolin/src/interrupts.cpp similarity index 100% rename from Main/src/interrupts.cpp rename to Lolin/src/interrupts.cpp diff --git a/Main/src/led.cpp b/Lolin/src/led.cpp similarity index 100% rename from Main/src/led.cpp rename to Lolin/src/led.cpp diff --git a/Main/src/main.cpp b/Lolin/src/main.cpp similarity index 100% rename from Main/src/main.cpp rename to Lolin/src/main.cpp diff --git a/Main/test/README b/Lolin/test/README similarity index 100% rename from Main/test/README rename to Lolin/test/README diff --git a/projects/LoRa_Transmitter/.gitignore b/T-beam/.gitignore similarity index 100% rename from projects/LoRa_Transmitter/.gitignore rename to T-beam/.gitignore diff --git a/projects/LoRa_Transmitter/.vscode/extensions.json b/T-beam/.vscode/extensions.json similarity index 100% rename from projects/LoRa_Transmitter/.vscode/extensions.json rename to T-beam/.vscode/extensions.json diff --git a/projects/Main/include/bmp.hpp b/T-beam/include/bmp.h similarity index 62% rename from projects/Main/include/bmp.hpp rename to T-beam/include/bmp.h index e46d9ae..162ff0a 100644 --- a/projects/Main/include/bmp.hpp +++ b/T-beam/include/bmp.h @@ -1,7 +1,6 @@ -#pragma once namespace bmp { // wymaga ustawienia Wire.begin(SDA_PIN, SCL_PIN) wcześniej -void begin(); +void init(); struct Data { float temperature; @@ -11,6 +10,10 @@ struct Data { float get_as_hpa(); }; +inline Data data; + +void get_bmp(void* pvParameters); +void print_data(void* pvParameters); Data measurements(); -void pretty_print(); +void pretty_print(Data); } // namespace bmp \ No newline at end of file diff --git a/T-beam/include/constants.h b/T-beam/include/constants.h new file mode 100644 index 0000000..6d00461 --- /dev/null +++ b/T-beam/include/constants.h @@ -0,0 +1,4 @@ +#define SDA 21 +#define SCL 22 +#define BAUD_RATE 115200 +#define DEFAULT_TASK_SIZE 10000 \ No newline at end of file diff --git a/projects/T-beam/include/gps.h b/T-beam/include/gps.h similarity index 100% rename from projects/T-beam/include/gps.h rename to T-beam/include/gps.h diff --git a/projects/Main/include/led.h b/T-beam/include/led.h similarity index 100% rename from projects/Main/include/led.h rename to T-beam/include/led.h diff --git a/T-beam/include/memory.h b/T-beam/include/memory.h new file mode 100644 index 0000000..b0d7c7c --- /dev/null +++ b/T-beam/include/memory.h @@ -0,0 +1,20 @@ +#include + +#define MEMORY_SIZE 512 + +namespace memory { + +struct Config { + int intValue; + float floatValue; + char stringValue[50]; +}; + +inline Config config; + +void init(); +void save_config(Config&); +void load_config(Config&); +void print_data(); + +} // namespace memory diff --git a/projects/Main/platformio.ini b/T-beam/platformio.ini similarity index 92% rename from projects/Main/platformio.ini rename to T-beam/platformio.ini index 435be1c..e0a7770 100644 --- a/projects/Main/platformio.ini +++ b/T-beam/platformio.ini @@ -8,9 +8,10 @@ ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html -[env:lolin32_lite] +[env:ttgo-t-beam] platform = espressif32 -board = lolin32_lite +board = ttgo-t-beam framework = arduino monitor_speed = 115200 lib_deps = adafruit/Adafruit BMP280 Library@^2.6.8 + diff --git a/projects/Main/src/bmp.cpp b/T-beam/src/bmp.cpp similarity index 54% rename from projects/Main/src/bmp.cpp rename to T-beam/src/bmp.cpp index 491f2aa..a023fb7 100644 --- a/projects/Main/src/bmp.cpp +++ b/T-beam/src/bmp.cpp @@ -1,21 +1,21 @@ -#include "bmp.hpp" +#include "bmp.h" -// korzystanie z Adafruit BMP280 Library by Adafruit #include #include -// ciśnienie powietrza na poziomie morza w hPa, altitude -// 1013.25 jest ogólną średnią -// 1019.91 jest wartością lokalną dla Krakowa w momencie pisania tego +// 1019.91 is avg Pressure in Cracow #define SEALEVELPRESSURE_HPA (1019.91) - -Adafruit_BMP280 bmp_obj; +#define CHIP_BME 0x60 +#define CHIP_BMP 0x58 +#define CHIP_ADDR 0x76 namespace bmp { -// wymaga ustawienia Wire.begin(SDA_PIN, SCL_PIN) wcześniej -void begin() { - if (!bmp_obj.begin(0x76)) { +Adafruit_BMP280 bmp_obj; + +// Requires Wire.begin(SDA_PIN, SCL_PIN) +void init() { + if (!bmp_obj.begin(CHIP_ADDR, CHIP_BME)) { Serial.println("Viable sensor BMP280 not found, check wiring!"); while (1); } @@ -23,27 +23,36 @@ void begin() { Data measurements() { Data check; - // temperatura w Celsjuszach check.temperature = bmp_obj.readTemperature(); - // Ciśnienie w paskalach check.pressure = bmp_obj.readPressure(); - // przybliżona wysokość nad poziomem morza w metrach check.altitude = bmp_obj.readAltitude(SEALEVELPRESSURE_HPA); return check; }; -void pretty_print() { - Data exp = measurements(); +void get_bmp(void* pvParameters) { + for (;;) { + data = measurements(); + vTaskDelay(pdMS_TO_TICKS(500)); + } +} +void print_data(void* pvParameters) { + for (;;) { + pretty_print(data); + vTaskDelay(pdMS_TO_TICKS(500)); + } +} + +void pretty_print(Data data) { Serial.print("Temperature = "); - Serial.print(exp.temperature); + Serial.print(data.temperature); Serial.println(" *C"); Serial.print("Pressure = "); - Serial.print(exp.get_as_hpa()); + Serial.print(data.get_as_hpa()); Serial.println(" hPa"); Serial.print("Approx. Altitude = "); - Serial.print(exp.altitude); + Serial.print(data.altitude); Serial.println(" m"); Serial.println(); diff --git a/projects/T-beam/src/gps.cpp b/T-beam/src/gps.cpp similarity index 59% rename from projects/T-beam/src/gps.cpp rename to T-beam/src/gps.cpp index 1f1f740..1eecf29 100644 --- a/projects/T-beam/src/gps.cpp +++ b/T-beam/src/gps.cpp @@ -9,17 +9,18 @@ void init() { GPSSerial.begin(9600, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN); } void gps_loop(void* pvParameters) { String nmea = ""; for (;;) { - if (GPSSerial.available()) { + while (GPSSerial.available()) { char c = GPSSerial.read(); nmea += c; - } else { - if (nmea != "") { - Serial.println(nmea); - nmea = ""; - } else - Serial.println("------------"); - vTaskDelay(pdMS_TO_TICKS(100)); } + + if (nmea != "") { + Serial.println(nmea); + nmea = ""; + } else + Serial.println("------------"); + vTaskDelay(pdMS_TO_TICKS(900)); + } } diff --git a/projects/T-beam/src/led.cpp b/T-beam/src/led.cpp similarity index 100% rename from projects/T-beam/src/led.cpp rename to T-beam/src/led.cpp diff --git a/T-beam/src/main.cpp b/T-beam/src/main.cpp new file mode 100644 index 0000000..d02c534 --- /dev/null +++ b/T-beam/src/main.cpp @@ -0,0 +1,29 @@ +#include +#include + +#include "bmp.h" +#include "constants.h" +#include "gps.h" +#include "led.h" +#include "memory.h" + +void setup() { + Wire.begin(SDA, SCL); + Serial.begin(BAUD_RATE); + Serial.println("--- ROCKET COMPUTER START ---"); + + memory::init(); // loads config as well + gps::init(); + bmp::init(); + + // xTaskCreate(gps::gps_loop, "gps", DEFAULT_TASK_SIZE, NULL, 1, NULL); + xTaskCreate(led::blink_task, "blink", DEFAULT_TASK_SIZE, NULL, 1, NULL); + xTaskCreate(bmp::get_bmp, "bmp", DEFAULT_TASK_SIZE, NULL, 1, NULL); + xTaskCreate(bmp::print_data, "bmp print", DEFAULT_TASK_SIZE, NULL, 1, NULL); + + memory::print_data(); + memory::config = memory::Config{222, 456.78, "Hello, EEPROM2!"}; + memory::save_config(memory::config); +} + +void loop() {} diff --git a/T-beam/src/memory.cpp b/T-beam/src/memory.cpp new file mode 100644 index 0000000..1f798d1 --- /dev/null +++ b/T-beam/src/memory.cpp @@ -0,0 +1,26 @@ +#include "memory.h" + +#define CONFIG_ADDR 0 + +namespace memory { + +void init() { + EEPROM.begin(MEMORY_SIZE); + load_config(config); +} + +void save_config(Config& data) { + EEPROM.put(CONFIG_ADDR, data); + EEPROM.commit(); +} +void load_config(Config& data) { EEPROM.get(CONFIG_ADDR, data); } + +void print_data() { + Serial.print("Read int: "); + Serial.println(config.intValue); + Serial.print("Read float: "); + Serial.println(config.floatValue); + Serial.print("Read string: "); + Serial.println(config.stringValue); +} +} // namespace memory \ No newline at end of file diff --git a/projects/LoRa_Transmitter/test/README b/T-beam/test/README similarity index 100% rename from projects/LoRa_Transmitter/test/README rename to T-beam/test/README diff --git a/projects/LoRa_Transmitter/.vscode/settings.json b/projects/LoRa_Transmitter/.vscode/settings.json deleted file mode 100644 index aafc77c..0000000 --- a/projects/LoRa_Transmitter/.vscode/settings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "editor.tabSize": 2, - "files.exclude": { - "**/.git": true, - }, - "editor.wordWrap": "on", - // C++ formatter settings - "[cpp]": { - "editor.defaultFormatter": "ms-vscode.cpptools", // Use the C/C++ extension as the default formatter - "editor.formatOnSave": true // Automatically format C++ files when saving - }, - "C_Cpp.clang_format_style": "file", // Use the .clang-format file in your project (if present) or default style - "C_Cpp.clang_format_fallbackStyle": "Google", // Fallback style if .clang-format file is not found - "editor.formatOnSave": true // Automatically format code when saving - } \ No newline at end of file diff --git a/projects/LoRa_Transmitter/include/LoRa.hpp b/projects/LoRa_Transmitter/include/LoRa.hpp deleted file mode 100644 index ffc5fce..0000000 --- a/projects/LoRa_Transmitter/include/LoRa.hpp +++ /dev/null @@ -1,15 +0,0 @@ - -#ifndef LORA_HPP -#define LORA_HPP - -#include - -namespace Lora { -extern HardwareSerial LoRaWioE5; - -void init(); -void send(String wiadomosc); - -} // namespace Lora - -#endif diff --git a/projects/LoRa_Transmitter/include/README b/projects/LoRa_Transmitter/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/projects/LoRa_Transmitter/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/projects/LoRa_Transmitter/lib/README b/projects/LoRa_Transmitter/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/projects/LoRa_Transmitter/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/projects/LoRa_Transmitter/platformio.ini b/projects/LoRa_Transmitter/platformio.ini deleted file mode 100644 index 3c944c8..0000000 --- a/projects/LoRa_Transmitter/platformio.ini +++ /dev/null @@ -1,14 +0,0 @@ -; PlatformIO Project Configuration File -;; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:lolin32_lite] -platform = espressif32 -board = lolin32_lite -framework = arduino -monitor_speed=115200 \ No newline at end of file diff --git a/projects/LoRa_Transmitter/src/LoRa.cpp b/projects/LoRa_Transmitter/src/LoRa.cpp deleted file mode 100644 index abf3bfa..0000000 --- a/projects/LoRa_Transmitter/src/LoRa.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "LoRa.hpp" - -namespace Lora { - -HardwareSerial LoRaWioE5(1); - -void init() { - // communication with LoRa Wio E5, RX and TX pins, baudrate 9600 - LoRaWioE5.begin(9600, SERIAL_8N1, 15, 19); - LoRaWioE5.print("AT+MODE=TEST\r\n"); // set transmitter in test mode - - // check if lora is available - if (LoRaWioE5.readString() != "+MODE: TEST") { - Serial.println("\nLora is not available"); - } - delay(1000); - - // setup LoRa for transmitting - LoRaWioE5.print( - "AT+TEST=RFCFG, 868, SF12, 125, 12, 15, 14, ON, OFF, OFF\r\n"); - delay(1000); -} - -void send(String wiadomosc) { - LoRaWioE5.print("AT+TEST=TXLRSTR,\"" + wiadomosc + "\"\r\n"); - // carriage return is essential -} - -} // namespace Lora \ No newline at end of file diff --git a/projects/LoRa_Transmitter/src/LoRa_debug.cpp b/projects/LoRa_Transmitter/src/LoRa_debug.cpp deleted file mode 100644 index 22a0838..0000000 --- a/projects/LoRa_Transmitter/src/LoRa_debug.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "LoRa.hpp" - -namespace Lora2 { - -HardwareSerial LoRaWioE5(1); - -void init() { - // ZROBIĆ DO SETUPU ODPOWIEDNIĄ OBSŁUGĘ W RAZIE ŹLE PODŁĄCZONEJ LoRy - // .isavailable() (taka metoda z chata) - - delay(1000); - LoRaWioE5.begin(9600, SERIAL_8N1, 15, 19); - // Komunikacja z modułem LoRa Wio E5, piny RX i TX - - Serial.println( - "\n[debug]Wstepna konfiguracja modulu"); // drukowanie do debugu, mozna - // usunac - // Ustawiamy moduł w tryb testowy - LoRaWioE5.print("AT+MODE=TEST\r\n"); // Ustawia tryb nadajnika na TEST - - String response = LoRaWioE5.readString(); - - if (response != "+MODE: TEST") { - Serial.println("\n[debug] Lora is not available"); - Serial.println("\n[debug] Failed message: " + response); - } - - Serial.println("\n[debug]Odpowiedz: " + response); - // Drukuje na serial monitorze odpowiedz na wyslana komende - - Serial.println("\n[debug]Przesylanie danych"); - delay(1000); // Chwilowe opoznienie, prawdopodobnie niezbedne do prawidlowego - // dzialania - - // Konfigurujemy moduł - LoRaWioE5.print( - "AT+TEST=RFCFG, 868, SF12, 125, 12, 15, 14, ON, OFF, OFF\r\n"); - // nastepne - // ustawienie - // nadajnika - response = LoRaWioE5.readString(); - Serial.println("\n[debug]Odpowiedz: " + response); - // Drukuje odpowiedz na komende na serial monitorze - delay(1000); -} - -void send(String wiadomosc) { - // Na transmiterze - - LoRaWioE5.print("AT+TEST=TXLRSTR,\"" + wiadomosc + "\"\r\n"); - // przenieisienie karteki zeby prawidlowo dzialalo - // Przesyla do LoRy komende, ktora wysyla wiadomosc, sformatowana w - // odpowiedniej funkcji, ktora jest przesylana jako argument - - String response = LoRaWioE5.readString(); - Serial.println("[debug]Odpowiedz: " + response); - // Drukuje odpowiedz na komende -} - -String give_mess(int i) { - String message; - - message = String(i) + ". Wiadomosc"; - Serial.print("\n[debug]Wprowadzono: "); - Serial.println(message); - - return message; -} - -String give_bme() { - String message; - - message = " 53, "; // temperatura - message += " 567, "; // wilgotnosc - message += " 242, "; // cisnienie - message += " 534"; // wysokosc - - Serial.print("\n[debug]Wprowadzono: "); - Serial.println(message); - - return message; -} - -String give_gps() { - String message = " Bledne dane "; - - message = " 523, "; // dl geogr - message += " 523,"; // szer geogr - message += " 234, "; // czas - message += " 654, "; // wysoksoc - message += " 4234"; // dokladnosc - - Serial.print("\n[debug]Wprowadzono: "); - Serial.println(message); - - return message; -} - -} // namespace Lora2 \ No newline at end of file diff --git a/projects/LoRa_Transmitter/src/main.cpp b/projects/LoRa_Transmitter/src/main.cpp deleted file mode 100644 index a1d5aac..0000000 --- a/projects/LoRa_Transmitter/src/main.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "LoRa.hpp" - -// Second serial port on ESP32 - -int i = 1; - -void setup() { - Serial.begin(115200); - Serial.println("start"); - Lora::init(); - // use lora2 ns for debug -} - -void loop() { - Lora::send(give_mess(i)); - delay(5000); // delay for readable sake - i++; -} - -String give_mess(int i) { return String(i) + ". Wiadomosc"; } diff --git a/projects/LoRa_Transmitter/test.txt b/projects/LoRa_Transmitter/test.txt deleted file mode 100644 index c47b963..0000000 --- a/projects/LoRa_Transmitter/test.txt +++ /dev/null @@ -1 +0,0 @@ -No siema \ No newline at end of file diff --git a/projects/MPU/test.txt b/projects/MPU/test.txt deleted file mode 100644 index 1bd28dc..0000000 --- a/projects/MPU/test.txt +++ /dev/null @@ -1 +0,0 @@ -coś diff --git a/projects/Main/.gitignore b/projects/Main/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/projects/Main/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/projects/Main/.vscode/extensions.json b/projects/Main/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/projects/Main/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/projects/Main/.vscode/settings.json b/projects/Main/.vscode/settings.json deleted file mode 100644 index 4f51d5d..0000000 --- a/projects/Main/.vscode/settings.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "editor.tabSize": 2, - "files.exclude": { - "**/.git": true, - }, - "editor.wordWrap": "on", - // C++ formatter settings - "[cpp]": { - "editor.defaultFormatter": "ms-vscode.cpptools", // Use the C/C++ extension as the default formatter - "editor.formatOnSave": true // Automatically format C++ files when saving - }, - "C_Cpp.clang_format_style": "file", // Use the .clang-format file in your project (if present) or default style - "C_Cpp.clang_format_fallbackStyle": "Google" // Fallback style if .clang-format file is not found -} diff --git a/projects/Main/include/README b/projects/Main/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/projects/Main/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/projects/Main/include/button.h b/projects/Main/include/button.h deleted file mode 100644 index ed49245..0000000 --- a/projects/Main/include/button.h +++ /dev/null @@ -1,7 +0,0 @@ -#include -extern QueueHandle_t xQueue; - -namespace button { - -void button_task(void *pvParameters); -} // namespace button \ No newline at end of file diff --git a/projects/Main/include/interrupts.h b/projects/Main/include/interrupts.h deleted file mode 100644 index 2ccb479..0000000 --- a/projects/Main/include/interrupts.h +++ /dev/null @@ -1,10 +0,0 @@ -#include -#define BUTTON_PIN 0 // Change this to your button pin - -extern QueueHandle_t xQueue; - -namespace interrupts { - -void setup(); -void IRAM_ATTR button_isr(); -} // namespace interrupts diff --git a/projects/Main/lib/README b/projects/Main/lib/README deleted file mode 100644 index 2593a33..0000000 --- a/projects/Main/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/projects/Main/src/button.cpp b/projects/Main/src/button.cpp deleted file mode 100644 index cd6c011..0000000 --- a/projects/Main/src/button.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "button.h" - -namespace button { - -void button_task(void* pvParameters) { - Serial.println("Button pressed!"); - vTaskDelete(NULL); -} -} // namespace button \ No newline at end of file diff --git a/projects/Main/src/interrupts.cpp b/projects/Main/src/interrupts.cpp deleted file mode 100644 index 4b0335f..0000000 --- a/projects/Main/src/interrupts.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include "interrupts.h" - -namespace interrupts { - -void setup() { - pinMode(BUTTON_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), button_isr, FALLING); -} - -void IRAM_ATTR button_isr() { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - uint32_t isr_msg = 1; - xQueueSendFromISR(xQueue, &isr_msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - portYIELD_FROM_ISR(); - } -} -} // namespace interrupts diff --git a/projects/Main/src/led.cpp b/projects/Main/src/led.cpp deleted file mode 100644 index a74ccc4..0000000 --- a/projects/Main/src/led.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "led.h" - -namespace led { - -void blink_task(void* pvParameters) { - pinMode(LED_BUILTIN, OUTPUT); - for (;;) { - digitalWrite(LED_BUILTIN, HIGH); - vTaskDelay(pdMS_TO_TICKS(500)); // delay for 500ms without blocking the CPU - digitalWrite(LED_BUILTIN, LOW); - vTaskDelay(pdMS_TO_TICKS(500)); // delay for 500ms - } -} -} // namespace led \ No newline at end of file diff --git a/projects/Main/src/main.cpp b/projects/Main/src/main.cpp deleted file mode 100644 index a6a8eec..0000000 --- a/projects/Main/src/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#include "bmp.hpp" -#include "button.h" -#include "interrupts.h" -#include "led.h" - -QueueHandle_t xQueue; - -void setup() { - Serial.begin(115200); - Serial.println("--- Starting the rocket... ---"); - - xQueue = xQueueCreate(10, sizeof(uint32_t)); // create xQueue - interrupts::setup(); - xTaskCreate(led::blink_task, "blink", 10000, NULL, 1, NULL); - - bmp::Data globalData[10]; - - void bmp_task() { - for (;;) { - bmp::Data tempData[10]; - for (int i = 0; i < 10; i++) { - tempData[i] = bmp::measure(); - vTaskDelay(pdMS_TO_TICKS(100)); - } - // Copy tempData to globalData - memcpy(globalData, tempData, sizeof(globalData)); - } - } - - xTaskCreate(led::blink_task, "blink", 10000, NULL, 1, NULL); - if (xQueue != NULL) - xTaskCreate(button::button_task, "button", 10000, NULL, 1, NULL); -} - -void loop() { - // put your main code here, to run repeatedly: -} diff --git a/projects/Main/test/README b/projects/Main/test/README deleted file mode 100644 index 9b1e87b..0000000 --- a/projects/Main/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/projects/RocketComputer/.gitignore b/projects/RocketComputer/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/projects/RocketComputer/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/projects/RocketComputer/.vscode/extensions.json b/projects/RocketComputer/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/projects/RocketComputer/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/projects/RocketComputer/lib/README b/projects/RocketComputer/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/projects/RocketComputer/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/projects/RocketComputer/lib/led.hpp b/projects/RocketComputer/lib/led.hpp deleted file mode 100644 index 23614fb..0000000 --- a/projects/RocketComputer/lib/led.hpp +++ /dev/null @@ -1,3 +0,0 @@ -#define LED_BUILTIN 2 - -void TaskBlinkLED(void *pvParameters) \ No newline at end of file diff --git a/projects/RocketComputer/platformio.ini b/projects/RocketComputer/platformio.ini deleted file mode 100644 index 9680fa8..0000000 --- a/projects/RocketComputer/platformio.ini +++ /dev/null @@ -1,14 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:lolin32_lite] -platform = espressif32 -board = lolin32_lite -framework = arduino diff --git a/projects/RocketComputer/src/led.cpp b/projects/RocketComputer/src/led.cpp deleted file mode 100644 index 8c703ce..0000000 --- a/projects/RocketComputer/src/led.cpp +++ /dev/null @@ -1,9 +0,0 @@ -void TaskBlinkLED(void *pvParameters) { - pinMode(LED_BUILTIN, OUTPUT); - for(;;) { - digitalWrite(LED_BUILTIN, HIGH); - vTaskDelay(pdMS_TO_TICKS(500)); // delay for 500ms - digitalWrite(LED_BUILTIN, LOW); - vTaskDelay(pdMS_TO_TICKS(500)); // delay for 500ms - } -} \ No newline at end of file diff --git a/projects/RocketComputer/src/main.cpp b/projects/RocketComputer/src/main.cpp deleted file mode 100644 index 0e83292..0000000 --- a/projects/RocketComputer/src/main.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -#include -#include - -#define BUTTON_PIN 0 // Change this to your button pin - -QueueHandle_t xQueue; - -void IRAM_ATTR button_isr() { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - uint32_t isr_msg = 1; - xQueueSendFromISR(xQueue, &isr_msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - portYIELD_FROM_ISR(); - } -} - -void TaskButton(void *pvParameters) { - uint32_t rx_msg; - for (;;) { - if (xQueueReceive(xQueue, &rx_msg, portMAX_DELAY)) { - // Button press detected, do something here - } - } -} - -void setup() { - pinMode(BUTTON_PIN, INPUT_PULLUP); - attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), button_isr, FALLING); - - xQueue = xQueueCreate(10, sizeof(uint32_t)); - if (xQueue != NULL) { - xTaskCreate(TaskButton, "TaskButton", 10000, NULL, 1, NULL); - } - xTaskCreate(TaskBlinkLED, /* Task function. */ - "TaskBlinkLED", /* String with name of task. */ - 10000, /* Stack size in bytes. */ - NULL, /* Parameter passed as input of the task */ - 1, /* Priority of the task. */ - NULL); /* Task handle. */ -} - -void loop() { - // put your main code here, to run repeatedly: -} diff --git a/projects/RocketComputer/test/README b/projects/RocketComputer/test/README deleted file mode 100644 index 9b1e87b..0000000 --- a/projects/RocketComputer/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/projects/T-beam/.gitignore b/projects/T-beam/.gitignore deleted file mode 100644 index 89cc49c..0000000 --- a/projects/T-beam/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/projects/T-beam/.vscode/extensions.json b/projects/T-beam/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/projects/T-beam/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/projects/T-beam/include/led.h b/projects/T-beam/include/led.h deleted file mode 100644 index 419bdcf..0000000 --- a/projects/T-beam/include/led.h +++ /dev/null @@ -1,6 +0,0 @@ -#include - -namespace led { - -void blink_task(void *pvParameters); -} // namespace led \ No newline at end of file diff --git a/projects/T-beam/platformio.ini b/projects/T-beam/platformio.ini deleted file mode 100644 index 2b364f5..0000000 --- a/projects/T-beam/platformio.ini +++ /dev/null @@ -1,15 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:ttgo-t-beam] -platform = espressif32 -board = ttgo-t-beam -framework = arduino -monitor_speed = 115200 diff --git a/projects/T-beam/src/main.cpp b/projects/T-beam/src/main.cpp deleted file mode 100644 index 025bd2f..0000000 --- a/projects/T-beam/src/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#include "gps.h" -#include "led.h" - -void setup() { - Serial.begin(115200); - Serial.println("--- Starting the rocket... ---"); - gps::init(); - xTaskCreate(led::blink_task, "blink", 10000, NULL, 1, NULL); - xTaskCreate(gps::gps_loop, "gps", 10000, NULL, 1, NULL); -} - -void loop() {} diff --git a/projects/T-beam/test/README b/projects/T-beam/test/README deleted file mode 100644 index 9b1e87b..0000000 --- a/projects/T-beam/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/projects/bmp/.gitignore b/projects/bmp/.gitignore deleted file mode 100644 index b9f3806..0000000 --- a/projects/bmp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.pio -.vscode diff --git a/projects/bmp/.vscode/extensions.json b/projects/bmp/.vscode/extensions.json deleted file mode 100644 index 080e70d..0000000 --- a/projects/bmp/.vscode/extensions.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - // See http://go.microsoft.com/fwlink/?LinkId=827846 - // for the documentation about the extensions.json format - "recommendations": [ - "platformio.platformio-ide" - ], - "unwantedRecommendations": [ - "ms-vscode.cpptools-extension-pack" - ] -} diff --git a/projects/bmp/include/README b/projects/bmp/include/README deleted file mode 100644 index 194dcd4..0000000 --- a/projects/bmp/include/README +++ /dev/null @@ -1,39 +0,0 @@ - -This directory is intended for project header files. - -A header file is a file containing C declarations and macro definitions -to be shared between several project source files. You request the use of a -header file in your project source file (C, C++, etc) located in `src` folder -by including it, with the C preprocessing directive `#include'. - -```src/main.c - -#include "header.h" - -int main (void) -{ - ... -} -``` - -Including a header file produces the same results as copying the header file -into each source file that needs it. Such copying would be time-consuming -and error-prone. With a header file, the related declarations appear -in only one place. If they need to be changed, they can be changed in one -place, and programs that include the header file will automatically use the -new version when next recompiled. The header file eliminates the labor of -finding and changing all the copies as well as the risk that a failure to -find one copy will result in inconsistencies within a program. - -In C, the usual convention is to give header files names that end with `.h'. -It is most portable to use only letters, digits, dashes, and underscores in -header file names, and at most one dot. - -Read more about using header files in official GCC documentation: - -* Include Syntax -* Include Operation -* Once-Only Headers -* Computed Includes - -https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/projects/bmp/include/bmp.hpp b/projects/bmp/include/bmp.hpp deleted file mode 100644 index 9ca9def..0000000 --- a/projects/bmp/include/bmp.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -namespace bmp { -//wymaga ustawienia Wire.begin(SDA_PIN, SCL_PIN) wcześniej -void begin(); - -struct Data { - float temperature; - float pressure; - float altitude; - - float get_as_hpa(); -}; - -Data measurements(); -void pretty_print(); -} \ No newline at end of file diff --git a/projects/bmp/lib/README b/projects/bmp/lib/README deleted file mode 100644 index 6debab1..0000000 --- a/projects/bmp/lib/README +++ /dev/null @@ -1,46 +0,0 @@ - -This directory is intended for project specific (private) libraries. -PlatformIO will compile them to static libraries and link into executable file. - -The source code of each library should be placed in a an own separate directory -("lib/your_library_name/[here are source files]"). - -For example, see a structure of the following two libraries `Foo` and `Bar`: - -|--lib -| | -| |--Bar -| | |--docs -| | |--examples -| | |--src -| | |- Bar.c -| | |- Bar.h -| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html -| | -| |--Foo -| | |- Foo.c -| | |- Foo.h -| | -| |- README --> THIS FILE -| -|- platformio.ini -|--src - |- main.c - -and a contents of `src/main.c`: -``` -#include -#include - -int main (void) -{ - ... -} - -``` - -PlatformIO Library Dependency Finder will find automatically dependent -libraries scanning project source files. - -More information about PlatformIO Library Dependency Finder -- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/projects/bmp/platformio.ini b/projects/bmp/platformio.ini deleted file mode 100644 index 23528d1..0000000 --- a/projects/bmp/platformio.ini +++ /dev/null @@ -1,15 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; https://docs.platformio.org/page/projectconf.html - -[env:lolin32_lite] -platform = espressif32 -board = lolin32_lite -framework = arduino -lib_deps = adafruit/Adafruit BMP280 Library@^2.6.8 diff --git a/projects/bmp/src/bmp.cpp b/projects/bmp/src/bmp.cpp deleted file mode 100644 index 814eec4..0000000 --- a/projects/bmp/src/bmp.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "bmp.hpp" - -//korzystanie z Adafruit BMP280 Library by Adafruit -#include -#include - -// ciśnienie powietrza na poziomie morza w hPa, altitude -// 1013.25 jest ogólną średnią -// 1019.91 jest wartością lokalną dla Krakowa w momencie pisania tego -#define SEALEVELPRESSURE_HPA (1019.91) - -Adafruit_BMP280 bmp_obj; - -namespace bmp { - -//wymaga ustawienia Wire.begin(SDA_PIN, SCL_PIN) wcześniej -void begin() { - if (!bmp_obj.begin(0x76)) { - Serial.println("Viable sensor BMP280 not found, check wiring!"); - while (1); - } -} - -Data measurements() { - Data check; - //temperatura w Celsjuszach - check.temperature = bmp_obj.readTemperature(); - //Ciśnienie w paskalach - check.pressure = bmp_obj.readPressure(); - //przybliżona wysokość nad poziomem morza w metrach - check.altitude = bmp_obj.readAltitude(SEALEVELPRESSURE_HPA); - return check; -}; - -void pretty_print() { - Data exp = measurements(); - Serial.print("Temperature = "); - Serial.print(exp.temperature); - Serial.println(" *C"); - - Serial.print("Pressure = "); - Serial.print(exp.get_as_hpa()); - Serial.println(" hPa"); - - Serial.print("Approx. Altitude = "); - Serial.print(exp.altitude); - Serial.println(" m"); - - Serial.println(); -} - -float Data::get_as_hpa() { - return bmp_obj.readPressure()/100.0F; -} -} \ No newline at end of file diff --git a/projects/bmp/src/main.cpp b/projects/bmp/src/main.cpp deleted file mode 100644 index 0e3dbb2..0000000 --- a/projects/bmp/src/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include "bmp.hpp" - - -void setup() { - Wire.begin(23,19); - Serial.begin(9600); - bmp::begin(); -} - -void loop() { - bmp::pretty_print(); - delay(2000); -} \ No newline at end of file diff --git a/projects/bmp/test/README b/projects/bmp/test/README deleted file mode 100644 index 9b1e87b..0000000 --- a/projects/bmp/test/README +++ /dev/null @@ -1,11 +0,0 @@ - -This directory is intended for PlatformIO Test Runner and project tests. - -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html diff --git a/projects/firmware b/projects/firmware deleted file mode 160000 index 147de75..0000000 --- a/projects/firmware +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 147de75a0295e7c8e71605d7fd007dfa222a5c12 diff --git a/projects/spadochron/krzysiek.txt b/projects/spadochron/krzysiek.txt deleted file mode 100644 index e69de29..0000000 diff --git a/projects/spadochron/redme.txt b/projects/spadochron/redme.txt deleted file mode 100644 index 74a4e7a..0000000 --- a/projects/spadochron/redme.txt +++ /dev/null @@ -1 +0,0 @@ -dupa123 \ No newline at end of file