Skip to content

Commit

Permalink
Merge pull request #179 from sparkfun/develop
Browse files Browse the repository at this point in the history
includes some doc fixes, tweaks
  • Loading branch information
gigapod authored Nov 14, 2024
2 parents 77de1ad + 8f5ac90 commit 292b3a7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docs/build_with_flux.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The cmake build system creates the target Arduino Library, the library is either

A custom library is configured and built using the standard build tool `cmake`

### Install the *flux sdk*
### Install the flux sdk

The flux sdk is used to create a custom Arduino Library called ```SparkFun_Flux``` that is made available for use by the Arduino build environment. This allows tailoring which components are needed for the specific application - in this case the datalogger.

Expand Down
24 changes: 7 additions & 17 deletions docs/device_writing.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ The key capabilities provided by the implemented framework device class are:

The device class should following the naming pattern `flxDev[Name]`, where Name is a unique name of the class.

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

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

> Note - In some cases, because of the underlying Arduino Library design, an alternative > implementation pattern is required - such as object containment.
> Note - In some cases, because of the underlying Arduino Library design, an alternative implementation pattern is required - such as object containment.
### Example of a class definition

Expand All @@ -32,7 +32,7 @@ class flxDevBME280 : public flxDeviceI2CType<flxDevBME280>, public BME280
## Automatic Device Discovery
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.
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.
To accomplish this task, class level (static) methods and data are implemented by the device object. Each device class implements the following:
Expand All @@ -43,8 +43,6 @@ To accomplish this task, class level (static) methods and data are implemented b
|```uint8_t *getDefaultAddresses()``` | Return a list of addresses for the device. This list terminates with the value of ```kSparkDeviceAddressNull``` |
|```flxDeviceConfidence_t connectedConfidence()``` | Returns the confidence level of the drivers ```isConnected()``` algorithm. Values supported range from *Exact* to *Ping* |
> [!note]
>
>* Often the device implements the address list as a class level variable
>* It is common to define a constant or macro for the device name and return it from ```getDeviceName()```
Expand Down Expand Up @@ -93,7 +91,7 @@ This method returns a constant C string.

#### Connected Confidence

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

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.

Expand All @@ -111,8 +109,6 @@ The return value should be one of the following:
|```flxDevConfidenceFuzzy``` | The algorithm has high-confidence in a match, but it's not exact|
|```flxDevConfidencePing``` | An address "ping" is used - just detecting a device at a location, but not verifying the device type.|
> [!note]
>
> Only one device with a PING confidence is allowed at an address.
#### Example Method Definition
Expand All @@ -126,7 +122,7 @@ The class definition - ```flxDevBME280.h```
#define kBME280DeviceName "bme280";
// Define our class - note sub-classing from the Qwiic Library
class flxDevBME280 : public flxDevice<flxDevBME280>, public BME280
class flxDevBME280 : public flxDeviceI2CType<flxDevBME280>, public BME280
{
public:
Expand Down Expand Up @@ -160,7 +156,7 @@ class flxDevBME280 : public flxDevice<flxDevBME280>, public BME280
* This device defined its name, bme280, using the macro `kBME280DeviceName`
* Default device addresses are contained in a class variable ```defaultDeviceAddress[];```
* The method ```onInitialize()``` is called after the object is instantiated.
* The class subclasses from flxDevice, passing in the class name to the template. The class also subclasses from the Arduino Library class - ```BME280```
* The class subclasses from flxDeviceI2CType, passing in the class name to the template. The class also subclasses from the Arduino Library class - ```BME280```

### Auto Discovery - Class Implementation

Expand Down Expand Up @@ -204,8 +200,6 @@ flxDevBME280::flxDevBME280()
}
```

> [!note]
>
> * This example includes the implementation of ```defaultDeviceAddress[]```, the class variable holding the addresses for the device.
> * The device is registered before the class constructor
> * In the constructor, the device identity is set, which is based of runtime conditions.
Expand All @@ -223,8 +217,6 @@ bool flxDevBME280::isConnected(flxBusI2C &i2cDriver, uint8_t address)
}
```
> [!note]
>
> * 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
### Startup Sequence
Expand All @@ -251,8 +243,6 @@ bool flxDevBME280::onInitialize(TwoWire &wirePort)
}
```
> [!note]
>
> The ```address()``` method returns the device address for this instance of the driver.
### Determining if a Device is Initialized
Expand Down
26 changes: 7 additions & 19 deletions docs/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ The following types are available for properties
* bool
* int8
* int16
* int
* int32
* uint8
* uint16
* uint
* uint32
* float
* double
* string
Expand Down Expand Up @@ -51,8 +51,6 @@ For the framework, two types of Parameter classes exist.
* 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.
* Output Parameter - Defines a Parameter to get an output value from an operation

> [!note]
>
> The get and set operations on a parameter are mapped to methods implemented by the containing class.
### Input Parameter Objects
Expand All @@ -78,10 +76,10 @@ Where:
* #flxParameterInBool - bool parameter
* #flxParameterInInt8 - integer8 parameter
* #flxParameterInInt16 - integer16 parameter
* #flxParameterInInt - integer parameter
* #flxParameterInUint8 - unsigned integer8
* #flxParameterInUint16 - unsigned integer15
* #flxParameterInUint - unsigned integer
* #flxParameterInInt32 - integer parameter
* #flxParameterInUInt8 - unsigned integer8
* #flxParameterInUInt16 - unsigned integer15
* #flxParameterInUInt32 - unsigned integer
* #flxParameterInFloat - float
* #flxParameterInDouble - double
* #flxParameterInString - string -> std::string
Expand All @@ -99,8 +97,6 @@ Where:
* parameter_type - the type of the parameter (bool, int, uint, float, double, std::string)
* ClassName - the name of the containing class for the property

> [!note]
>
> By convention, writer method names are prefixed by ```write_```
##### Example
Expand All @@ -117,8 +113,6 @@ public:
}
```
> [!note]
>
> * By convention declaring the input writer method as private. This can be optional
> * The writer method must be declared before defining the parameter
> * The use of the `write_` prefix on the writer methods help identify the methods as supporting a parameter.
Expand Down Expand Up @@ -192,7 +186,7 @@ Using the example parameter from above:
```cpp
// Add valid values ...
my_input.addDataLimitValidValue("ONE K", 100.);
my_input.addDataLimitValidValue("ONE K", 100.);
my_input.addDataLimitValidValue("TWO K", 200.);
```

Or for an entire parameter list:
Expand Down Expand Up @@ -271,8 +265,6 @@ public:
}
```

> [!note]
>
> * By convention declaring the output reader method as private. This can be optional
> * The reader method must be declared before defining the parameter
> * The use of the `read_` prefix on the writer methods help identify the methods as supporting a parameter.
Expand Down Expand Up @@ -322,8 +314,6 @@ Where
* ClassName - the name of the containing class for the property
* On success, a true value is returned, false on error.
> [!note]
>
> By convention, reader method names are prefixed by ```read_```
In the reader methods, the data and dimensions of the array are set in the array object.
Expand Down Expand Up @@ -361,8 +351,6 @@ public:
}
```
> [!note]
>
> * By convention declaring the output reader method as private. This can be optional
> * The reader method must be declared before defining the parameter
> * The use of the `read_` prefix on the writer methods help identify the methods as supporting a parameter.
Expand Down
4 changes: 1 addition & 3 deletions docs/properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ public:
}
```
> [!note]
>
> * By convention the getters and setters are declared as private. This can be optional
> * The getter and setter methods must be declared before defining the property
> * The use of `set_` and `get_` prefixes on the setter and getter methods help identify the methods as supporting a property.
Expand Down Expand Up @@ -351,7 +349,7 @@ Simple Example:
```cpp
// Add valid values ...
my_property.addDataLimitValidValue("ONE K", 100.);
my_property.addDataLimitValidValue("ONE K", 100.);
my_property.addDataLimitValidValue("TWO K", 200.);
```

Or for an entire parameter list:
Expand Down

0 comments on commit 292b3a7

Please sign in to comment.