Example ipc (#60)

* add blank example

* add ipc example code, need to change FURI API

* add ipc example code, need to change FURI API

* change core API, add context

* check handler at take

* fix important bugs in furi

* drawing example

* add posix mq

* fix unsigned demo counter

* create at open

* working local demo

* russian version of IPC example

* english version

* add gif
This commit is contained in:
coreglitch
2020-09-01 16:34:23 +06:00
committed by GitHub
parent f7882dbff4
commit 5b6ab7faf3
16 changed files with 538 additions and 33 deletions

View File

@@ -1,3 +1,5 @@
#pragma once
#include "main.h"
#include <stdbool.h>
@@ -5,12 +7,33 @@ void osDelay(uint32_t ms);
// some FreeRTOS types
typedef void(*TaskFunction_t)(void*);
typedef uint32_t UBaseType_t;
typedef size_t UBaseType_t;
typedef uint32_t StackType_t;
typedef uint32_t StaticTask_t;
typedef pthread_t* TaskHandle_t;
typedef uint32_t StaticSemaphore_t;
typedef void* SemaphoreHandle_t;
typedef enum {
SemaphoreTypeCounting
} SemaphoreType;
typedef struct {
SemaphoreType type;
uint8_t take_counter;
uint8_t give_counter;
} StaticSemaphore_t;
typedef StaticSemaphore_t* SemaphoreHandle_t;
typedef uint32_t StaticQueue_t;
typedef StaticQueue_t* QueueHandle_t;
#define portMAX_DELAY -1
typedef enum {
pdTRUE = 1,
pdFALSE = 0
} BaseType_t;
typedef int32_t TickType_t;
#define tskIDLE_PRIORITY 0
@@ -28,3 +51,24 @@ void vTaskDelete(TaskHandle_t xTask);
TaskHandle_t xTaskGetCurrentTaskHandle(void);
SemaphoreHandle_t xSemaphoreCreateMutexStatic(StaticSemaphore_t* pxMutexBuffer);
bool task_equal(TaskHandle_t a, TaskHandle_t b);
QueueHandle_t xQueueCreateStatic(
UBaseType_t uxQueueLength,
UBaseType_t uxItemSize,
uint8_t* pucQueueStorageBuffer,
StaticQueue_t* pxQueueBuffer
);
SemaphoreHandle_t xSemaphoreCreateCountingStatic(
UBaseType_t uxMaxCount,
UBaseType_t uxInitialCount,
StaticSemaphore_t *pxSemaphoreBuffer
);
BaseType_t xSemaphoreTake(SemaphoreHandle_t xSemaphore, TickType_t xTicksToWait);
BaseType_t xSemaphoreGive(SemaphoreHandle_t xSemaphore);
BaseType_t xQueueSend(
QueueHandle_t xQueue, const void * pvItemToQueue, TickType_t xTicksToWait
);
BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait);