Skip to content

Commit 44c2c74

Browse files
authored
Merge pull request #27 from bcmi-labs/pretty-the-horse-up
Cleanup and refactor library
2 parents d017a0d + de2a0d4 commit 44c2c74

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+636
-1488
lines changed

.github/workflows/compile-examples.yml

+17-18
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,14 @@ env:
2626

2727
jobs:
2828
compile-test:
29-
name: compile for ${{ matrix.fqbn }}
29+
name: ${{ matrix.board.fqbn }}
3030
runs-on: ubuntu-latest
3131

3232
env:
3333
# libraries to install for all boards
3434
UNIVERSAL_LIBRARIES: |
35-
# Install the ArduinoThreads library from the repository
35+
# Install the Arduino_Threads library from the repository
3636
- source-path: ./
37-
- name: Arduino_LSM9DS1
38-
- name: Arduino_APDS9960
39-
- name: ArduinoECCX08
40-
- name: Arduino_HTS221
41-
- name: OneWire
4237
# sketch paths to compile (recursive) for all boards
4338
UNIVERSAL_SKETCH_PATHS: |
4439
- examples
@@ -49,10 +44,19 @@ jobs:
4944
fail-fast: false
5045

5146
matrix:
52-
fqbn:
53-
- "arduino:mbed:nano33ble"
54-
# - "arduino:mbed:envie_m4"
55-
- "arduino:mbed:envie_m7"
47+
board:
48+
- fqbn: arduino:mbed_nano:nano33ble
49+
platforms: |
50+
- name: arduino:mbed_nano
51+
- fqbn: arduino:mbed_nano:nanorp2040connect
52+
platforms: |
53+
- name: arduino:mbed_nano
54+
- fqbn: arduino:mbed_portenta:envie_m4
55+
platforms: |
56+
- name: arduino:mbed_portenta
57+
- fqbn: arduino:mbed_portenta:envie_m7
58+
platforms: |
59+
- name: arduino:mbed_portenta
5660
5761
steps:
5862
- name: Checkout
@@ -83,15 +87,10 @@ jobs:
8387
uses: arduino/compile-sketches@v1
8488
with:
8589
cli-version: 'arduino_threads'
86-
fqbn: ${{ matrix.fqbn }}
90+
fqbn: ${{ matrix.board.fqbn }}
8791
libraries: |
8892
${{ env.UNIVERSAL_LIBRARIES }}
89-
platforms: |
90-
# Use Board Manager to install the latest release of Arduino mbed Boards to get the toolchain
91-
- name: "arduino:mbed"
92-
# Overwrite the Board Manager installation with the local platform
93-
- source-path: "extras/ArduinoCore-mbed"
94-
name: "arduino:mbed"
93+
platforms: ${{ matrix.board.platforms }}
9594
sketch-paths: |
9695
${{ env.UNIVERSAL_SKETCH_PATHS }}
9796
enable-deltas-report: 'true'

examples/Blocks/Blocks.ino

-22
This file was deleted.

examples/Blocks/data_reader.inot

-12
This file was deleted.

examples/Blocks/data_writer.inot

-21
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
void setup() {
2+
3+
}
4+
5+
void loop() {
6+
Serial.println(counter);
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
void setup()
2+
{
3+
Serial.begin(115200);
4+
while (!Serial) { }
5+
6+
Producer.start();
7+
Consumer.start();
8+
}
9+
10+
void loop()
11+
{
12+
rtos::ThisThread::yield();
13+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
void setup() {
2+
3+
}
4+
5+
void loop() {
6+
static int i = 0;
7+
counter = i;
8+
i++;
9+
delay(100);
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SHARED(counter, int);
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+
}
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+
}
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
Source_Thread.led.connectTo(Sink_Thread.led);
9+
Sink_Thread.start();
10+
Source_Thread.start();
11+
}
12+
13+
void loop() {
14+
rtos::ThisThread::yield();
15+
}

examples/Demo_Source_Sink_LED/SharedVariables.h

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
/*
3+
* An 'bool' SINK with a size of '0'. This kind of SINK has no buffer so the reading thread
4+
* will block until the writing thread has written something, or vice versa.
5+
*/
6+
SINK(led, bool);
7+
8+
void setup()
9+
{
10+
pinMode(LED_BUILTIN, OUTPUT);
11+
}
12+
13+
void loop()
14+
{
15+
/* Read a 'bool' from the SINK and discard it. Since there is basically no delay in the loop
16+
* this call will surely block until something comes from the connected SOURCE. In this case
17+
* the pace is dictated by the SOURCE that sends data every 100 ms.
18+
*/
19+
bool led_on = led.read();
20+
digitalWrite(LED_BUILTIN, led_on);
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* The output SOURCE, it sends 'bool' values. */
2+
SOURCE(led, bool);
3+
4+
void setup()
5+
{
6+
7+
}
8+
9+
void loop()
10+
{
11+
led.write(true);
12+
delay(100);
13+
led.write(false);
14+
delay(100);
15+
}

examples/Enqueue_test/Enqueue.inot

-13
This file was deleted.

examples/Enqueue_test/Enqueue_test.ino

-15
This file was deleted.

examples/Enqueue_test/SharedVariables.h

-1
This file was deleted.

examples/Leds/Leds.ino

-13
This file was deleted.

examples/Leds/SharedVariables.h

-1
This file was deleted.

examples/Leds/ledblue.inot

-10
This file was deleted.

examples/Nano33BLEMegaSketch/Accelerometer.inot

-50
This file was deleted.

0 commit comments

Comments
 (0)