diff --git a/KED_structure_idea/Makefile b/KED_structure_idea/Makefile deleted file mode 100644 index db99c6d..0000000 --- a/KED_structure_idea/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -cpp_src = $(wildcard *.cpp) -#cpp_src += $(wildcard ./utils/*.cpp) -#cpp_src += $(wildcard ./driver/*.cpp) - -cpp_obj = $(cpp_src:.cpp=.o) -c_obj = $(c_src:.c=.o) -CC = g++ -CFLAGS = -Wall -pedantic -li2c -LDFLAGS = -EXEC = runtest - - -all : $(EXEC) - -$(EXEC): $(cpp_obj) $(c_obj) - $(CC) -o $@ $^ $(LDFLAGS) - -debug : $(EXEC) - -$(EXEC): $(cpp_obj) $(c_obj) - $(CC) -g -o $@ $^ $(LDFLAGS) - -clean: - rm -rf $(c_obj) $(cpp_obj) $(EXEC) - clear - -cleanall: - rm -rf $(c_obj) $(cpp_obj) $(EXEC) - clear diff --git a/KED_structure_idea/bsl/hw_plattform.hpp b/KED_structure_idea/bsl/hw_plattform.hpp deleted file mode 100644 index 31d711d..0000000 --- a/KED_structure_idea/bsl/hw_plattform.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __HW_PLATTFORM_HPP__ -#define __HW_PLATTFORM_HPP__ - -#include - -// -// csl ressources -// - -#include "./../csl/implementations/dummy/dummy_pin.hpp" - -// -// drivers -// - -#include "./../drivers/LED.hpp" - -struct HW_plattform -{ - HW_plattform(): - pin_0(), - pin_1(), - led_0(pin_0) - {} - - void init() - { - std::cout << "bsl init..." << std::endl; - pin_0.set(false); - pin_1.set(false); - std::cout << "...done!" << std::endl; - }; - - private: - Dummy_Pin pin_0, pin_1; - public: - - LED led_0; -}; - - -#endif // __HW_PLATTFORM_HPP__ diff --git a/KED_structure_idea/csl/implementations/avr/avr_pin.hpp b/KED_structure_idea/csl/implementations/avr/avr_pin.hpp deleted file mode 100644 index 42c49ec..0000000 --- a/KED_structure_idea/csl/implementations/avr/avr_pin.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __AVR_PIN_HPP__ -#define __AVR_PIN_HPP__ - -#include -#include "./../../interfaces/pin.hpp" - - - -struct AVR_Pin : Pin -{ - AVR_Pin() - { - std::cout << "created AVR_Pin" << std::endl; - } - - void setImp(bool logic) - { - std::cout << "AVR pin set to " << logic << std::endl; - } - - void toggleImp() - { - std::cout << "toggled AVR pin" << std::endl; - } - - bool getImp() - { - return true; - } - - void avr_stuff() - { - std::cout << "AVR specific stuff" << std::endl; - } -}; - -#endif // __AVR_PIN_HPP__ \ No newline at end of file diff --git a/KED_structure_idea/csl/implementations/dummy/dummy_pin.hpp b/KED_structure_idea/csl/implementations/dummy/dummy_pin.hpp deleted file mode 100644 index 96b1cb6..0000000 --- a/KED_structure_idea/csl/implementations/dummy/dummy_pin.hpp +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __DUMMY_PIN_HPP__ -#define __DUMMY_PIN_HPP__ - -#include "./../../interfaces/pin.hpp" - -#include - - -struct Dummy_Pin : Pin -{ - Dummy_Pin() - { - std::cout << "created Dummy_Pin" << std::endl; - } - - void setImp(bool logic) - { - std::cout << "Dummy pin set to " << logic << std::endl; - } - - void toggleImp() - { - std::cout << "toggled Dummy pin" << std::endl; - } - - bool getImp() - { - return true; - } - - void dummy_stuff() - { - std::cout << "dummy specific stuff" << std::endl; - } -}; - - -#endif // __DUMMY_PIN_HPP__ diff --git a/KED_structure_idea/csl/implementations/stm/stm_pin.hpp b/KED_structure_idea/csl/implementations/stm/stm_pin.hpp deleted file mode 100644 index 2d4cf74..0000000 --- a/KED_structure_idea/csl/implementations/stm/stm_pin.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __STM_PIN_HPP__ -#define __STM_PIN_HPP__ - -#include "./../../interfaces/pin.hpp" - -#include - -truct STM32_Pin : Pin -{ - STM32_Pin() - { - std::cout << "created STM32_Pin" << std::endl; - } - - void setImp(bool logic) - { - std::cout << "stm32 pin set to " << logic << std::endl; - } - - void toggleImp() - { - std::cout << "toggled stm32 pin" << std::endl; - } - - bool getImp() - { - return true; - } - - - void STM32_stuff() - { - std::cout << "STM_32 specific stuff" << std::endl; - } -}; - -#endif // __STM_PIN_HPP__ diff --git a/KED_structure_idea/csl/interfaces/pin.hpp b/KED_structure_idea/csl/interfaces/pin.hpp deleted file mode 100644 index 3c9c76d..0000000 --- a/KED_structure_idea/csl/interfaces/pin.hpp +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __PIN_HPP__ -#define __PIN_HPP__ - -template -struct Pin -{ - void set(bool logic) - { - static_cast(this)->setImp(logic); - } - - void toggle() - { - static_cast(this)->toggleImp(); - } - - bool get(void) - { - return static_cast(this)->getImp(); - } -}; - -#endif // __PIN_HPP__ diff --git a/KED_structure_idea/drivers/LED.hpp b/KED_structure_idea/drivers/LED.hpp deleted file mode 100644 index dfaec72..0000000 --- a/KED_structure_idea/drivers/LED.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __LED_HPP__ -#define __LED_HPP__ - -#include "./../csl/interfaces/pin.hpp" - -template -class LED -{ - public: - - LED(Pin& pin) : - pin(pin) - {} - - void turnOn() - { - pin.set(true); - } - - void turnOff() - { - pin.set(false); - } - - void toggle() - { - pin.toggle(); - } - - private: - - Pin& pin; -}; - -#endif // __LED_HPP__ diff --git a/KED_structure_idea/main.cpp b/KED_structure_idea/main.cpp deleted file mode 100644 index 522a52f..0000000 --- a/KED_structure_idea/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include - -#include "./bsl/hw_plattform.hpp" - - -int main() -{ - HW_plattform hw; - hw.init(); - - //hw.pin_1.set(true); - - hw.led_0.turnOn(); - - return 1; -} \ No newline at end of file diff --git a/KED_structure_idea/runtest b/KED_structure_idea/runtest deleted file mode 100755 index 13f81ba..0000000 Binary files a/KED_structure_idea/runtest and /dev/null differ diff --git a/bsl/csl/stm32f042/Src/CMakeLists.txt b/bsl/csl/stm32f042/Src/CMakeLists.txt index 01cfe22..04f13cb 100644 --- a/bsl/csl/stm32f042/Src/CMakeLists.txt +++ b/bsl/csl/stm32f042/Src/CMakeLists.txt @@ -1,7 +1,10 @@ set (STMSRC_INCLUDES - ../Inc ) + ../Inc + ${INTERFACES_DIR} + ) set(STMSRC_SOURCES + gpio.cpp stm32f0xx_csl.c stm32f0xx_it.c system_stm32f0xx.c) @@ -13,3 +16,11 @@ target_include_directories(stmSources PUBLIC ${STMSRC_INCLUDES}) target_link_libraries(stmSources sub::drivers) add_library(sub::sources ALIAS stmSources) + + +add_library(stmGpio gpio.cpp) + +target_compile_options(stmGpio PRIVATE ${C_FLAGS}) +target_compile_definitions(stmGpio PRIVATE ${C_DEFS}) +target_include_directories(stmGpio PUBLIC ${INTERFACES_DIR} ${CSL_INCLUDES}) +add_library(sub::gpio ALIAS stmGpio) diff --git a/bsl/nucleo_f042k6/periferals/gpio/gpio.cpp b/bsl/csl/stm32f042/Src/gpio.cpp similarity index 96% rename from bsl/nucleo_f042k6/periferals/gpio/gpio.cpp rename to bsl/csl/stm32f042/Src/gpio.cpp index 2a97e46..193c7a4 100644 --- a/bsl/nucleo_f042k6/periferals/gpio/gpio.cpp +++ b/bsl/csl/stm32f042/Src/gpio.cpp @@ -1,6 +1,5 @@ #include "gpio.hpp" -#include "../../bsl_nucleo_f042k6.h" -#include "./../../../csl/stm32f042/Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f042x6.h" +#include "../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f042x6.h" #define PIN_COUNT 20 diff --git a/bsl/csl/stm32f042/gpio/CMakeLists.txt b/bsl/csl/stm32f042/gpio/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/bsl/nucleo_f042k6/periferals/gpio/gpioMap.hpp b/bsl/csl/stm32f042/gpio/gpioMap.hpp similarity index 100% rename from bsl/nucleo_f042k6/periferals/gpio/gpioMap.hpp rename to bsl/csl/stm32f042/gpio/gpioMap.hpp diff --git a/bsl/nucleo_f042k6/CMakeLists.txt b/bsl/nucleo_f042k6/CMakeLists.txt index 77e1af5..9c34ff3 100644 --- a/bsl/nucleo_f042k6/CMakeLists.txt +++ b/bsl/nucleo_f042k6/CMakeLists.txt @@ -1,4 +1,4 @@ -add_subdirectory(periferals) +#add_subdirectory(periferals) add_library(stmTranslator bsl_nucleo_f042k6.cpp) target_compile_options(stmTranslator PRIVATE ${C_FLAGS}) diff --git a/bsl/nucleo_f042k6/bsl_nucleo_f042k6.cmake b/bsl/nucleo_f042k6/bsl_nucleo_f042k6.cmake index 679c545..dd163a6 100644 --- a/bsl/nucleo_f042k6/bsl_nucleo_f042k6.cmake +++ b/bsl/nucleo_f042k6/bsl_nucleo_f042k6.cmake @@ -1,3 +1,7 @@ +#################################################################################################### +# bsl_nucleo_f042k6.cmake +#################################################################################################### + set(CPU_MCU "-mcpu=cortex-m0") set(IDIR_BIN "/home/key/Git/ked/bsl/nucleo_f042k6/bin") @@ -13,6 +17,7 @@ set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_CROSSCOMPILING TRUE) set(LINKER ${CMAKE_SOURCE_DIR}/bsl/csl/stm32f042/startup/STM32F042K6Tx_FLASH.ld) +set(BSL_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}) #################################################################################################### #VARIABLES : defined by user #################################################################################################### diff --git a/bsl/nucleo_f042k6/periferals/CMakeLists.txt b/bsl/nucleo_f042k6/periferals/CMakeLists.txt deleted file mode 100644 index f1cfec5..0000000 --- a/bsl/nucleo_f042k6/periferals/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(gpio) diff --git a/bsl/nucleo_f042k6/periferals/gpio/CMakeLists.txt b/bsl/nucleo_f042k6/periferals/gpio/CMakeLists.txt deleted file mode 100644 index 7c94c87..0000000 --- a/bsl/nucleo_f042k6/periferals/gpio/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_library(stmGpio gpio.cpp) - -target_compile_options(stmGpio PRIVATE ${C_FLAGS}) -target_compile_definitions(stmGpio PRIVATE ${C_DEFS}) -target_include_directories(stmGpio PUBLIC ${INTERFACES_DIR} ${CSL_INCLUDES}) -add_library(sub::gpio ALIAS stmGpio) diff --git a/main.cpp b/main.cpp index 638263c..785d79c 100644 --- a/main.cpp +++ b/main.cpp @@ -8,9 +8,9 @@ int main(int argc, char *argv[]) while(1) { - LL_mDelay(500); + LL_mDelay(50); gpio.writePin(1,1); - LL_mDelay(500); + LL_mDelay(50); gpio.writePin(1,0); } return 1;