Skip to content

Commit 7bfd800

Browse files
committed
A big rework of the source/sink system.
1 parent 318d7ff commit 7bfd800

File tree

15 files changed

+159
-141
lines changed

15 files changed

+159
-141
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
void setup() {
1+
void setup()
2+
{
23
Serial.begin(115200);
34
while (!Serial) { }
45

56
Producer.start();
67
Consumer.start();
78
}
89

9-
void loop() {
10+
void loop()
11+
{
1012
rtos::ThisThread::yield();
1113
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
SINK(counter, int);
2+
3+
void setup()
4+
{
5+
6+
}
7+
8+
void loop()
9+
{
10+
Serial.println(counter.read());
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* This examples demonstrates the SOURCE/SINK abstraction.
3+
* Each thread may have any number of SOURCES and SINKS that can be connected
4+
* together using the "connectTo" method.
5+
*/
6+
7+
void setup()
8+
{
9+
Producer.counter.connectTo(Consumer.counter);
10+
Producer.start();
11+
Consumer.start();
12+
}
13+
14+
void loop() {
15+
rtos::ThisThread::yield();
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SOURCE(counter, int);
2+
3+
void setup()
4+
{
5+
6+
}
7+
8+
void loop()
9+
{
10+
static int i = 0;
11+
counter.write(i);
12+
i++;
13+
}

examples/Demo_Source_Sink_LED/SharedVariables.h

Whitespace-only changes.

0 commit comments

Comments
 (0)