threads: add master skeleton

This commit is contained in:
Vasily Davydov
2023-04-05 00:09:58 +03:00
parent 9fb78d03ff
commit 6cfe14b3fe
4 changed files with 84 additions and 51 deletions

View 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);
}
}

View 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_ */