diff --git a/source/shoh/.cproject b/source/shoh/.cproject index bcfda5f..a864a24 100644 --- a/source/shoh/.cproject +++ b/source/shoh/.cproject @@ -43,6 +43,7 @@ + @@ -275,31 +276,31 @@ - <?xml version="1.0" encoding="UTF-8"?> -<TargetConfig> -<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/> -<infoList vendor="NXP"> -<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"> -<chip> -<name>LPC11U68</name> -<family>LPC11U6x</family> -<vendor>NXP (formerly Philips)</vendor> -<reset board="None" core="Real" sys="Real"/> -<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/> -<memory can_program="true" id="Flash" is_ro="true" type="Flash"/> -<memory id="RAM" type="RAM"/> -<memory id="Periph" is_volatile="true" type="Peripheral"/> -<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/> -<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/> -<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/> -<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/> -</chip> -<processor> -<name gcc_name="cortex-m0">Cortex-M0</name> -<family>Cortex-M</family> -</processor> -</info> -</infoList> + <?xml version="1.0" encoding="UTF-8"?> +<TargetConfig> +<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/> +<infoList vendor="NXP"> +<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen"> +<chip> +<name>LPC11U68</name> +<family>LPC11U6x</family> +<vendor>NXP (formerly Philips)</vendor> +<reset board="None" core="Real" sys="Real"/> +<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/> +<memory can_program="true" id="Flash" is_ro="true" type="Flash"/> +<memory id="RAM" type="RAM"/> +<memory id="Periph" is_volatile="true" type="Peripheral"/> +<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/> +<memoryInstance derived_from="RAM" id="Ram0_32" location="0x10000000" size="0x8000"/> +<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/> +<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/> +</chip> +<processor> +<name gcc_name="cortex-m0">Cortex-M0</name> +<family>Cortex-M</family> +</processor> +</info> +</infoList> </TargetConfig> diff --git a/source/shoh/src/main.cpp b/source/shoh/src/main.cpp index e70a843..9bd3574 100644 --- a/source/shoh/src/main.cpp +++ b/source/shoh/src/main.cpp @@ -4,38 +4,14 @@ #include "task.h" #include #include "FreeRTOSCPP/Kernel.hpp" -#include "FreeRTOSCPP/Task.hpp" - -class LedTask : public FreeRTOS::Task { - public: - LedTask(const UBaseType_t priority, const char* name) - : FreeRTOS::Task(priority, configMINIMAL_STACK_SIZE, name) {} - void taskFunction() final; - private: - int led; -}; - -// Task to be created. -void LedTask::taskFunction() { - bool LedState = false; - for (;;) { - Board_LED_Set(led, LedState); - LedState = (bool) !LedState; - led++; - if(led > 2){ - led = 0; - } - vTaskDelay(configTICK_RATE_HZ / 2); - } -} - +#include "threads/master/Master.h" int main(void) { SystemCoreClockUpdate(); Board_Init(); // Create a task before starting the kernel. - LedTask task1((tskIDLE_PRIORITY + 1UL), "vTaskLed1"); + Master master; // Start the real time kernel with preemption. FreeRTOS::Kernel::startScheduler(); diff --git a/source/shoh/src/threads/master/Master.cpp b/source/shoh/src/threads/master/Master.cpp new file mode 100644 index 0000000..62e4e0a --- /dev/null +++ b/source/shoh/src/threads/master/Master.cpp @@ -0,0 +1,22 @@ +/* + * Master.cpp + * + * Created on: 4 Apr 2023 + * Author: tylen + */ + +#include "Master.h" + +void Master::taskFunction() { + bool LedState = true; + for (;;) { + Board_LED_Set(led, LedState); + LedState = (bool) !LedState; + led++; + if(led > 2){ + led = 0; + } + vTaskDelay(1000); + } +} + diff --git a/source/shoh/src/threads/master/Master.h b/source/shoh/src/threads/master/Master.h new file mode 100644 index 0000000..fa22b83 --- /dev/null +++ b/source/shoh/src/threads/master/Master.h @@ -0,0 +1,34 @@ +/* + * Master.h + * + * Created on: 4 Apr 2023 + * Author: tylen + */ + +#ifndef THREADS_MASTER_MASTER_H_ +#define THREADS_MASTER_MASTER_H_ + +#include "chip.h" +#include "board.h" +#include "FreeRTOSCPP/Task.hpp" +#include "FreeRTOSCPP/Kernel.hpp" +#include "task.h" + + +class Master : public FreeRTOS::Task { +public: + Master(): FreeRTOS::Task((tskIDLE_PRIORITY + 1UL), + configMINIMAL_STACK_SIZE * 10, + "master"){}; + virtual ~Master() = default; + + Master(Master&&) noexcept = default; + Master& operator=(Master&&) noexcept = default; + + void taskFunction(); +private: + int led; +}; + + +#endif /* THREADS_MASTER_MASTER_H_ */