diff --git a/.cproject b/.cproject index 8238caf..d5d7ad0 100644 --- a/.cproject +++ b/.cproject @@ -46,27 +46,27 @@ @@ -79,27 +79,27 @@ @@ -129,9 +129,10 @@ - + + diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f6ed76..2dbedb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,11 +49,11 @@ else () add_compile_options(-Og -g) endif () -include_directories(Core/Inc Core/External/Proto/Buffer Core/External/Proto/Buffer/Request Core/External/Proto/Buffer/Response Core/External/Sensor Core/External/Proto/Helper Core/External/Proto/Codec Core/External/Proto/Generated Core/External/Proto/Generated/Content Core/External/Scheduler Core/External/Scheduler/Handler Core/External/State Core/External/Tools/Indicator Core/External/Tools/Converter Core/External/Tools/Mutex Core/External/Tools/Sequence ThirdParty/Inc Drivers/STM32L4xx_HAL_Driver/Inc Drivers/STM32L4xx_HAL_Driver/Inc/Legacy Drivers/CMSIS/Device/ST/STM32L4xx/Include Drivers/CMSIS/Include) +include_directories(Drivers/CMSIS/Include Drivers/STM32L4xx_HAL_Driver/Inc Drivers/STM32L4xx_HAL_Driver/Inc/Legacy Drivers/CMSIS/Device/ST/STM32L4xx/Include Core/Inc ThirdParty/Inc External/Inc/Proto/Buffer External/Inc/Proto/Buffer/Request External/Inc/Proto/Buffer/Response External/Inc/Sensor External/Inc/Proto/Helper External/Inc/Proto/Codec External/Inc/Proto/Generated External/Inc/Proto/Generated/Content External/Inc/Scheduler External/Inc/Scheduler/Handler External/Inc/State External/Inc/Tools/Indicator External/Inc/Tools/Converter External/Inc/Tools/Mutex External/Inc/Tools/Sequence) add_definitions(-DDEBUG -DUSE_HAL_DRIVER -DSTM32L476xx) -file(GLOB_RECURSE SOURCES "ThirdParty/*.*" "Core/*.*" "Drivers/*.*") +file(GLOB_RECURSE SOURCES "Core/*.*" "Drivers/*.*" "External/*.*" "ThirdParty/*.*") set(LINKER_SCRIPT ${CMAKE_SOURCE_DIR}/STM32L476RGTX_FLASH.ld) diff --git a/Core/External/Proto/Buffer/Request/request_buffer.h b/External/Inc/Proto/Buffer/Request/request_buffer.h similarity index 100% rename from Core/External/Proto/Buffer/Request/request_buffer.h rename to External/Inc/Proto/Buffer/Request/request_buffer.h diff --git a/Core/External/Proto/Buffer/Response/response_buffer.h b/External/Inc/Proto/Buffer/Response/response_buffer.h similarity index 100% rename from Core/External/Proto/Buffer/Response/response_buffer.h rename to External/Inc/Proto/Buffer/Response/response_buffer.h diff --git a/Core/External/Proto/Codec/proto_codec.h b/External/Inc/Proto/Codec/proto_codec.h similarity index 100% rename from Core/External/Proto/Codec/proto_codec.h rename to External/Inc/Proto/Codec/proto_codec.h diff --git a/Core/External/Proto/Generated/Content/data.h b/External/Inc/Proto/Generated/Content/data.h similarity index 100% rename from Core/External/Proto/Generated/Content/data.h rename to External/Inc/Proto/Generated/Content/data.h diff --git a/Core/External/Proto/Generated/Content/info.h b/External/Inc/Proto/Generated/Content/info.h similarity index 100% rename from Core/External/Proto/Generated/Content/info.h rename to External/Inc/Proto/Generated/Content/info.h diff --git a/Core/External/Proto/Generated/Content/settings.h b/External/Inc/Proto/Generated/Content/settings.h similarity index 100% rename from Core/External/Proto/Generated/Content/settings.h rename to External/Inc/Proto/Generated/Content/settings.h diff --git a/Core/External/Proto/Generated/request.h b/External/Inc/Proto/Generated/request.h similarity index 100% rename from Core/External/Proto/Generated/request.h rename to External/Inc/Proto/Generated/request.h diff --git a/Core/External/Proto/Generated/response.h b/External/Inc/Proto/Generated/response.h similarity index 100% rename from Core/External/Proto/Generated/response.h rename to External/Inc/Proto/Generated/response.h diff --git a/Core/External/Proto/Helper/proto_helper.h b/External/Inc/Proto/Helper/proto_helper.h similarity index 100% rename from Core/External/Proto/Helper/proto_helper.h rename to External/Inc/Proto/Helper/proto_helper.h diff --git a/Core/External/Scheduler/Handler/scheduler_handler.h b/External/Inc/Scheduler/Handler/scheduler_handler.h similarity index 100% rename from Core/External/Scheduler/Handler/scheduler_handler.h rename to External/Inc/Scheduler/Handler/scheduler_handler.h diff --git a/Core/External/Scheduler/scheduler.h b/External/Inc/Scheduler/scheduler.h similarity index 100% rename from Core/External/Scheduler/scheduler.h rename to External/Inc/Scheduler/scheduler.h diff --git a/Core/External/Sensor/tsl2591x.h b/External/Inc/Sensor/tsl2591x.h similarity index 95% rename from Core/External/Sensor/tsl2591x.h rename to External/Inc/Sensor/tsl2591x.h index 9ecb31a..a2f1360 100644 --- a/Core/External/Sensor/tsl2591x.h +++ b/External/Inc/Sensor/tsl2591x.h @@ -83,7 +83,7 @@ class TSL2591X { * * @return read device id. */ - static bool get_device_id(); + static uint8_t get_device_id(); /** * Resets light sensor to the default state, initializing device with default settings. diff --git a/Core/External/State/state.h b/External/Inc/State/state.h similarity index 100% rename from Core/External/State/state.h rename to External/Inc/State/state.h diff --git a/Core/External/Tools/Converter/Converter.h b/External/Inc/Tools/Converter/converter.h similarity index 100% rename from Core/External/Tools/Converter/Converter.h rename to External/Inc/Tools/Converter/converter.h diff --git a/Core/External/Tools/Indicator/indicator.h b/External/Inc/Tools/Indicator/indicator.h similarity index 100% rename from Core/External/Tools/Indicator/indicator.h rename to External/Inc/Tools/Indicator/indicator.h diff --git a/Core/External/Tools/Mutex/mutex.h b/External/Inc/Tools/Mutex/mutex.h similarity index 93% rename from Core/External/Tools/Mutex/mutex.h rename to External/Inc/Tools/Mutex/mutex.h index 4925e89..e36b5a6 100644 --- a/Core/External/Tools/Mutex/mutex.h +++ b/External/Inc/Tools/Mutex/mutex.h @@ -21,7 +21,7 @@ class Mutex { * * @return retrieved state of the mutex. */ - bool is_locked() const; + [[nodiscard]] bool is_locked() const; private: /** * Represents current state of the mutex. diff --git a/Core/External/Tools/Sequence/sequence.h b/External/Inc/Tools/Sequence/sequence.h similarity index 100% rename from Core/External/Tools/Sequence/sequence.h rename to External/Inc/Tools/Sequence/sequence.h diff --git a/Core/External/Proto/Buffer/Request/request_buffer.cpp b/External/Src/Proto/Buffer/Request/request_buffer.cpp similarity index 100% rename from Core/External/Proto/Buffer/Request/request_buffer.cpp rename to External/Src/Proto/Buffer/Request/request_buffer.cpp diff --git a/Core/External/Proto/Buffer/Response/response_buffer.cpp b/External/Src/Proto/Buffer/Response/response_buffer.cpp similarity index 100% rename from Core/External/Proto/Buffer/Response/response_buffer.cpp rename to External/Src/Proto/Buffer/Response/response_buffer.cpp diff --git a/Core/External/Proto/Codec/proto_codec.cpp b/External/Src/Proto/Codec/proto_codec.cpp similarity index 100% rename from Core/External/Proto/Codec/proto_codec.cpp rename to External/Src/Proto/Codec/proto_codec.cpp diff --git a/Core/External/Proto/Helper/proto_helper.cpp b/External/Src/Proto/Helper/proto_helper.cpp similarity index 100% rename from Core/External/Proto/Helper/proto_helper.cpp rename to External/Src/Proto/Helper/proto_helper.cpp diff --git a/Core/External/Scheduler/Handler/scheduler_handler.cpp b/External/Src/Scheduler/Handler/scheduler_handler.cpp similarity index 99% rename from Core/External/Scheduler/Handler/scheduler_handler.cpp rename to External/Src/Scheduler/Handler/scheduler_handler.cpp index 4e90e1a..26c0e5a 100644 --- a/Core/External/Scheduler/Handler/scheduler_handler.cpp +++ b/External/Src/Scheduler/Handler/scheduler_handler.cpp @@ -427,8 +427,6 @@ int SchedulerHandler::process_settings_bus_request_content_response( return EXIT_FAILURE; } - - } Indicator::toggle_action_success(); diff --git a/Core/External/Scheduler/scheduler.cpp b/External/Src/Scheduler/scheduler.cpp similarity index 100% rename from Core/External/Scheduler/scheduler.cpp rename to External/Src/Scheduler/scheduler.cpp diff --git a/Core/External/Sensor/tsl2591x.cpp b/External/Src/Sensor/tsl2591x.cpp similarity index 95% rename from Core/External/Sensor/tsl2591x.cpp rename to External/Src/Sensor/tsl2591x.cpp index e47bff9..705e16e 100644 --- a/Core/External/Sensor/tsl2591x.cpp +++ b/External/Src/Sensor/tsl2591x.cpp @@ -14,7 +14,7 @@ bool TSL2591X::is_available() { return HAL_I2C_IsDeviceReady(&hi2c1, TSL2591X_ADDRESS, 1u, 10u) == HAL_OK; } -bool TSL2591X::get_device_id() { +uint8_t TSL2591X::get_device_id() { return read_byte(WHO_AM_I); }; diff --git a/Core/External/State/state.cpp b/External/Src/State/state.cpp similarity index 100% rename from Core/External/State/state.cpp rename to External/Src/State/state.cpp diff --git a/Core/External/Tools/Converter/Converter.cpp b/External/Src/Tools/Converter/converter.cpp similarity index 100% rename from Core/External/Tools/Converter/Converter.cpp rename to External/Src/Tools/Converter/converter.cpp diff --git a/Core/External/Tools/Indicator/indicator.cpp b/External/Src/Tools/Indicator/indicator.cpp similarity index 100% rename from Core/External/Tools/Indicator/indicator.cpp rename to External/Src/Tools/Indicator/indicator.cpp diff --git a/Core/External/Tools/Mutex/mutex.cpp b/External/Src/Tools/Mutex/mutex.cpp similarity index 100% rename from Core/External/Tools/Mutex/mutex.cpp rename to External/Src/Tools/Mutex/mutex.cpp diff --git a/Core/External/Tools/Sequence/sequence.cpp b/External/Src/Tools/Sequence/sequence.cpp similarity index 99% rename from Core/External/Tools/Sequence/sequence.cpp rename to External/Src/Tools/Sequence/sequence.cpp index f51056c..19977c2 100644 --- a/Core/External/Tools/Sequence/sequence.cpp +++ b/External/Src/Tools/Sequence/sequence.cpp @@ -42,7 +42,7 @@ void Sequence::traverse_until_succeed(std::function callback) { sequence.pop(); } -}; +} template void Sequence::add(const T& src) { diff --git a/Makefile b/Makefile index ea388e0..6d9e0e6 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +plugin := $(or $(plugin), '') + .ONESHELL: .PHONY: help @@ -29,6 +31,12 @@ endif .PHONY: generate generate: ## Generate ProtocolBuffers files(used mainly for development) +ifeq ($(plugin), '') + @echo "Plugin is not set!" + + @exit 1 +endif + @protoc -I./Resources/Proto/Container --pyi_out=./Scripts/cli/src/proto Content/data.proto Content/info.proto Content/settings.proto request.proto response.proto @protoc -I./Resources/Proto/Container --python_out=./Scripts/cli/src/proto Content/data.proto Content/info.proto Content/settings.proto request.proto response.proto - @protoc --plugin=/Volumes/Files/embedded/university/techno/project/deps/EmbeddedProto -I./Resources/Proto/Container --eams_out=./Core/External/Proto/Generated Content/data.proto Content/info.proto Content/settings.proto request.proto response.proto \ No newline at end of file + @protoc --plugin=$(plugin) -I./Resources/Proto/Container --eams_out=./Core/External/Proto/Generated Content/data.proto Content/info.proto Content/settings.proto request.proto response.proto \ No newline at end of file