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
@@ -26,7 +26,6 @@ When this option is selected, the user is presented a prompt to continue. To lau
26
26
27
27

28
28
29
-
30
29
## Factory Reset
31
30
32
31
A factory reset will move the boot firmware of the device to the firmware imaged installed at the ***factory*** and erase any on-board stored settings on the device. This is helpful if an update fails, or an update has issues that prevent proper operations.
@@ -180,7 +179,7 @@ The `VersionNumber` field is often created by the following formula:
One of the key features of the Flux framework is the ability to automatically detect and load different I2C devices, while placing minimal requirements on the device driver developer.
4
4
@@ -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/build_with_flux.md
+13-14
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
2
-
# Building with Flux
2
+
# Building with Flux {#building-with-flux}
3
3
4
-
This section outline the steps needed to support Flux in an Arduino Build Environment. Both support for Arduino IDE development, as well as automated builds that use the Arduino CLI (GitHub actions).
4
+
This section outline the steps needed to support Flux in an Arduino Build Environment. Both support for Arduino IDE development, as well as automated builds that use the Arduino CLI (GitHub actions).
5
5
6
-
Since Flux is private, only available to SparkFun employees and approved partners, the build integration is different from standard Open Source projects.
6
+
Since Flux is private, only available to SparkFun employees and approved partners, the build integration is different from standard Open Source projects.
7
7
8
8
## Using Flux within the Arduino IDE
9
9
@@ -31,9 +31,9 @@ To use Flux in another project that is being build using build automation (GitHu
With this structure in place, access to the Flux within a GitHub action is accomplished by using ssh keys.
34
+
With this structure in place, access to the Flux within a GitHub action is accomplished by using ssh keys.
35
35
36
-
The first step is to generate a new key locally - in a shell
36
+
The first step is to generate a new key locally - in a shell
37
37
38
38
```sh
39
39
ssh-keygen -t rsa -b 4096 -C "Access to flux"
@@ -47,11 +47,11 @@ Next add the public part of the key to the Flux repo as a deploy key. In the Flu
47
47
48
48
Give the key a descriptive name (***my project access key***) and paste the public part of the key into the dialog. Keep the key read-only.
49
49
50
-
The next step is to add the private part of the key as a ***secret*** in main project (the project using flux) github repository. This is done in ```Settings > Secrets and variables > Actions``` page. On this page, on the **Secrets** tab, select the ***New repository secret*** button.
50
+
The next step is to add the private part of the key as a ***secret*** in main project (the project using flux) github repository. This is done in ```Settings > Secrets and variables > Actions``` page. On this page, on the **Secrets** tab, select the ***New repository secret*** button.
51
51
52
52

53
53
54
-
In the provided dialog, enter a name for the secret (follow variable naming methodology) and set the value to the private portion of the generated key.
54
+
In the provided dialog, enter a name for the secret (follow variable naming methodology) and set the value to the private portion of the generated key.
55
55
56
56
## Download the Flux Submodule
57
57
@@ -73,10 +73,9 @@ Within a github action, the key is used to download the Flux submodule. Once the
73
73
74
74
NOTE: In this example, ```FLUX_PULL_KEY_2``` is the name of the Flux key secret within this repository.
75
75
76
-
77
76
Once the Flux submodule is checked out, the application is setup and built using the Arduino Command Line (```arduino-cli```)
78
77
79
-
## Using Arduino CLI
78
+
## Using Arduino CLI
80
79
81
80
### Installation
82
81
@@ -100,11 +99,11 @@ If working within a github action, the following code will install and setup the
100
99
run: arduino-cli core install esp32:esp32
101
100
```
102
101
103
-
Note: The above example also installed the ESP32 platform
102
+
Note: The above example also installed the ESP32 platform
104
103
105
104
### Install Flux Dependencies
106
105
107
-
The Flux repository includes a script that installs all library dependencies using the ```arduino-cli```. This command, ```install-libs.sh``` is located within the root directory of the Flux repository.
106
+
The Flux repository includes a script that installs all library dependencies using the ```arduino-cli```. This command, ```install-libs.sh``` is located within the root directory of the Flux repository.
108
107
109
108
To run this command within a github Action, the following code is used:
110
109
@@ -114,13 +113,13 @@ To run this command within a github Action, the following code is used:
114
113
run: ./SparkFun_Flux/install-libs.sh
115
114
```
116
115
117
-
Note: The above command assumes Flux is installed in the root directory of the repository. Adjust the command path to the structure of your repository if needed.
116
+
Note: The above command assumes Flux is installed in the root directory of the repository. Adjust the command path to the structure of your repository if needed.
118
117
119
118
### Compile and Build
120
119
121
120
Once all the dependencies are installed, the ```arduino-cli compile``` option is called to build the desired application. To use Flux as a library, the ```--library``` switch is used with the compile call.
122
121
123
-
The following is an example of building an ESP32 based sketch, which uses the Flux library.
122
+
The following is an example of building an ESP32 based sketch, which uses the Flux library.
124
123
125
124
Note that the location of the Flux library is passed in using the ```--library'`` switch, and that the ***full*** path to the Flux directory is provided. Using a relative path to the Flux library directory causes this command to fail
126
125
@@ -145,4 +144,4 @@ For reference, once the above compile command is completed, the resultant Firmwa
0 commit comments