| ... | ... | @@ -185,7 +185,7 @@ private: |
|
|
|
- It is good practice to provide 2 constructors: one which initializes the `SPIBusConfig` with the sensor's default parameters, the other that accepts a custom `SPIBusConfig` from outside.
|
|
|
|
- Constructors must accept a **reference** to `SPIBusInterface`. **Do not** pass it by value (it will not compile) and **do not** use `SPIBus` instead of `SPIBusInterface`, to allow for greater flexibility.
|
|
|
|
- `SPITransaction` must be instantiated inside a method scope. Do not instantiate and store it at class level (eg, do not store it in a local class variable).
|
|
|
|
- Reason: other sensor may access the bus (and change its configuration) between calls to `sample()` (or other methods that access the bus), so the bus must be reconfigured by instantiation a new `SPITransaction` before accessing it.
|
|
|
|
- Reason: other sensor may access the bus (and change its configuration) between calls to `sample()` (or other methods that access the bus), so the bus must be reconfigured by instantiating a new `SPITransaction` before accessing it.
|
|
|
|
|
|
|
|
### Low level acccess through SPIBusInterface
|
|
|
|
|
| ... | ... | |