FreeRTOS f*ckery
This commit is contained in:
parent
4e45521e52
commit
4e9d7b1334
8 changed files with 122 additions and 13 deletions
|
@ -17,11 +17,24 @@
|
|||
|
||||
using namespace f4ll_cpp;
|
||||
|
||||
TaskHandle_t g_handle;
|
||||
StaticTask_t g_tcb;
|
||||
StackType_t g_stack[200];
|
||||
|
||||
void TaskFn(void * param)
|
||||
{
|
||||
for(;;) {
|
||||
vTaskDelay(100);
|
||||
}
|
||||
}
|
||||
|
||||
void MainLoop()
|
||||
{
|
||||
Application m;
|
||||
|
||||
m.Loop();
|
||||
// Application m;
|
||||
//
|
||||
// m.Start();
|
||||
g_handle = xTaskCreateStatic(TaskFn, "lofasz", sizeof(g_stack)/sizeof(g_stack[0]),
|
||||
nullptr, 5, g_stack, &g_tcb);
|
||||
}
|
||||
|
||||
#define CMD_X_READ 0b10010000
|
||||
|
@ -51,10 +64,16 @@ uint16_t ReadTouch(SPI_TypeDef *spi, bool x)
|
|||
|
||||
Application::Application()
|
||||
: GlobalsInitializer(&m_console)
|
||||
, Task(3)
|
||||
, m_console(USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7, this, nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void Application::TaskFn(void *taskObj)
|
||||
{
|
||||
static_cast<Application*>(reinterpret_cast<fsl::Task<Application, 1024>*>(taskObj))->Loop();
|
||||
}
|
||||
|
||||
void Application::Loop()
|
||||
{
|
||||
Ili9341Fsmc &lcd(Ili9341Fsmc::Init(nullptr, nullptr, DMA2, LL_DMA_STREAM_4, false));
|
||||
|
|
|
@ -20,6 +20,7 @@ void MainLoop();
|
|||
|
||||
#if defined(__cplusplus)
|
||||
#include <f4ll_cpp/serialconsole.h>
|
||||
#include <fsl/task.h>
|
||||
#include "globals.h"
|
||||
|
||||
struct GlobalsInitializer {
|
||||
|
@ -28,14 +29,21 @@ struct GlobalsInitializer {
|
|||
}
|
||||
};
|
||||
|
||||
class Application : public GlobalsInitializer, public f4ll_cpp::SerialConsole<257>::ISerialConsoleCallback {
|
||||
class Application : public GlobalsInitializer
|
||||
, public f4ll_cpp::SerialConsole<257>::ISerialConsoleCallback
|
||||
, public fsl::Task<Application, 1024>
|
||||
{
|
||||
public:
|
||||
Application();
|
||||
void Loop();
|
||||
|
||||
friend class fsl::Task<Application, 1024>;
|
||||
private:
|
||||
static void TaskFn(void *taskObj);
|
||||
|
||||
virtual void LineReceived(void *userParam, f4ll_cpp::SerialConsole<257>::Buffer *buffer);
|
||||
virtual void TransmissionComplete(void *userParam, f4ll_cpp::SerialConsole<257>::Buffer *buffer);
|
||||
virtual char const * getName() { return "Application"; }
|
||||
|
||||
f4ll_cpp::SerialConsole<257> m_console;
|
||||
volatile bool m_lineReceived = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue