2020-04-15 03:22:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-06-17 00:01:50 +00:00
|
|
|
// The FreeRTOS includes are in a different directory on ESP32 and I can't figure out how to make that work with platformio gcc
|
|
|
|
// options so this is my quick hack to make things work
|
2020-04-15 03:22:27 +00:00
|
|
|
|
2020-09-04 22:03:22 +00:00
|
|
|
#if defined(ARDUINO_ARCH_ESP32)
|
2020-06-17 00:01:50 +00:00
|
|
|
#define HAS_FREE_RTOS
|
2020-09-04 22:03:22 +00:00
|
|
|
|
2020-04-15 03:22:27 +00:00
|
|
|
#include <freertos/FreeRTOS.h>
|
|
|
|
#include <freertos/queue.h>
|
2020-06-17 00:01:50 +00:00
|
|
|
#include <freertos/semphr.h>
|
|
|
|
#include <freertos/task.h>
|
2020-09-04 22:03:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(ARDUINO_NRF52_ADAFRUIT)
|
2020-06-17 00:01:50 +00:00
|
|
|
#define HAS_FREE_RTOS
|
2020-09-04 22:03:22 +00:00
|
|
|
|
2020-04-15 03:22:27 +00:00
|
|
|
#include <FreeRTOS.h>
|
|
|
|
#include <queue.h>
|
2020-06-17 00:01:50 +00:00
|
|
|
#include <semphr.h>
|
|
|
|
#include <task.h>
|
2020-09-04 22:03:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAS_FREE_RTOS
|
|
|
|
|
|
|
|
// Include real FreeRTOS defs above
|
|
|
|
|
2020-06-17 00:01:50 +00:00
|
|
|
#else
|
|
|
|
|
2020-09-04 22:03:22 +00:00
|
|
|
// Include placeholder fake FreeRTOS defs
|
|
|
|
|
2020-06-17 00:01:50 +00:00
|
|
|
#include <Arduino.h>
|
|
|
|
|
|
|
|
typedef uint32_t TickType_t;
|
|
|
|
typedef uint32_t BaseType_t;
|
|
|
|
|
|
|
|
#define portMAX_DELAY UINT32_MAX
|
|
|
|
|
2020-09-04 22:03:22 +00:00
|
|
|
#define tskIDLE_PRIORITY 0
|
2020-09-05 00:23:17 +00:00
|
|
|
#define configMAX_PRIORITIES 10 // Highest priority level
|
|
|
|
|
|
|
|
// Don't do anything on non free rtos platforms when done with the ISR
|
|
|
|
#define portYIELD_FROM_ISR(x)
|
|
|
|
|
2020-09-05 19:34:48 +00:00
|
|
|
enum eNotifyAction { eNoAction, eSetValueWithoutOverwrite, eSetValueWithOverwrite };
|
2020-09-04 22:03:22 +00:00
|
|
|
|
2020-06-06 00:30:09 +00:00
|
|
|
#endif
|