Skip to content

Commit a54f96a

Browse files
committed
Simplify README (removing redundances based on integrating _ThreadsafeIO)
1 parent f7e54e7 commit a54f96a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: README.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
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.
1111

1212
## :zap: Features
13-
### :thread: Multi-Threading
14-
#### :thread: Multi-threaded sketch execution
13+
### :thread: Multi-threaded sketch execution
1514
Instead of one big state-machine-of-doom you can split your application into multiple independent threads, each with it's own `setup()` and `loop()` function. Instead of implementing your application in a single `.ino` file, each independent thread is implemented in a dedicated `.inot` representing a clear separation of concerns on a file level.
1615

17-
#### :calling: Easy communication between multiple threads
16+
### :calling: Easy communication between multiple threads
1817
Easy inter-thread-communication is facilitated via a `Shared` abstraction providing thread-safe sink/source semantics allowing to safely exchange data of any type between threads.
1918

20-
### :thread: Threadsafe IO
21-
#### :thread: Threadsafe
19+
### :electric_plug: Threadsafe, asynchronous and convenient Input/Output API
20+
* **Threadsafe**
21+
2222
A key problem of multi-tasking is the **prevention of erroneous state when multiple threads share a single resource**. The following example borrowed from a typical application demonstrates the problems resulting from multiple threads sharing a single resource:
2323

2424
Imagine a embedded system where multiple `Wire` client devices are physically connected to a single `Wire` server. Each `Wire` client device is managed by a separate software thread. Each thread polls its `Wire` client device periodically. Access to the I2C bus is managed via the `Wire` library and typically follows this pattern:
@@ -45,15 +45,14 @@ As a result this interruption by the scheduler will break Wire IO access for bot
4545

4646
`Arduino_ThreadsafeIO` solves this problem by encapsulating a complete IO access (e.g. reading from a `Wire` client device) within a single function call which generates an IO request to be asynchronously executed by a high-priority IO thread. The high-priority IO thread is the **only** instance which actually directly communicates with physical hardware.
4747

48-
#### :zzz: Asynchronous
48+
* **Asynchronous**
4949

5050
The mechanisms implemented in this library allow any thread to dispatch an IO request asynchronously and either continue operation or [yield](https://en.wikipedia.org/wiki/Yield_(multithreading))-ing control to the next scheduled thread. All IO requests are stored in a queue and are executed within a high-priority IO thread after a context-switch. An example of this can be seen [here](examples/Threadsafe_SPI/Threadsafe_SPI.ino)).
5151

52-
#### :sparkling_heart: Convenient API
52+
* **Convenient API**
5353

5454
Although you are free to directly manipulate IO requests and responses (e.g. [Threadsafe_Wire](examples/Threadsafe_Wire/Threadsafe_Wire.ino)) there do exist convenient `read`/`write`/`write_then_read` abstractions inspired by the [Adafruit_BusIO](https://github.com/adafruit/Adafruit_BusIO) library (e.g. [Threadsafe_Wire_BusIO](examples/Threadsafe_Wire_BusIO/Threadsafe_Wire_BusIO.ino)).
5555

56-
5756
## :mag_right: Resources
5857

5958
* [How to install a library](https://www.arduino.cc/en/guide/libraries)

0 commit comments

Comments
 (0)