diff --git a/bsl/nucleo_f042k6/bslConfig.cmake b/bsl/nucleo_f042k6/bslConfig.cmake index d6d8987..37186e5 100644 --- a/bsl/nucleo_f042k6/bslConfig.cmake +++ b/bsl/nucleo_f042k6/bslConfig.cmake @@ -33,6 +33,7 @@ set(CSL_INCLUDES set(C_FLAGS ${CPU_MCU} -mthumb #Instruction set : https://stackoverflow.com/questions/10638130/what-is-the-arm-thumb-instruction-set + ## -O1 -Wall #Error : If you don't know this one please chek basical compiling -fdata-sections #Optimization : Linker can perform optimizations to improve locality of reference in the instruction space. -fdiagnostics-color=always diff --git a/ideas/delay_structure.cpp b/ideas/delay_structure.cpp index 56b7344..b8cf823 100644 --- a/ideas/delay_structure.cpp +++ b/ideas/delay_structure.cpp @@ -33,8 +33,6 @@ struct STM_Hal_Delay : Delay }; - - int main() { FreeRTOS_Delay dly; diff --git a/main.cpp b/main.cpp index e99a1b3..cff9c03 100644 --- a/main.cpp +++ b/main.cpp @@ -11,6 +11,8 @@ int main(int argc, char *argv[]) stmStart(); delayInitMs(8000000, 1000); +// FreeRTOS_Delay dly; +// dly.wait(); pinConfig(pinB3, output, pushPull, def_res, def_speed); pinConfig(pinA0, input, def_stage, pullDown, def_speed); @@ -30,9 +32,9 @@ int main(int argc, char *argv[]) //blinks 10 times to indicate the sicsessfull init if the device for(i = 0 ; i < 10 ; i++) { - delayMs(100); +// delayMs(100); pinToggle(pinB3); - delayMs(100); +// delayMs(100); } pinWrite(pinB3,0); @@ -60,7 +62,7 @@ int main(int argc, char *argv[]) { pinWrite(pinB3,0); } - delayMs(100); +// delayMs(100); } return 1; } diff --git a/main.hpp b/main.hpp index a6a4577..295390d 100644 --- a/main.hpp +++ b/main.hpp @@ -9,4 +9,40 @@ #include "bsl/nucleo_f042k6/bsl_nucleo_f042k6.hpp" #endif + +struct Delay +{ + virtual void wait() = 0; +}; + + +struct FreeRTOS_Delay : Delay +{ + void wait() override + { + _wait(); + } + private: + static void _wait() + { + for(volatile int i = 0; i < 10; i++); + } +}; + +struct STM_Hal_Delay : Delay +{ + void wait() override + { + _wait(); + } + private: + static void _wait() + { + // systick stuff here + for(volatile int i = 0; i < 1000; i++); + } +}; + + + #endif /* MAIN_H */ diff --git a/utils/menu/menu.h b/utils/menu/menu.h index a60f303..c064940 100644 --- a/utils/menu/menu.h +++ b/utils/menu/menu.h @@ -1,10 +1,48 @@ +/** + ************************************************************************************************** + * @file menu.h + * @author Kerem Yollu & Edwin Koch + * @date 08.11.2021 + * @version 1.0 + ************************************************************************************************** + * @brief Basic menu implementation for diefferent use cases + ************************************************************************************************** +*/ +#ifndef _MENU_H +#define _MENU_H +#ifdef __cplusplus +extern "C" { +#endif +#include +void menuGoUp(); +void menuGoDown(); +void menuGoLeft(); +void menuGoRight(); +uint8_t menuGetEnter(); +uint8_t menuGetEscape(); +uint8_t menuGetReturn(); +uint8_t menuGetClear(); +void menuSendEnter(); +void menuGetEscape(); +void menuGetReturn(); +void menuGetClear(); + +void menuPrintChar(uint8_t char); +void menuMainMenu(); + + +#ifdef __cplusplus +} +#endif + +#endif // _MENU_H