Merge remote-tracking branch 'origin/task_prep'
This commit is contained in:
commit
409fb44d2c
@ -43,6 +43,7 @@
|
|||||||
<option id="com.crt.advproject.cpp.fpu.1211390952" name="Floating point" superClass="com.crt.advproject.cpp.fpu" useByScannerDiscovery="true"/>
|
<option id="com.crt.advproject.cpp.fpu.1211390952" name="Floating point" superClass="com.crt.advproject.cpp.fpu" useByScannerDiscovery="true"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.417443680" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.include.paths.417443680" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_board_nxp_lpcxpresso_11u68/inc}""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/lpc_chip_11u6x/inc}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/shoh/freertos/inc}""/>
|
||||||
@ -275,31 +276,31 @@
|
|||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="com.crt.config">
|
<storageModule moduleId="com.crt.config">
|
||||||
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
<projectStorage><?xml version="1.0" encoding="UTF-8"?>
|
||||||
<TargetConfig>
|
<TargetConfig>
|
||||||
<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
|
<Properties property_2="LPC11U6x_256K.cfx" property_3="NXP" property_4="LPC11U68" property_count="5" version="100300"/>
|
||||||
<infoList vendor="NXP">
|
<infoList vendor="NXP">
|
||||||
<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
|
<info chip="LPC11U68" flash_driver="LPC11U6x_256K.cfx" match_id="0x0" name="LPC11U68" stub="crt_emu_cm3_gen">
|
||||||
<chip>
|
<chip>
|
||||||
<name>LPC11U68</name>
|
<name>LPC11U68</name>
|
||||||
<family>LPC11U6x</family>
|
<family>LPC11U6x</family>
|
||||||
<vendor>NXP (formerly Philips)</vendor>
|
<vendor>NXP (formerly Philips)</vendor>
|
||||||
<reset board="None" core="Real" sys="Real"/>
|
<reset board="None" core="Real" sys="Real"/>
|
||||||
<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
|
<clock changeable="TRUE" freq="12MHz" is_accurate="TRUE"/>
|
||||||
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
|
<memory can_program="true" id="Flash" is_ro="true" type="Flash"/>
|
||||||
<memory id="RAM" type="RAM"/>
|
<memory id="RAM" type="RAM"/>
|
||||||
<memory id="Periph" is_volatile="true" type="Peripheral"/>
|
<memory id="Periph" is_volatile="true" type="Peripheral"/>
|
||||||
<memoryInstance derived_from="Flash" id="MFlash256" location="0x0" size="0x40000"/>
|
<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="Ram0_32" location="0x10000000" size="0x8000"/>
|
||||||
<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
|
<memoryInstance derived_from="RAM" id="Ram1_2" location="0x20000000" size="0x800"/>
|
||||||
<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
|
<memoryInstance derived_from="RAM" id="Ram2USB_2" location="0x20004000" size="0x800"/>
|
||||||
</chip>
|
</chip>
|
||||||
<processor>
|
<processor>
|
||||||
<name gcc_name="cortex-m0">Cortex-M0</name>
|
<name gcc_name="cortex-m0">Cortex-M0</name>
|
||||||
<family>Cortex-M</family>
|
<family>Cortex-M</family>
|
||||||
</processor>
|
</processor>
|
||||||
</info>
|
</info>
|
||||||
</infoList>
|
</infoList>
|
||||||
</TargetConfig></projectStorage>
|
</TargetConfig></projectStorage>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="com.crt.advproject">
|
<storageModule moduleId="com.crt.advproject">
|
||||||
|
|||||||
@ -4,38 +4,14 @@
|
|||||||
#include "task.h"
|
#include "task.h"
|
||||||
#include <cr_section_macros.h>
|
#include <cr_section_macros.h>
|
||||||
#include "FreeRTOSCPP/Kernel.hpp"
|
#include "FreeRTOSCPP/Kernel.hpp"
|
||||||
#include "FreeRTOSCPP/Task.hpp"
|
#include "threads/master/Master.h"
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
Board_Init();
|
Board_Init();
|
||||||
// Create a task before starting the kernel.
|
// Create a task before starting the kernel.
|
||||||
LedTask task1((tskIDLE_PRIORITY + 1UL), "vTaskLed1");
|
Master master;
|
||||||
|
|
||||||
// Start the real time kernel with preemption.
|
// Start the real time kernel with preemption.
|
||||||
FreeRTOS::Kernel::startScheduler();
|
FreeRTOS::Kernel::startScheduler();
|
||||||
|
|||||||
22
source/shoh/src/threads/master/Master.cpp
Normal file
22
source/shoh/src/threads/master/Master.cpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
34
source/shoh/src/threads/master/Master.h
Normal file
34
source/shoh/src/threads/master/Master.h
Normal file
@ -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_ */
|
||||||
Loading…
x
Reference in New Issue
Block a user