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: docs/ar_autoload.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,9 +18,9 @@ The key classes to support this pattern are:
18
18
19
19
|||
20
20
|------|-------|
21
-
**Device Driver** | The device specific driver, often implemented based on an existing Arduino Library |
22
-
**Device Builder** | A device specific class that is automatically generated and used by the Framework to detect and instantiate a device
23
-
**Device Factory** | An overall singleton within the system that enables device registration at startup and device discovery, instantiation and initialization at runtime
21
+
|**Device Driver**| The device specific driver, often implemented based on an existing Arduino Library |
22
+
|**Device Builder**| A device specific class that is automatically generated and used by the Framework to detect and instantiate a device|
23
+
|**Device Factory**| An overall singleton within the system that enables device registration at startup and device discovery, instantiation and initialization at runtime|
24
24
25
25
### Device Class
26
26
@@ -36,38 +36,38 @@ The class hierarchy for the Device class is outlined in the following diagram:
36
36
37
37
The following **static** methods form the device discovery interface:
38
38
39
-
|||
40
-
|----|---|
41
-
```isConnected()``` | Called with an I2C bus object - should return true of the device is connected
42
-
```connectedConfidence()``` | Returns a confidence level to indicate the accuracy of the ```isConnected()``` algorithm used. Helpful when resolving device address conflicts
43
-
```getDeviceName()``` | Returns the name of the device - should be a static constant
44
-
```getDefaultAddress()``` | Returns the default I2C address for the device. *This method is deprecated*
45
-
```getDefaultAddresses()``` | Returns a list of I2C addresses the device can use. The first address should be the default address for the device. This array is terminated with the value ```kSparkDeviceAddressNull```
39
+
|||
40
+
|----|----|
41
+
|```isConnected()```| Called with an I2C bus object - should return true of the device is connected|
42
+
|```connectedConfidence()```| Returns a confidence level to indicate the accuracy of the ```isConnected()``` algorithm used. Helpful when resolving device address conflicts|
43
+
|```getDeviceName()```| Returns the name of the device - should be a static constant|
44
+
|```getDefaultAddress()```| Returns the default I2C address for the device. *This method is deprecated*|
45
+
|```getDefaultAddresses()```| Returns a list of I2C addresses the device can use. The first address should be the default address for the device. This array is terminated with the value ```kSparkDeviceAddressNull```|
46
46
47
47
#### Instance Methods
48
48
49
49
For the startup sequence the following instance methods are important
50
-
|||
50
+
|||
51
51
|------|--------|
52
-
```onInitialize()``` | Called during the initialization process allowing the performance of the driver specific startup sequence. The Arduino TwoWire (Wire) object is passed in for use by the driver. Note: to get the address to use for the device, the driver calls the ```address()``` method.
53
-
```address()``` | Inherited - this method returns the address for the attached device
54
-
```isInitialized()``` | Returns true of the method ```onInitialized()``` returned true - indicating the driver is initialized.
52
+
|```onInitialize()```| Called during the initialization process allowing the performance of the driver specific startup sequence. The Arduino TwoWire (Wire) object is passed in for use by the driver. Note: to get the address to use for the device, the driver calls the ```address()``` method.|
53
+
|```address()```| Inherited - this method returns the address for the attached device|
54
+
|```isInitialized()```| Returns true of the method ```onInitialized()``` returned true - indicating the driver is initialized.|
55
55
56
56
### Device Builder Class
57
57
58
58
This class provides a common interface for the Factory class to use during the discovery and instantiation phase of device creation. The class is defined as a template, with the only template parameter being the class name of the Driver it represents.
59
59
60
60
The template definition for the ```DeviceBuilder``` class:
For the most part, all the methods in this class just wrap the *introspection* methods provided by the underlying Device class it represents. This allows allows the Factory class to work with object instances that bridge calls to the *static* methods of a Device object.
67
67
68
68
Example of a wrapped method in the ```DeviceBuilder``` template:
Copy file name to clipboardExpand all lines: docs/device_writing.md
+36-34Lines changed: 36 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,11 @@ The new device class should subclass from the frameworks ```flxDevice``` class,
19
19
20
20
> Note - In some cases, because of the underlying Arduino Library design, an alternative > implementation pattern is required - such as object containment.
21
21
22
-
#####Example of a class definition
22
+
### Example of a class definition
23
23
24
24
Implementing a driver for the `BME280` Device.
25
25
26
-
```C++
26
+
```cpp
27
27
classflxDevBME280 : publicflxDeviceI2CType<flxDevBME280>, public BME280
28
28
{
29
29
@@ -38,12 +38,12 @@ To accomplish this task, class level (static) methods and data are implemented b
38
38
39
39
|Item | Description|
40
40
|----|--|
41
-
```bool isConnected(flxBusI2C, address)``` | Returns true if the device is connected |
42
-
```char* getDeviceName()``` | Returns the Device Name |
41
+
| ```bool isConnected(flxBusI2C, address)``` | Returns true if the device is connected |
42
+
| ```char* getDeviceName()``` | Returns the Device Name |
43
43
|```uint8_t *getDefaultAddresses()``` | Return a list of addresses for the device. This list terminates with the value of ```kSparkDeviceAddressNull``` |
44
44
|```flxDeviceConfidence_t connectedConfidence()``` | Returns the confidence level of the drivers ```isConnected()``` algorithm. Values supported range from *Exact* to *Ping* |
45
45
46
-
Note
46
+
> [!note]
47
47
>
48
48
>* Often the device implements the address list as a class level variable
49
49
>* It is common to define a constant or macro for the device name and return it from ```getDeviceName()```
@@ -56,9 +56,9 @@ The first step for a given driver is the retrieval of default addresses for the
56
56
57
57
The system uses the array of addresses to determine what addresses are currently available, and call the ```isConnected()``` with the possible and available addresses until a connection is found, or it hits the end of the possible addresses for the device.
58
58
59
-
##### Method Signature
59
+
##### Method Signature {#device-address-method}
60
60
61
-
```C++
61
+
```cpp
62
62
static const uint8_t *getDefaultAddresses();
63
63
```
64
64
@@ -68,9 +68,9 @@ For each of the addresses returned, the system calls the drivers ```isConnected(
68
68
69
69
How the driver determines if a device is connected is determined by the implementation
The static interface for the device also includes a method to return the name of the device.
85
85
86
-
##### Method Signature
86
+
##### Method Signature {#device-name-method}
87
87
88
-
```C++
88
+
```cpp
89
89
static const char *getDeviceName()
90
90
```
91
91
@@ -97,19 +97,19 @@ This method returns the confidence level for the algorithm in the devices ```isC
97
97
98
98
This confidence level is used to resolve detection conflicts between devices that support the same address on the I2C bus. Drivers that have a higher confidence level are evaluated first.
```flxDevConfidenceExact``` | The algorithm can perform an exact match
111
-
```flxDevConfidenceFuzzy``` | The algorithm has high-confidence in a match, but it's not exact
112
-
```flxDevConfidencePing``` | An address "ping" is used - just detecting a device at a location, but not verifying the device type.
110
+
|```flxDevConfidenceExact``` | The algorithm can perform an exact match|
111
+
|```flxDevConfidenceFuzzy``` | The algorithm has high-confidence in a match, but it's not exact|
112
+
|```flxDevConfidencePing``` | An address "ping" is used - just detecting a device at a location, but not verifying the device type.|
113
113
114
114
> Note: Only one device with a PING confidence is allowed at an address.
115
115
@@ -119,7 +119,7 @@ This example is taken from the device driver for the BME280 device.
119
119
120
120
The class definition - ```flxDevBME280.h```
121
121
122
-
```C++
122
+
```cpp
123
123
// What is the name used to ID this device?
124
124
#define kBME280DeviceName "bme280";
125
125
@@ -166,19 +166,20 @@ To complete the auto-discovery capabilities of the system, besides the implement
166
166
167
167
This is call is placed before the class implementation and has the following signature:
168
168
169
-
```C++
169
+
```cpp
170
170
flxRegisterDevice(DeviceClassName);
171
171
```
172
172
173
173
Where `DeviceClassName` is the class name of the device being registered.
174
174
175
175
Once a device is registered, it is available for auto-detection and loading by the framework during the startup process of system.
176
176
177
-
> Note: The ```flxRegisterDevice()``` call is a macro that defines a global object using a c++ template. The object is instantiated on system startup (all globals are), and in the constructor of the object, it registers itself with the device discovery system.
177
+
> ![note]
178
+
> The ```flxRegisterDevice()``` call is a macro that defines a global object using a c++ template. The object is instantiated on system startup (all globals are), and in the constructor of the object, it registers itself with the device discovery system.
178
179
179
180
Building off the above BME280 example, the implementation looks like:
* This is a static (has no `this` instance) and as such uses the methods on the passed in I2C bus driver to determine in a BME280 is connected to the system
227
+
> [!note]
228
+
>
229
+
> * This is a static (has no `this` instance) and as such uses the methods on the passed in I2C bus driver to determine in a BME280 is connected to the system
229
230
230
231
### Startup Sequence
231
232
232
233
The last part of implementing a device descriptor/driver class is the addition of an initialization method, named ``onInitialize()``.
233
234
234
-
##### Method Signature
235
+
#### Method Signature {#on-init-method}
235
236
236
-
```C++
237
+
```cpp
237
238
bool onInitialize(TwoWire &);
238
239
```
239
240
240
241
The only argument to this methods is the Arduino I2C `TwoWire` class, which the class can use to initialize the device. The method returns `true` on success, `false` on failure.
Copy file name to clipboardExpand all lines: docs/parameters.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
-
2
-
# Parameters
1
+
# Parameters Overview {#parameters_overview}
3
2
4
3
Parameters represent the method to read or pass in a specific data _value_ to an operation object withing the SDK. Parameters can be thought of as the data values passed into or returned from a function call. Parameter objects provide a means to support dynamically discoverable input and output data for a particular operation within the framework.
5
4
6
5
There are two types of Parameter objects with the framework: Input Parameters ("functions") and Output Parameters
7
6
8
-
###Parameter Attributes
7
+
## Parameter Attributes
9
8
10
9
The following are key attributes of parameters within the framework
11
10
@@ -14,7 +13,7 @@ The following are key attributes of parameters within the framework
14
13
* Parameter objects can act like a function
15
14
* Parameter objects allow introspection - they can be discovered and manipulated at runtime via software
16
15
17
-
####Parameter Data Types
16
+
### Parameter Data Types
18
17
19
18
The following types are available for properties
20
19
@@ -126,7 +125,7 @@ Note
126
125
127
126
Data limits define restrictions on the values the input parameter accepts. There are two types of data limits: range and valid value sets.
128
127
129
-
*Data Range*
128
+
_Data Range_
130
129
This represents the minimum and maximum values a input parameter will accept. The values can be specified at parameter definition and also set at runtime.
131
130
132
131
To set the range at parameter definition, just set the declared parameter to the range using a C++ initializer list ```{ min, max}```
@@ -151,7 +150,7 @@ Using the example parameter from above:
151
150
152
151
This changes the data range accepted by the input parameter and deletes any existing data limit.
153
152
154
-
*Data Valid Value Set*
153
+
_Data Valid Value Set_
155
154
This represents data limit provides a defined set of valid values for the input parameter. The limit is defined by a set of _name,value_ pairs that enable a human readable presentation for the values a input parameter will accept. The values can be specified at parameter definition and also set at runtime.
156
155
157
156
To set the valid values at parameter definition, just set the declared parameter to the range using a C++ initializer list of name value pairs:
Copy file name to clipboardExpand all lines: docs/properties.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
-
\addtogroup module_properties
2
-
@{
3
1
4
-
# Properties
2
+
# Properties Overview {#properties_overview}
5
3
6
4
Properties represent the "_settings_" for a particular object within the system. This property values describe their object, as well as how the object behaves/operates within the system.
7
5
@@ -369,5 +367,3 @@ Or for an entire parameter list:
369
367
```
370
368
371
369
The values are added to the current valid value list. If a _ValidValue_ data limit was not in place when called, any current limit (i.e. range limit) is deleted and a valid value limit is put in place.
0 commit comments