Skip to content

Commit 18314e6

Browse files
committed
v0.1.1
1 parent 31a644a commit 18314e6

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 chrmlinux03
3+
Copyright (c) 2022 chrmlinux
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
A mechanism to easily describe multi-core
33
# v0.0.1
44
Test version released
5+
# v0.1.1
6+
Enabled to specify the core to run behind the scenes.
7+
Name the function
8+
to setup0-> setupN
9+
to loop0-> loopN
10+
changed.

doc/task0.JPG

82.2 KB
Loading

doc/task1.JPG

67 KB
Loading

examples/1st/1st.ino

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ static tinyCore tc;
33

44
void setup(void) {
55
Serial.begin( 115200 ); while (!Serial);
6-
tc.begin();
7-
8-
Serial.println("c1 start");
6+
tc.begin(TINYCORE0); // is tc.begin();
7+
// tc.begin(TINYCORE1);
8+
Serial.print("c"); Serial.print(xPortGetCoreID()); Serial.println(" start");
99
}
1010

1111
void loop(void) {
1212
static uint8_t i = 0;
13-
Serial.print("c1 "); Serial.println(i);
13+
Serial.print("c"); Serial.print(xPortGetCoreID()); Serial.print(" "); Serial.println(i);
1414
i++;
15+
delay(1);
1516
}
1617

17-
void setup0(void) {
18-
Serial.println("c0 start");
19-
18+
void setupN(void) {
19+
Serial.print("c"); Serial.print(xPortGetCoreID()); Serial.println(" start");
2020
}
2121

22-
void loop0(void) {
22+
void loopN(void) {
2323
static uint8_t i = 0;
24-
Serial.print("c0 "); Serial.println(i);
24+
Serial.print("c"); Serial.print(xPortGetCoreID()); Serial.print(" "); Serial.println(i);
2525
i++;
26-
26+
delay(1);
2727
}

keywords.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
tinyCore KEYWORD1 tinyCore
2-
tinyCore KEYWORD1 tc
2+
tc KEYWORD1 tinyCore
33
loop0 KEYWORD1 tinyCore
44
setup0 KEYWORD1 tinyCore
55

src/tinyCore.hpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
1+
//=======================================================================
2+
// program name : tinyCore.hpp
3+
// date/author : 2022/06/20 @chrmlinux03
4+
// update/author : 2022/06/20 @chrmlinux03
5+
// license : mit
6+
//=======================================================================
7+
18
#ifndef __TINYCORE_HPP__
29
#define __TINYCORE_HPP__
310

11+
enum {TINYCORE0 = 0, TINYCORE1};
12+
413
#include <Arduino.h>
514

6-
void loop0(void);
7-
void setup0(void);
15+
void loopN(void);
16+
void setupN(void);
817
static TaskHandle_t pBehindTask = NULL;
918
static volatile bool bBehindTaskEnd = false;
1019

1120
void BehindTask(void *param) {
1221
while (!bBehindTaskEnd) {
13-
loop0();
22+
loopN();
1423
yield();
1524
}
1625
vTaskDelete(pBehindTask);
1726
}
1827

1928
class tinyCore {
2029
public:
30+
void begin(uint16_t core) {
31+
_core = core;
32+
begin();
33+
}
34+
2135
void begin(void) {
22-
setup0();
36+
setupN();
2337
xTaskCreatePinnedToCore(BehindTask, "BehindTask", 8192, NULL, 1, NULL, _core);
2438
}
39+
2540
void end(void) {
2641
bBehindTaskEnd = true;
2742
}

0 commit comments

Comments
 (0)