Skip to content

Commit 8792f1a

Browse files
authored
Merge pull request #168 from sparkfun/feature/sdk-documentation
Feature/sdk documentation
2 parents 40d09ad + a66719b commit 8792f1a

30 files changed

+4190
-358
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
docs/html/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "docs/doxygen/doxygen-awesome-css"]
2+
path = docs/doxygen/doxygen-awesome-css
3+
url = https://github.com/jothepro/doxygen-awesome-css.git

docs/act_sysfirmware.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# System Reset and Firmware Update Action - ESP32
1+
# Firmware Update - ESP32 {#flux-using-esp32-firmware}
22

33
> *ESP32*
44
@@ -26,7 +26,6 @@ When this option is selected, the user is presented a prompt to continue. To lau
2626

2727
![Restart Prompt](images/act_sysfirm_restart.png)
2828

29-
3029
## Factory Reset
3130

3231
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:
180179
versionNumber = Major_Version * 10000 + Minor_Version * 100 + Point_Version
181180
```
182181

183-
#### MD5 Hash Creation
182+
#### MD5 Hash Creation
184183

185184
The following command are used to create an MD5 hash value
186185

@@ -201,5 +200,3 @@ Windows - using `Power Shell`
201200
```
202201
Get-FileHash <firmware file> -Algorithm MD5
203202
```
204-
205-

docs/ar_autoload.md

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Architecture - Device Detection and Loading
1+
# I2C Device Detection {#device_detection_loading}
22

33
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.
44

@@ -18,9 +18,9 @@ The key classes to support this pattern are:
1818

1919
| | |
2020
|------|-------|
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|
2424

2525
### Device Class
2626

@@ -36,38 +36,38 @@ The class hierarchy for the Device class is outlined in the following diagram:
3636

3737
The following **static** methods form the device discovery interface:
3838

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```|
4646

4747
#### Instance Methods
4848

4949
For the startup sequence the following instance methods are important
50-
|||
50+
| | |
5151
|------|--------|
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.|
5555

5656
### Device Builder Class
5757

5858
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.
5959

6060
The template definition for the ```DeviceBuilder``` class:
6161

62-
```c++
62+
```cpp
6363
template <class DeviceType> class DeviceBuilder : public flxDeviceBuilderI2C
6464
```
6565
6666
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.
6767
6868
Example of a wrapped method in the ```DeviceBuilder``` template:
6969
70-
```C++
70+
```cpp
7171
bool isConnected(flxBusI2C &i2cDriver, uint8_t address)
7272
{
7373
return DeviceType::isConnected(i2cDriver, address);
@@ -82,7 +82,7 @@ In the implementation file of each device driver, a static ```global``` instance
8282

8383
The definition of the ```DeviceBuilder``` constructor:
8484

85-
```C++
85+
```cpp
8686
DeviceBuilder()
8787
{
8888
flxDeviceFactory::get().registerDevice(this);
@@ -95,19 +95,19 @@ The Flux Factory class ```flxDeviceFactory``` is a *singleton*, and globally acc
9595

9696
To register a device driver, a static ```DeviceBuilder``` is added to the drivers implementation file.
9797

98-
```C++
98+
```cpp
9999
static DeviceBuilder<kDevice> global_##kDevice##Builder;
100100
```
101101

102102
But to make this easier, the following macro is defined.
103103

104-
```C++
104+
```cpp
105105
#define flxRegisterDevice(kDevice) static DeviceBuilder<kDevice> global_##kDevice##Builder;
106106
```
107107
108108
Using this macro, device registration looks like the following (using the BME280 driver)
109109
110-
```C++
110+
```cpp
111111
flxRegisterDevice(flxDevBME280);
112112
```
113113

docs/build_with_flux.md

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

2-
# Building with Flux
2+
# Building with Flux {#building-with-flux}
33

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).
55

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.
77

88
## Using Flux within the Arduino IDE
99

@@ -31,9 +31,9 @@ To use Flux in another project that is being build using build automation (GitHu
3131
git submodule add [email protected]:sparkfun/SparkFun_Flux.git
3232
```
3333

34-
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.
3535

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
3737

3838
```sh
3939
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
4747

4848
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.
4949

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.
5151

5252
![Action Secret](images/github_action_secret.png)
5353

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.
5555

5656
## Download the Flux Submodule
5757

@@ -73,10 +73,9 @@ Within a github action, the key is used to download the Flux submodule. Once the
7373
7474
NOTE: In this example, ```FLUX_PULL_KEY_2``` is the name of the Flux key secret within this repository.
7575

76-
7776
Once the Flux submodule is checked out, the application is setup and built using the Arduino Command Line (```arduino-cli```)
7877

79-
## Using Arduino CLI
78+
## Using Arduino CLI
8079

8180
### Installation
8281

@@ -100,11 +99,11 @@ If working within a github action, the following code will install and setup the
10099
run: arduino-cli core install esp32:esp32
101100
```
102101

103-
Note: The above example also installed the ESP32 platform
102+
Note: The above example also installed the ESP32 platform
104103

105104
### Install Flux Dependencies
106105

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.
108107

109108
To run this command within a github Action, the following code is used:
110109

@@ -114,13 +113,13 @@ To run this command within a github Action, the following code is used:
114113
run: ./SparkFun_Flux/install-libs.sh
115114
```
116115

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.
118117

119118
### Compile and Build
120119

121120
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.
122121

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.
124123

125124
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
126125

@@ -145,4 +144,4 @@ For reference, once the above compile command is completed, the resultant Firmwa
145144
with:
146145
name: SparkFun_DataLoggerIoT.bin
147146
path: sfeDataLoggerIoT/build/esp32.esp32.esp32/SparkFun_DataLoggerIoT.bin
148-
```
147+
```

0 commit comments

Comments
 (0)