Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
arkhipenko committed Dec 17, 2021
2 parents fadff97 + 635cfd5 commit 776cb42
Show file tree
Hide file tree
Showing 17 changed files with 891 additions and 222 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Task Scheduler
### Cooperative multitasking for Arduino, ESPx, STM32 and other microcontrollers
#### Version 3.4.0: 2021-07-14 [Latest updates](https://github.com/arkhipenko/TaskScheduler/wiki/Latest-Updates)
#### Version 3.6.0: 2021-12-17 [Latest updates](https://github.com/arkhipenko/TaskScheduler/wiki/Latest-Updates)

[![arduino-library-badge](https://www.ardu-badge.com/badge/TaskScheduler.svg?)](https://www.ardu-badge.com/TaskScheduler)[![xscode](https://img.shields.io/badge/Available%20on-xs%3Acode-blue?style=?style=plastic&logo=appveyor&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF////////VXz1bAAAAAJ0Uk5T/wDltzBKAAAAlUlEQVR42uzXSwqAMAwE0Mn9L+3Ggtgkk35QwcnSJo9S+yGwM9DCooCbgn4YrJ4CIPUcQF7/XSBbx2TEz4sAZ2q1RAECBAiYBlCtvwN+KiYAlG7UDGj59MViT9hOwEqAhYCtAsUZvL6I6W8c2wcbd+LIWSCHSTeSAAECngN4xxIDSK9f4B9t377Wd7H5Nt7/Xz8eAgwAvesLRjYYPuUAAAAASUVORK5CYII=)](https://xscode.com/arkhipenko/TaskScheduler)

Expand Down Expand Up @@ -34,6 +34,7 @@ _“Everybody who learns concurrency and thinks they understand it, ends up find
13. CPU load / idle statistics for time critical applications
14. Scheduling options with priority for original schedule (with and without catchup) and interval
15. Ability to pause/resume and enable/disable scheduling
15. Thread-safe scheduling while running under preemptive scheduler (i. e., FreeRTOS)

Scheduling overhead: between `15` and `18` microseconds per scheduling pass (Arduino UNO rev 3 @ `16MHz` clock, single scheduler w/o prioritization)

Expand Down
5 changes: 5 additions & 0 deletions examples/Scheduler_example27_PlatformIO/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}
39 changes: 39 additions & 0 deletions examples/Scheduler_example27_PlatformIO/include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
12 changes: 12 additions & 0 deletions examples/Scheduler_example27_PlatformIO/include/led.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _TS27_LED_H
#define _TS27_LED_H

// LED_BUILTIN 13
#if defined( ARDUINO_ARCH_ESP32 )
#define LED_BUILTIN 23 // esp32 dev2 kit does not have LED
#endif

void LEDOff();
void LEDOn();

#endif // _TS27_LED_H
27 changes: 27 additions & 0 deletions examples/Scheduler_example27_PlatformIO/include/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef _TS27_MAIN_H
#define _TS27_MAIN_H

#include <Arduino.h>

#ifdef _DEBUG_
#define _PP(a) Serial.print(a);
#define _PL(a) Serial.println(a);
#else
#define _PP(a)
#define _PL(a)
#endif

#define PERIOD1 500
#define DURATION 10000

#define PERIOD2 400

#define PERIOD3 300

#define PERIOD4 200

#define PERIOD5 600

#define PERIOD6 300

#endif
46 changes: 46 additions & 0 deletions examples/Scheduler_example27_PlatformIO/lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
38 changes: 38 additions & 0 deletions examples/Scheduler_example27_PlatformIO/platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino

[env]
lib_deps =
arkhipenko/TaskScheduler @ ^3.4.0

build_flags =
; -D _TASK_TIMECRITICAL
-D _TASK_SLEEP_ON_IDLE_RUN
-D _TASK_STATUS_REQUEST
; -D _TASK_WDT_IDS
; -D _TASK_LTS_POINTER
; -D _TASK_PRIORITY
; -D _TASK_MICRO_RES
; -D _TASK_STD_FUNCTION
; -D _TASK_DEBUG
; -D _TASK_INLINE
; -D _TASK_TIMEOUT
; -D _TASK_OO_CALLBACKS
; -D _TASK_EXPOSE_CHAIN
; -D _TASK_SCHEDULING_OPTIONS
; -D _TASK_DEFINE_MILLIS
; -D _TASK_EXTERNAL_TIME
-D _DEBUG_
; -D _TEST_
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <TaskScheduler.h>
11 changes: 11 additions & 0 deletions examples/Scheduler_example27_PlatformIO/src/led.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <Arduino.h>
#include "led.h"
#include "main.h"

void LEDOn() {
digitalWrite( LED_BUILTIN, HIGH );
}

void LEDOff() {
digitalWrite( LED_BUILTIN, LOW );
}
Loading

0 comments on commit 776cb42

Please sign in to comment.