Skip to content

Commit 31a644a

Browse files
committed
1st
1 parent f443cd6 commit 31a644a

File tree

5 files changed

+80
-0
lines changed

5 files changed

+80
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# tinyCore
2+
A mechanism to easily describe multi-core
3+
# v0.0.1
4+
Test version released

examples/1st/1st.ino

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <tinyCore.hpp>
2+
static tinyCore tc;
3+
4+
void setup(void) {
5+
Serial.begin( 115200 ); while (!Serial);
6+
tc.begin();
7+
8+
Serial.println("c1 start");
9+
}
10+
11+
void loop(void) {
12+
static uint8_t i = 0;
13+
Serial.print("c1 "); Serial.println(i);
14+
i++;
15+
}
16+
17+
void setup0(void) {
18+
Serial.println("c0 start");
19+
20+
}
21+
22+
void loop0(void) {
23+
static uint8_t i = 0;
24+
Serial.print("c0 "); Serial.println(i);
25+
i++;
26+
27+
}

keywords.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tinyCore KEYWORD1 tinyCore
2+
tinyCore KEYWORD1 tc
3+
loop0 KEYWORD1 tinyCore
4+
setup0 KEYWORD1 tinyCore
5+
6+
begin KEYWORD2
7+
end KEYWORD2

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=tinyCore
2+
version=0.0.1
3+
author=@chrmlinux03
4+
maintainer=@chrmlinux03
5+
sentence=A mechanism to easily describe multi-core.
6+
paragraph=a library to A mechanism to easily describe multi-core.
7+
category=Data Processing
8+
url=https://github.com/chrmlinux/tinyCore
9+
architectures=esp32

src/tinyCore.hpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef __TINYCORE_HPP__
2+
#define __TINYCORE_HPP__
3+
4+
#include <Arduino.h>
5+
6+
void loop0(void);
7+
void setup0(void);
8+
static TaskHandle_t pBehindTask = NULL;
9+
static volatile bool bBehindTaskEnd = false;
10+
11+
void BehindTask(void *param) {
12+
while (!bBehindTaskEnd) {
13+
loop0();
14+
yield();
15+
}
16+
vTaskDelete(pBehindTask);
17+
}
18+
19+
class tinyCore {
20+
public:
21+
void begin(void) {
22+
setup0();
23+
xTaskCreatePinnedToCore(BehindTask, "BehindTask", 8192, NULL, 1, NULL, _core);
24+
}
25+
void end(void) {
26+
bBehindTaskEnd = true;
27+
}
28+
29+
private:
30+
uint16_t _core = 0;
31+
};
32+
33+
#endif

0 commit comments

Comments
 (0)