You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/decisions/dr-004.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
## Context
4
4
5
5
Currently we violate the requirement to use libraries and frameworks only through adapters, as it is required by the objectives of the software architecture (see
6
-
[relevant section in Software Architecture](<\ref flexible_structure>"relevant section in Software Architecture"):
6
+
[relevant section in Software Architecture](<\ref flexible_structure>"relevant section in Software Architecture")):
7
7
We currently use an implementation of the [ArduinoCore-API][ACA] (ACA) as a hardware abstraction layer (HAL) from outside of the adapters layer.
8
8
More specifically we use an implementation of the ACA from Espressif coined for ESP32s.
9
9
@@ -26,7 +26,7 @@ Those adapters would reside in the
26
26
27
27
#### Option 1a)
28
28
29
-
For an object oriented (OO) variant, defining an interface and inheriting from it, it would require to:
29
+
For an object oriented (OO) variant, defining an interface and inheriting from it would require to:
@@ -70,7 +70,7 @@ Factories are not necessary because this approach does not rely on objects.
70
70
#### Option 1c)
71
71
72
72
A hybrid approach (OO and free functions) is also possible.
73
-
This would fit well to the [ACA][] as is also consists of classes and free functions.
73
+
This would fit well to the ACA as is also consists of classes and free functions.
74
74
75
75
The steps required would be a mixture of those of options 1a) and 1b).
76
76
@@ -81,10 +81,10 @@ Change the current guidelines such that the direct dependency to 3rd party HALs
81
81
82
82
This approach eliminates the requirement to define 3rd party adapters to the HAL.
83
83
84
-
In order to be able to test code depending on the [ACA][], the 3rd party interface needs to be stubbed.
85
-
*For vanilla [ACA][], stubbing the proprietary interface can be greatly simplified by using [ArduinoFake][].*
86
-
We use an [implementation of the Arduino Core API (ACA) specific for ESP32s by Espressif](https://github.com/espressif/arduino-esp32/) which extends the [ACA][].
87
-
Following the approach of this option, to directly use [ACA][] and [ArduinoFake][] for testing, we would need to deal with the extensions separately.
84
+
In order to be able to test code depending on the ACA, the 3rd party interface needs to be stubbed.
85
+
*For vanilla ACA, stubbing the proprietary interface can be greatly simplified by using [ArduinoFake][].*
86
+
We use an [implementation of the Arduino Core API (ACA) specific for ESP32s by Espressif](https://github.com/espressif/arduino-esp32/) which extends the ACA.
87
+
Following the approach of this option, to directly use ACA and ArduinoFake for testing, we would need to deal with the extensions separately.
88
88
The following variants of this option, specifies different methods to cope with the extensions.
89
89
90
90
[ArduinoFake]: https://platformio.org/lib/show/1689/ArduinoFake"ArduinoFake in PlaftormIO's registry"
@@ -93,14 +93,14 @@ The following variants of this option, specifies different methods to cope with
93
93
94
94
Instead of directly using a modified Arduino interface (for example for a specific `class`), we use an adapter.
95
95
The adapters would be integrated just as for option 1.
96
-
But compared to option 1 this only needs to be done for those smallest indivisible interfaces which are not compatible to the vanilla [ACA][].
96
+
But compared to option 1 this only needs to be done for those smallest indivisible interfaces which are not compatible to the vanilla ACA.
97
97
98
98
#### Option 2b)
99
99
100
100
At those places in the source code where extensions are used, we introduce conditionally compiled sections.
101
-
One section uses the modified version of the [ACA][], necessary for the productive code.
101
+
One section uses the modified version of the ACA, necessary for the productive code.
102
102
The alternative section is instead used when compiling for native tests.
103
-
It uses the vanilla [ACA][] which can be simply stubbed using [ArduinoFake][].
103
+
It uses the vanilla ACA which can be simply stubbed using ArduinoFake.
104
104
105
105
The selection of conditionally compiled sections is done using `constexpr if`, where possible.
106
106
Else the C preprocessor (CPP) is used for conditional inclusion (`#if`, ...).
@@ -175,5 +175,5 @@ And more specifically for testing on native environments, use:
175
175
176
176
> **Option 2b):** Where the ACA is used it is allowed to add small conditionally compiled sections for tests in order to cope with deviations of the ACA used in productive code from the vanilla ACA.
177
177
178
-
The latter relaxation is in order to facilitate the use of [ArduinoFake][] to stub the HAL's interface.
178
+
The latter relaxation is in order to facilitate the use of ArduinoFake to stub the HAL's interface.
0 commit comments