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/device_writing.md
+7-17
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,11 @@ The key capabilities provided by the implemented framework device class are:
13
13
14
14
The device class should following the naming pattern `flxDev[Name]`, where Name is a unique name of the class.
15
15
16
-
The implementation requires separate header and implementation files, since a several class variables and a global object are defined that required the use of an implementation file.
16
+
The implementation requires separate header and implementation files, since several class variables and a global object are defined that required the use of an implementation file.
17
17
18
-
The new device class should subclass from the frameworks ```flxDevice``` class, using the ```flxDeviceI2CType<DeviceName>``` template. Additionally, the device class subclasses from the underlying driver class in most cases. This allows the descriptor class to support the existing driver's interface.
18
+
The new device class should subclass from the frameworks ```flxDevice``` class, using the ```flxDeviceI2CType<DeviceName>``` template. Additionally, the device class subclasses from the underlying Arduino driver class in most cases. This allows the descriptor class to support the existing driver's interface.
19
19
20
-
> Note - In some cases, because of the underlying Arduino Library design, an alternative > implementation pattern is required - such as object containment.
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
22
### Example of a class definition
23
23
@@ -32,7 +32,7 @@ class flxDevBME280 : public flxDeviceI2CType<flxDevBME280>, public BME280
32
32
33
33
## Automatic Device Discovery
34
34
35
-
The framework supports runtime discovery of connected devices. This is performed using information from the framework device class, while not creating a device instance until the device is actually detected.
35
+
The framework supports runtime discovery of connected devices. This is performed using information from the framework device class, and not creating a device instance until the device is actually detected.
36
36
37
37
To accomplish this task, class level (static) methods and data are implemented by the device object. Each device class implements the following:
38
38
@@ -43,8 +43,6 @@ To accomplish this task, class level (static) methods and data are implemented b
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]
47
-
>
48
46
>* Often the device implements the address list as a class level variable
49
47
>* It is common to define a constant or macro for the device name and return it from ```getDeviceName()```
50
48
@@ -93,7 +91,7 @@ This method returns a constant C string.
93
91
94
92
#### Connected Confidence
95
93
96
-
This method returns the confidence level for the algorithm in the devices ```isConnected()```algorithm in exactly determining if a device is connected at the specific address.
94
+
This method returns the confidence level for the algorithm in the devices ```isConnected()```method in exactly determining if a device is connected at the specific address.
97
95
98
96
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.
99
97
@@ -111,8 +109,6 @@ The return value should be one of the following:
111
109
|```flxDevConfidenceFuzzy``` | The algorithm has high-confidence in a match, but it's not exact|
112
110
|```flxDevConfidencePing``` | An address "ping" is used - just detecting a device at a location, but not verifying the device type.|
113
111
114
-
> [!note]
115
-
>
116
112
> Only one device with a PING confidence is allowed at an address.
117
113
118
114
#### Example Method Definition
@@ -126,7 +122,7 @@ The class definition - ```flxDevBME280.h```
126
122
#define kBME280DeviceName "bme280";
127
123
128
124
// Define our class - note sub-classing from the Qwiic Library
129
-
class flxDevBME280 : public flxDevice<flxDevBME280>, public BME280
125
+
class flxDevBME280 : public flxDeviceI2CType<flxDevBME280>, public BME280
130
126
{
131
127
132
128
public:
@@ -160,7 +156,7 @@ class flxDevBME280 : public flxDevice<flxDevBME280>, public BME280
160
156
* This device defined its name, bme280, using the macro `kBME280DeviceName`
161
157
* Default device addresses are contained in a class variable ```defaultDeviceAddress[];```
162
158
* The method ```onInitialize()``` is called after the object is instantiated.
163
-
* The class subclasses from flxDevice, passing in the class name to the template. The class also subclasses from the Arduino Library class - ```BME280```
159
+
* The class subclasses from flxDeviceI2CType, passing in the class name to the template. The class also subclasses from the Arduino Library class - ```BME280```
164
160
165
161
### Auto Discovery - Class Implementation
166
162
@@ -204,8 +200,6 @@ flxDevBME280::flxDevBME280()
204
200
}
205
201
```
206
202
207
-
> [!note]
208
-
>
209
203
> * This example includes the implementation of ```defaultDeviceAddress[]```, the class variable holding the addresses for the device.
210
204
> * The device is registered before the class constructor
211
205
> * In the constructor, the device identity is set, which is based of runtime conditions.
> * 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
Copy file name to clipboardExpand all lines: docs/parameters.md
+7-19
Original file line number
Diff line number
Diff line change
@@ -20,10 +20,10 @@ The following types are available for properties
20
20
* bool
21
21
* int8
22
22
* int16
23
-
*int
23
+
*int32
24
24
* uint8
25
25
* uint16
26
-
*uint
26
+
*uint32
27
27
* float
28
28
* double
29
29
* string
@@ -51,8 +51,6 @@ For the framework, two types of Parameter classes exist.
51
51
* Input Parameter - Defines a Parameter to set input value to an operation. These are referred to as functions at times - especially in the user experience of an application.
52
52
* Output Parameter - Defines a Parameter to get an output value from an operation
53
53
54
-
> [!note]
55
-
>
56
54
> The get and set operations on a parameter are mapped to methods implemented by the containing class.
57
55
58
56
### Input Parameter Objects
@@ -78,10 +76,10 @@ Where:
78
76
* #flxParameterInBool - bool parameter
79
77
* #flxParameterInInt8 - integer8 parameter
80
78
* #flxParameterInInt16 - integer16 parameter
81
-
* #flxParameterInInt - integer parameter
82
-
* #flxParameterInUint8 - unsigned integer8
83
-
* #flxParameterInUint16 - unsigned integer15
84
-
* #flxParameterInUint - unsigned integer
79
+
* #flxParameterInInt32 - integer parameter
80
+
* #flxParameterInUInt8 - unsigned integer8
81
+
* #flxParameterInUInt16 - unsigned integer15
82
+
* #flxParameterInUInt32 - unsigned integer
85
83
* #flxParameterInFloat - float
86
84
* #flxParameterInDouble - double
87
85
* #flxParameterInString - string -> std::string
@@ -99,8 +97,6 @@ Where:
99
97
* parameter_type - the type of the parameter (bool, int, uint, float, double, std::string)
100
98
* ClassName - the name of the containing class for the property
101
99
102
-
> [!note]
103
-
>
104
100
> By convention, writer method names are prefixed by ```write_```
105
101
106
102
##### Example
@@ -117,8 +113,6 @@ public:
117
113
}
118
114
```
119
115
120
-
> [!note]
121
-
>
122
116
> * By convention declaring the input writer method as private. This can be optional
123
117
> * The writer method must be declared before defining the parameter
124
118
> * The use of the `write_` prefix on the writer methods help identify the methods as supporting a parameter.
@@ -192,7 +186,7 @@ Using the example parameter from above:
192
186
```cpp
193
187
// Add valid values ...
194
188
my_input.addDataLimitValidValue("ONE K", 100.);
195
-
my_input.addDataLimitValidValue("ONE K", 100.);
189
+
my_input.addDataLimitValidValue("TWO K", 200.);
196
190
```
197
191
198
192
Or for an entire parameter list:
@@ -271,8 +265,6 @@ public:
271
265
}
272
266
```
273
267
274
-
> [!note]
275
-
>
276
268
> * By convention declaring the output reader method as private. This can be optional
277
269
> * The reader method must be declared before defining the parameter
278
270
> * The use of the `read_` prefix on the writer methods help identify the methods as supporting a parameter.
@@ -322,8 +314,6 @@ Where
322
314
* ClassName - the name of the containing class for the property
323
315
* On success, a true value is returned, false on error.
324
316
325
-
> [!note]
326
-
>
327
317
> By convention, reader method names are prefixed by ```read_```
328
318
329
319
In the reader methods, the data and dimensions of the array are set in the array object.
@@ -361,8 +351,6 @@ public:
361
351
}
362
352
```
363
353
364
-
> [!note]
365
-
>
366
354
> * By convention declaring the output reader method as private. This can be optional
367
355
> * The reader method must be declared before defining the parameter
368
356
> * The use of the `read_` prefix on the writer methods help identify the methods as supporting a parameter.
0 commit comments