Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 120e1a9

Browse files
committedJan 28, 2025·
Fix typos in documentation
The "codespell" spellchecker tool is used to automatically detect commonly misspelled words in the files of this project. The misspelled words dictionary was expanded in the latest release of codespell, which resulted in the detection of a misspelled word in the project's comments: > Error: ./docs/threadsafe-serial.md:51: pre-emptive ==> preemptive > Codespell found one or more problems The typo is hereby corrected, which will restore the spell check to a passing state. --- I supplemented the correction of the automatically detected typo with a general review of the documentation content, fixing the additional typos I identified during that review.
1 parent 1aa4dd6 commit 120e1a9

24 files changed

+66
-66
lines changed
 

‎.github/workflows/compile-examples.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,22 @@ jobs:
6868

6969
# it's necessary to checkout the platform before installing it so that the ArduinoCore-API dependency can be added
7070
- name: Checkout ArduinoCore-mbed
71-
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
71+
# this step only needed when the Arduino Mbed OS Boards platform sourced from the repository is being used
7272
uses: actions/checkout@v4
7373
with:
7474
repository: arduino/ArduinoCore-mbed
75-
# the arduino/actions/libraries/compile-examples action will install the platform from this path
75+
# the arduino/compile-sketches action will install the platform from this path
7676
path: ${{ env.ARDUINOCORE_MBED_STAGING_PATH }}
7777

7878
- name: Checkout ArduinoCore-API
79-
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
79+
# this step only needed when the Arduino Mbed OS Boards platform sourced from the repository is being used
8080
uses: actions/checkout@v4
8181
with:
8282
repository: arduino/ArduinoCore-API
8383
path: ${{ env.ARDUINOCORE_API_STAGING_PATH }}
8484

8585
- name: Install ArduinoCore-API
86-
# this step only needed when the Arduino mbed-Enabled Boards platform sourced from the repository is being used
86+
# this step only needed when the Arduino Mbed OS Boards platform sourced from the repository is being used
8787
run: |
8888
mv "${{ env.ARDUINOCORE_API_STAGING_PATH }}/api" "${{ env.ARDUINOCORE_MBED_STAGING_PATH }}/cores/arduino"
8989

‎README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
[![Check Arduino status](https://github.com/arduino-libraries/Arduino_Threads/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Threads/actions/workflows/check-arduino.yml)
99
[![Spell Check status](https://github.com/arduino-libraries/Arduino_Threads/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_Threads/actions/workflows/spell-check.yml)
1010

11-
This library makes it easy to use the multi-threading capability of [Arduino](https://www.arduino.cc/) boards that use an [Mbed OS](https://os.mbed.com/docs/mbed-os/latest/introduction/index.html)-based core library. Additionally this library provides thread-safe access to `Wire`, `SPI` and `Serial` which is relevant when creating multi-threaded sketches in order to avoid common pitfalls such as race-conditions and invalid state.
11+
This library makes it easy to use the multi-threading capability of [Arduino](https://www.arduino.cc/) boards that use an [Mbed OS](https://os.mbed.com/docs/mbed-os/latest/introduction/index.html)-based core library. Additionally this library provides thread-safe access to `Wire`, `SPI` and `Serial` which is relevant when creating multi-threaded sketches in order to avoid common pitfalls such as race-conditions and invalid state.
1212

13-
Preeliminary **documentation** and download links for **required tooling** are available within the [`/docs`](docs/README.md) subfolder.
13+
Preliminary **documentation** and download links for **required tooling** are available within the [`/docs`](docs/README.md) subfolder.
1414

1515
## :star: Features
1616
### :thread: Multi-threaded sketch execution

‎docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`Arduino_Threads/docs`
44
======================
5-
The Arduino threading APIs brings multi-threading to the world of Arduino. If you're new to the concept of threads we suggest you have first a look at the [Threading Basics](threading-basics.md) document.
5+
The Arduino threading APIs bring multi-threading to the world of Arduino. If you're new to the concept of threads we suggest you first take a look at the [Threading Basics](threading-basics.md) document.
66

77
The following Arduino architectures and boards are currently supported:
88
* `mbed_portenta`: [Portenta H7](https://store.arduino.cc/products/portenta-h7)

‎docs/cli-getting-started.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
How to get started with the `Arduino CLI` and `Arduino_Threads`
44
===============================================================
55
## Introduction
6-
For now, you need to use the Arduino CLI to upload sketches made with the `Arduino_Threads` library. It can be intimidating at first, but once you get the hang of it, it is not that different from working in the IDE.
6+
For now, you need to use the Arduino CLI to upload sketches made with the `Arduino_Threads` library. It can be intimidating at first, but once you get the hang of it, it is not that different from working in the IDE.
77

8-
This document will help you get started, showing you how to find all the information you need to get off the ground without needing to go in depth and learn everything there is to know about the CLI.
8+
This document will help you get started, showing you how to find all the information you need to get off the ground without needing to go in depth and learn everything there is to know about the CLI.
99

10-
## Installing
11-
To use the `Arduino_Threads` library, a special version of the Arduino CLI needs to be downloaded and installed. Installing the Arduino CLI is really just as simple as downloading it and extracting the files from the .zip archive, once it is on your computer it is installed. However, to keep your workflow tidy and organized, we recommend moving it to a directory with a short path. If you have been using the Arduino IDE, most likely the files are stored in your `Documents` folder, so let's put the CLI files in the same place.
10+
## Installing
11+
To use the `Arduino_Threads` library, a special version of the Arduino CLI needs to be downloaded and installed. Installing the Arduino CLI is really just as simple as downloading it and extracting the files from the .zip archive, once it is on your computer it is installed. However, to keep your workflow tidy and organized, we recommend moving it to a directory with a short path. If you have been using the Arduino IDE, most likely the files are stored in your `Documents` folder, so let's put the CLI files in the same place.
1212

13-
Make a new folder in your `Documents` folder, and name it `CLI`, extract the files from the .zip archive to this folder.
13+
Make a new folder in your `Documents` folder, and name it `CLI`, extract the files from the .zip archive to this folder.
1414

1515
## Navigating With the Command Prompt and Launching the Arduino CLI
16-
Since the Arduino CLI is a command line tool, it is not a program that you can launch by double clicking on the `.exe` file. Instead, we need to start it from the command prompt. Using the command prompt can be thought of like using the file explorer, you are in a folder, can move around to other folders, create new files, delete files, etc. The difference is that you do all of these things with commands instead of buttons.
16+
Since the Arduino CLI is a command line tool, it is not a program that you can launch by double clicking on the `.exe` file. Instead, we need to start it from the command prompt. Using the command prompt can be thought of like using the file explorer, you are in a folder, can move around to other folders, create new files, delete files, etc. The difference is that you do all of these things with commands instead of buttons.
1717

18-
Unlike the file explorer where you click the folder you want to go to, navigating in the command prompt is done by first writing the command letting the program know that we want to move somewhere new, then telling it where we want to go.
18+
Unlike the file explorer where you click the folder you want to go to, navigating in the command prompt is done by first writing the command letting the program know that we want to move somewhere new, then telling it where we want to go.
1919

2020
When you open up a command prompt window, you should be started in the root directory of your user profile, you can see in what folder you are by looking at the path text right where you enter your commands. Because you're started at the root of your user profile, the path should say `C:\Users\<your name>`
2121

22-
Inside of this root folder there are other folders, if you want to go into the `Documents` folder, instead of clicking on it like you would do in the file explorer, you write the command:
22+
Inside of this root folder there are other folders, if you want to go into the `Documents` folder, instead of clicking on it like you would do in the file explorer, you write the command:
2323
```
2424
cd Documents
2525
```
@@ -32,7 +32,7 @@ If you want to go back one step, to the folder you came from, you write this com
3232
```
3333
cd ..
3434
```
35-
But we don't need to do that now, we want to be inside of the `CLI` folder, that is inside of the `Documents` folder.
35+
But we don't need to do that now, we want to be inside of the `CLI` folder, that is inside of the `Documents` folder.
3636

3737
Navigate to it with the command:
3838
```
@@ -61,11 +61,11 @@ To compile sketches and to upload to your Arduino board, you need to know some i
6161
```
6262
arduino-cli board list
6363
```
64-
If your board was found, you will get a bunch of information about it. The information we're interested in is the `FQBN`, and the port. `FQBN` stands for "Fully Qualified Board Name", and is how the computer refers to the board. The port is like an address for the board.
64+
If your board was found, you will get a bunch of information about it. The information we're interested in is the `FQBN`, and the port. `FQBN` stands for "Fully Qualified Board Name", and is how the computer refers to the board. The port is like an address for the board.
6565

6666
![Board list](./assets/boardlist.png)
6767

68-
If you are, like we are, using an Arduino Nano 33 BLE Sense, the `FQBN` will be `arduino:mbed_nano:nano33ble`. We need to specify every time we are compiling and uploading sketches that they are to be compiled for this board, just like we do in the IDE.
68+
If you are, like we are, using an Arduino Nano 33 BLE Sense, the `FQBN` will be `arduino:mbed_nano:nano33ble`. We need to specify every time we are compiling and uploading sketches that they are to be compiled for this board, just like we do in the IDE.
6969

7070
## Installing Cores
7171
If you have already used your Arduino board with the IDE, you can skip this step entirely. Otherwise, there are some files you may need to install to be able to use the board. But don't worry, it's just one command. The Arduino Nano 33 BLE Sense uses the `arduino:mbed_nano` core, which is another piece of information that we got from the board list command we executed, so we need to install that before using the board.
@@ -79,32 +79,32 @@ arduino-cli core install arduino:mbed_nano
7979
If you are using a board with another core, replace `arduino:mbed_nano` in the command with whatever core you got from the board list.
8080

8181
## Make a Sketch
82-
Now it is time to either make a new sketch, or to place a sketch that you have already made or want to test in the `CLI` folder.
82+
Now it is time to either make a new sketch, or to place a sketch that you have already made or want to test in the `CLI` folder.
8383

8484
If you want to make a new sketch, use the command:
8585
```
8686
arduino-cli sketch new MySketch
8787
```
8888
and a new folder will be created inside of the `CLI` folder, this new folder is named `MySketch` and contains a file named `MySketch.ino`. This .ino file can be opened, and edited in your text-editor of choice. Once you are happy with the sketch, move on to the next step.
8989

90-
If you already have a sketch that you want to upload, find it and move it into the `CLI` folder. Be sure to move the folder containing the `.ino` file and any extra files included in the sketch, and not the `.ino` file on its own.
90+
If you already have a sketch that you want to upload, find it and move it into the `CLI` folder. Be sure to move the folder containing the `.ino` file and any extra files included in the sketch, and not the `.ino` file on its own.
9191

9292
## Compile and Upload
9393

9494
The final steps to do are to compile and to upload the sketch. We'll do this with two separate commands. To compile, we need to pass the FQBN in the command to specify what board we want to compile it for, and we need to tell it what sketch we want to compile. We'll compile the sketch we created earlier to be uploaded to an Arduino Nano 33 BLE Sense. We can do this with the command:
9595
```
96-
arduino-cli compile --fqbn arduino:mbed_nano:nano33ble MySketch
97-
```
98-
Once you execute this command, it's going to start compiling unless something went wrong. If it looks like nothing is happening - Great! That probably means that everything is going as it should. Depending on the core, compiling might take a few minutes. Be patient, it may seem like it's taking too long, but give it time. Eventually, you'll get a statement about the memory use, libraries included, and platform used.
96+
arduino-cli compile --fqbn arduino:mbed_nano:nano33ble MySketch
97+
```
98+
Once you execute this command, it's going to start compiling unless something went wrong. If it looks like nothing is happening - Great! That probably means that everything is going as it should. Depending on the core, compiling might take a few minutes. Be patient, it may seem like it's taking too long, but give it time. Eventually, you'll get a statement about the memory use, libraries included, and platform used.
9999

100100
![Compiled sketch statement](./assets/compiled.png)
101101

102102
Now that the sketch is compiled, let's upload it! For this, we need to specify the FQBN again, as well as the port the board is connected to, so it's uploaded to the right place. To find the port, go back to the board list we got earlier, ours is connected to port `COM14`, but replace this part of the command with whatever port your list says. Now execute the command:
103103
```
104104
arduino-cli upload -p COM14 --fqbn arduino:mbed_nano:nano33ble MySketch
105105
```
106-
If everything went as it should, the sketch is now uploading to the board, and once that is done, you've successfully used the Arduino CLI to upload a sketch to your board.
106+
If everything went as it should, the sketch is now uploading to the board, and once that is done, you've successfully used the Arduino CLI to upload a sketch to your board.
107107

108108
![Uploaded sketch](./assets/uploaded.png)
109109

110-
Now that you know how to do this, it might be a good opportunity to take the deep dive in the DIY-spirit, experiment with different workflows and interfaces for the terminal to tailor your Arduino experience to your liking.
110+
Now that you know how to do this, it might be a good opportunity to take the deep dive in the DIY-spirit, experiment with different workflows and interfaces for the terminal to tailor your Arduino experience to your liking.

‎docs/threading-basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Threading Basics
44
================
55
## Introduction
6-
Threading is a concept that is used on many operating systems to run tasks in parallel. An Arduino example of two such tasks could be to read the position of a potentiometer knob while controlling a servo motor to follow that position. Running such tasks in parallel is also called multitasking.
6+
Threading is a concept that is used on many operating systems to run tasks in parallel. An Arduino example of two such tasks could be to read the position of a potentiometer knob while controlling a servo motor to follow that position. Running such tasks in parallel is also called multitasking.
77

88
Previously Arduino sketches didn't support the concept of multitasking, unless you took specific measures to support it. With this so called single-threaded approach instructions in your Arduino sketch are executed sequentially one by one. If an instruction or a function call respectively makes the runtime environment wait for its execution to complete, it's called a "blocking" function. You may have encountered the limitations of this when interacting with multiple sensors and actuators at once. For example if you let a servo motor react to the data read from a potentiometer as mentioned above. While the servo motor is moving to its target position no further reading of the potentiometer can be done because the program waits until the servo is done moving. To solve this issue multitasking can be used which allows to "simultaneously" execute multiple task such as reading from a sensor and controlling a motor. In the context of multitasking a thread is basically a mechanism (provided usually by the operating system) to encapsulate a task to be run concurrently with others.
99

‎docs/threadsafe-serial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Thread-safe `Serial`
55
## Introduction
66
While both `SPI` and `Wire` are communication protocols which explicitly exist to facilitate communication between one server device and multiple client devices there are no such considerations for the `Serial` interface. `Serial` communication usually exists in a one-to-one mapping between two communication partners of equal power (both can initiate communication on their own right, there is no server/client relationship).
77

8-
One example would be an Arduino sketch sending AT commands to a modem over a Serial connection and interpreting the result of those commands. Another example would be a GPS unit sending NMEA encoded location data to the Arduino for parsing. In both cases the only sensible software representation for such functionality (AT command module or NMEA message parser) is a single thread. Also in both cases it is undesirable for other threads to inject other kind of data into the serial communication as this would only confuse i.e. the AT controlled modem which reads that data.
8+
One example would be an Arduino sketch sending AT commands to a modem over a Serial connection and interpreting the result of those commands. Another example would be a GPS unit sending NMEA encoded location data to the Arduino for parsing. In both cases the only sensible software representation for such functionality (AT command module or NMEA message parser) is a single thread. Also in both cases it is undesirable for other threads to inject other kind of data into the serial communication as this would only confuse i.e. the AT controlled modem which reads that data.
99

1010
A good example for multiple threads writing to `Serial` would be logging where mixing messages from different sources doesn't cause any harm. A possible example for multiple threads reading from `Serial` would be to i.e. split an NMEA parser across multiple threads, i.e. one thread only parses RMC-messages, another parses GGA-messages, etc. In any case the thread-safe `Serial` supports both single-writer/single-reader and multiple-write/multiple-reader scenarios.
1111

@@ -48,7 +48,7 @@ Serial.println(counter);
4848
### Prevent message break-up using `block()`/`unblock()`
4949
([`examples/Threadsafe_IO/Serial_Writer`](../examples/Threadsafe_IO/Serial_Writer))
5050

51-
Due to the pre-emptive nature of the underlying mbed-os threading mechanism a multi-line sequence of `Serial.print/println()` could be interrupted at any point in time. When multiple threads are writing to the same Serial interface, this can lead to jumbled-up messages.
51+
Due to the preemptive nature of the underlying mbed-os threading mechanism a multi-line sequence of `Serial.print/println()` could be interrupted at any point in time. When multiple threads are writing to the same Serial interface, this can lead to jumbled-up messages.
5252

5353
```C++
5454
/* Thread_1.inot */

‎docs/threadsafe-spi.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ BusDevice bmp388(SPI, DEVICE_CS_PIN, spi_clock, spi_bit_order, spi_bit_mode);
2525
BusDevice bmp388(SPI, device_cs_select, device_cs_deselect, spi_settings);
2626
```
2727

28-
### Asynchronous thread-safe `SPI` access with `transfer`/`wait`
28+
### Asynchronous thread-safe `SPI` access with `transfer`/`wait`
2929
Once a `BusDevice` is declared it can be used to transfer data to and from the peripheral by means of the `transfer()` API. As opposed to the traditional Arduino bus APIs, `transfer()` is asynchronous and thus won't block execution unless the `wait()` function is called.
3030
Note that we are in a parallel programming environment which means that calls to `transfer()` on the same bus from different sketches will be arbitrated.
3131

@@ -39,12 +39,12 @@ byte bmp388_read_reg(byte const reg_addr)
3939
IoResponse response = bmp388.transfer(request);
4040
/* Do other stuff */
4141
response->wait(); /* Wait for the completion of the IO Request. */
42-
auto value = read_write_buffer[2];
42+
auto value = read_write_buffer[2];
4343
return value;
4444
}
4545
```
4646
47-
### Synchronous thread-safe `SPI` access with `transferAndWait`
47+
### Synchronous thread-safe `SPI` access with `transferAndWait`
4848
([`examples/Threadsafe_IO/SPI`](../examples/Threadsafe_IO/SPI))
4949
5050
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transferAndWait`.
@@ -57,7 +57,7 @@ byte bmp388_read_reg(byte const reg_addr)
5757
IoRequest request(read_write_buffer, sizeof(read_write_buffer), nullptr, 0);
5858
IoResponse response = transferAndWait(bmp388, request);
5959
60-
auto value = read_write_buffer[2];
60+
auto value = read_write_buffer[2];
6161
return value;
6262
}
6363
```

‎docs/threadsafe-wire.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ while(Wire.available()) {
2020
```
2121
Since we are using the [preemptive](https://os.mbed.com/docs/mbed-os/v6.11/program-setup/concepts.html#threads) [RTOS](https://en.wikipedia.org/wiki/Real-time_operating_system) [ARM Mbed OS](https://os.mbed.com/mbed-os/) with a tick time of 10 ms for achieving multi-tasking capability and under the assumption that all threads share the same priority (which leads to a [round-robin scheduling](https://en.wikipedia.org/wiki/Round-robin_scheduling)) it can easily happen that one thread is half-way through its `Wire` access when the scheduler interrupts it and schedules the next thread which in turn starts/continues/ends its own `Wire` access.
2222

23-
As a result this interruption by the scheduler will break `Wire` access for both devices and leave the `Wire` controller in an undefined state.
23+
As a result this interruption by the scheduler will break `Wire` access for both devices and leave the `Wire` controller in an undefined state.
2424

25-
In Arduino Parallela we introduced the concept of `BusDevice`s which are meant to unify the way sketches access peripherals through heterogeneous busses such as `Wire`, `SPI` and `Serial`. A `BusDevice` is declared simply by specifying the type of interface and its parameters:
25+
In Arduino Parallela we introduced the concept of `BusDevice`s which are meant to unify the way sketches access peripherals through heterogeneous busses such as `Wire`, `SPI` and `Serial`. A `BusDevice` is declared simply by specifying the type of interface and its parameters:
2626
```C++
2727
BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS);
2828
/* or */
@@ -31,7 +31,7 @@ BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS, true /* restart */);
3131
BusDevice lsm6dsox(Wire, LSM6DSOX_ADDRESS, false /* restart */, true, /* stop */);
3232
```
3333
34-
### Asynchronous thread-safe `Wire` access with `transfer`/`wait`
34+
### Asynchronous thread-safe `Wire` access with `transfer`/`wait`
3535
Once a `BusDevice` is declared it can be used to transfer data to and from the peripheral by means of the `transfer()` API. As opposed to the traditional Arduino bus APIs, `transfer()` is asynchronous and thus won't block execution unless the `wait()` function is called.
3636
Note that we are in a parallel programming environment which means that calls to `transfer()` on the same bus from different sketches will be arbitrated.
3737
@@ -40,31 +40,31 @@ byte lsm6dsox_read_reg(byte const reg_addr)
4040
{
4141
byte write_buffer = reg_addr;
4242
byte read_buffer = 0;
43-
43+
4444
IoRequest request(write_buffer, read_buffer);
4545
IoResponse response = lsm6dsox.transfer(request);
46-
47-
/* Wait for the completion of the IO Request.
46+
47+
/* Wait for the completion of the IO Request.
4848
Allows other threads to run */
4949
response->wait();
50-
50+
5151
return read_buffer;
5252
}
5353
```
5454

55-
### Synchronous thread-safe `Wire` access with `transferAndWait`
55+
### Synchronous thread-safe `Wire` access with `transferAndWait`
5656
([`examples/Threadsafe_IO/Wire`](../examples/Threadsafe_IO/Wire))
5757

58-
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transferAndWait`.
58+
As the use of the `transfer` API might be difficult to grasp there's also a synchronous API call combining the request of the transfer and waiting for its result using `transferAndWait`.
5959
```C++
6060
byte lsm6dsox_read_reg(byte const reg_addr)
6161
{
6262
byte write_buffer = reg_addr;
6363
byte read_buffer = 0;
64-
64+
6565
IoRequest request(write_buffer, read_buffer);
6666
IoResponse response = transferAndWait(lsm6dsox, request); /* Transmit IO request for execution and wait for completion of request. */
67-
67+
6868
return read_buffer;
6969
}
7070
```

‎examples/Threading_Basics/Source_Sink_Counter/Source_Sink_Counter.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* This examples demonstrates the SOURCE/SINK abstraction. Each thread
1+
/* This example demonstrates the SOURCE/SINK abstraction. Each thread
22
* may have any number of SOURCES and SINKS that can be connected
33
* together using the 'connectTo' method.
44
*/

‎examples/Threading_Basics/Source_Sink_LED/Source_Sink_LED.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* This examples demonstrates the SOURCE/SINK abstraction. Each thread
1+
/* This example demonstrates the SOURCE/SINK abstraction. Each thread
22
* may have any number of SOURCES and SINKS that can be connected
33
* together using the 'connectTo' method.
44
*/

‎examples/Threading_Basics/Thermostat/AirConditionerControl.inot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void loop()
3232
if (is_ac_on && turn_ac_off)
3333
{
3434
is_ac_on = false;
35-
35+
3636
Serial.block();
3737
Serial.print("AC OFF (");
3838
Serial.print(current_temperature_deg);
@@ -43,7 +43,7 @@ void loop()
4343
if (!is_ac_on && turn_ac_on)
4444
{
4545
is_ac_on = true;
46-
46+
4747
Serial.block();
4848
Serial.print("AC ON (");
4949
Serial.print(current_temperature_deg);

‎examples/Threading_Basics/Thermostat/HeatingControl.inot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void loop()
3232
if (is_heating_on && turn_heating_off)
3333
{
3434
is_heating_on = false;
35-
35+
3636
Serial.block();
3737
Serial.print("Heating OFF (");
3838
Serial.print(current_temperature_deg);
@@ -43,7 +43,7 @@ void loop()
4343
if (!is_heating_on && turn_heating_on)
4444
{
4545
is_heating_on = true;
46-
46+
4747
Serial.block();
4848
Serial.print("Heating ON (");
4949
Serial.print(current_temperature_deg);

‎examples/Threading_Basics/Thermostat/TemperatureSensor.inot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ void setup()
99
void loop()
1010
{
1111
/* Read temperature - since this is just a simulation
12-
* so we take a random value between 15 and 30 °C.
12+
* we take a random value between 15 and 30 °C.
1313
*/
1414
float const temperature_deg = (rand() % 16) + 15;
1515
/* Store in temperature source variable. */
1616
temperature.push(temperature_deg);
17-
/* Do only one temperature sensore measurement per second. */
17+
/* Do only one temperature sensor measurement per second. */
1818
delay(5000);
1919
}

‎examples/Threading_Basics/Thermostat/Thermostat.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/* This example emulates a thermostat system which consists of
2-
* a single temperature sensore and multiple heating devices
2+
* a single temperature sensor and multiple heating devices
33
* or air-conditioners. The temperature sensor provides periodic
44
* temperature sensor measurements and acts as a temperature source.
55
* This temperature is consumed by various TemperatureControl_ threads
66
* which perform the act of actual room temperature control.
7-
*
7+
*
88
* Note: While there is only a single temperature "source" there are
99
* multiple temperature "sinks". The source/sink paradigm is constructed
1010
* in such a way, that each sink is guaranteed to see every value provided

‎examples/Threadsafe_IO/SPI/SPI.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void bmp388_thread_func()
8686
rtos::ThisThread::sleep_for(rtos::Kernel::Clock::duration_u32(random(5,500)));
8787
/* Try to read some data from the BMP3888. */
8888
byte const chip_id = bmp388_read_reg(BMP388_CHIP_ID_REG_ADDR);
89-
/* Print thread id and chip id value to serial. */
89+
/* Print thread ID and chip ID value to serial. */
9090
char msg[64] = {0};
9191
snprintf(msg, sizeof(msg), "%s: Chip ID = 0x%X", rtos::ThisThread::get_name(), chip_id);
9292
Serial.println(msg);

‎examples/Threadsafe_IO/SPI_BusIO/SPI_BusIO.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void bmp388_thread_func()
8585
rtos::ThisThread::sleep_for(rtos::Kernel::Clock::duration_u32(random(5,500)));
8686
/* Try to read some data from the BMP3888. */
8787
byte const chip_id = bmp388_read_reg(BMP388_CHIP_ID_REG_ADDR);
88-
/* Print thread id and chip id value to serial. */
88+
/* Print thread ID and chip ID value to serial. */
8989
char msg[64] = {0};
9090
snprintf(msg, sizeof(msg), "%s: Chip ID = 0x%X", rtos::ThisThread::get_name(), chip_id);
9191
Serial.println(msg);

‎examples/Threadsafe_IO/Serial_Reader/Serial_Reader.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void loop()
3535
while (Serial.available())
3636
serial_msg += (char)Serial.read();
3737

38-
/* Print thread id and chip id value to serial. */
38+
/* Print thread ID and chip ID value to serial. */
3939
if (serial_msg.length())
4040
{
4141
Serial.block();

‎examples/Threadsafe_IO/Serial_Reader/Thread_1.inot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void loop()
1414
while (Serial.available())
1515
serial_msg += (char)Serial.read();
1616

17-
/* Print thread id and chip id value to serial. */
17+
/* Print thread ID and chip ID value to serial. */
1818
if (serial_msg.length())
1919
{
2020
Serial.block();

‎examples/Threadsafe_IO/Serial_Reader/Thread_2.inot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void loop()
1414
while (Serial.available())
1515
serial_msg += (char)Serial.read();
1616

17-
/* Print thread id and chip id value to serial. */
17+
/* Print thread ID and chip ID value to serial. */
1818
if (serial_msg.length())
1919
{
2020
Serial.block();

‎examples/Threadsafe_IO/Serial_Reader/Thread_3.inot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void loop()
1414
while (Serial.available())
1515
serial_msg += (char)Serial.read();
1616

17-
/* Print thread id and chip id value to serial. */
17+
/* Print thread ID and chip ID value to serial. */
1818
if (serial_msg.length())
1919
{
2020
Serial.block();

‎examples/Threadsafe_IO/Wire/Wire.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ byte lsm6dsox_read_reg(byte const reg_addr)
6565
*/
6666
byte write_buf = reg_addr;
6767
byte read_buf = 0;
68-
68+
6969
IoRequest req(write_buf, read_buf);
7070
IoResponse rsp = transferAndWait(lsm6dsox, req);
71-
71+
7272
return read_buf;
7373
}
7474

@@ -84,7 +84,7 @@ void lsm6dsox_thread_func()
8484
rtos::ThisThread::sleep_for(rtos::Kernel::Clock::duration_u32(random(5,500)));
8585
/* Try to read some data from the LSM6DSOX. */
8686
byte const who_am_i = lsm6dsox_read_reg(LSM6DSOX_WHO_AM_I_REG);
87-
/* Print thread id and chip id value to serial. */
87+
/* Print thread ID and chip ID value to serial. */
8888
char msg[64] = {0};
8989
snprintf(msg, sizeof(msg), "%s: LSM6DSOX[WHO_AM_I] = 0x%X", rtos::ThisThread::get_name(), who_am_i);
9090
Serial.println(msg);

‎examples/Threadsafe_IO/Wire_BusIO/Wire_BusIO.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void lsm6dsox_thread_func()
7979
rtos::ThisThread::sleep_for(rtos::Kernel::Clock::duration_u32(random(5,500)));
8080
/* Try to read some data from the LSM6DSOX. */
8181
byte const who_am_i = lsm6dsox_read_reg(LSM6DSOX_WHO_AM_I_REG);
82-
/* Print thread id and chip id value to serial. */
82+
/* Print thread ID and chip ID value to serial. */
8383
char msg[64] = {0};
8484
snprintf(msg, sizeof(msg), "%s: LSM6DSOX[WHO_AM_I] = 0x%X", rtos::ThisThread::get_name(), who_am_i);
8585
Serial.println(msg);

‎src/io/serial/SerialDispatcher.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void SerialDispatcher::end()
7777
{
7878
mbed::ScopedLock<rtos::Mutex> lock(_mutex);
7979

80-
/* Retrieve the current thread id and remove
80+
/* Retrieve the current thread ID and remove
8181
* the thread data from the thread data list.
8282
*/
8383
osThreadId_t const current_thread_id = rtos::ThisThread::get_id();
@@ -297,7 +297,7 @@ void SerialDispatcher::threadFunc()
297297

298298
std::list<SerialDispatcher::ThreadCustomerData>::iterator SerialDispatcher::findThreadCustomerDataById(osThreadId_t const thread_id)
299299
{
300-
return std::find_if(std::begin(_thread_customer_list),
300+
return std::find_if(std::begin(_thread_customer_list),
301301
std::end (_thread_customer_list),
302302
[thread_id](ThreadCustomerData const d) -> bool
303303
{

‎src/io/spi/SpiDispatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void SpiDispatcher::processSpiIoRequest(SpiIoTransaction * spi_io_transaction)
141141
config->spi().beginTransaction(config->settings());
142142

143143
/* In a first step transmit the complete write buffer and
144-
* write back the receive data directly into the write buffer
144+
* write back the receive data directly into the write buffer
145145
*/
146146
size_t bytes_sent = 0;
147147
for(; bytes_sent < io_request->bytes_to_write; bytes_sent++)

0 commit comments

Comments
 (0)
Please sign in to comment.