Skip to content

Commit 05f53db

Browse files
committed
docs for the bus type
1 parent d2b9177 commit 05f53db

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

docs/ar_ibus.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Overview - Device Bus interface - sfeTKIBus
2+
3+
One of the foundational capabilities of the SparkFun Toolkit is bus communication with devices. This is a common task almost all libraries implement using their own implementation for I2C, SPI or UART bus communication.
4+
5+
For bus communication, the SparkFun Toolkit is designed to provide a common implementation for use across all SparkFun libraries. Additionally, the bus architecture is modeled on a *driver* pattern, separating the individual bus setup/configuration from data communication, enabling a single device implementation to easily support a variety of device bus types.
6+
7+
The key goals set for the Bus implementation in the Toolkit include:
8+
9+
* Separate device setup from device communication
10+
* Define a common bus interface for use across a variety of common device bus types
11+
* Deliver support for both SPI and I2C bus types initially, focusing on Arduino
12+
* Structure the bus/toolkit implementation such that it's platform independent
13+
14+
## Architecture Overview
15+
16+
To meet the goals for this subsystem, the Flux framework follows a ***Driver Pattern***, defining a common interface for bus communication. Device drivers are designed around this interface, leaving bus configuration and implementation to platform specific implementation.
17+
18+
The key class to support this pattern are:
19+
20+
| | |
21+
|------|-------|
22+
**sfeTkIBus** | A virtual C++ class that device the bus ```sfeTkIBus``` interface |
23+
**sfeTkBusI2C** | Provides an Arduino I2C implementation for the toolkit |
24+
**sfeTkBusSPI** | Provides an Arduino SPI implementation for the toolkit |
25+
26+
### The sfeTkIBus Interface
27+
28+
The key to meeting the goals of the Toolkit is the IBus interface. This interface defines the methods used to communicate with a device. The setup, configuration and implementation of this interface is performed by platform specific implementations of the interface.
29+
30+
The interface methods:
31+
32+
| Method| Definition |
33+
|------|-------|
34+
**ping** | A method used to determine if a device is connected to the bus |
35+
**writeRegisterByte** | Write a byte of data to a particular register of a device |
36+
**writeRegisterRegion** | Write an array of data to a particular register of a device|
37+
**readRegisterRegion** | Read an array of data from a particular register of a device |
38+
39+
### Arduino Implementation
40+
41+
The first implementation of the IBus interface is for the Arduino development environment, as noted above. The implementation consists of two classes, ```sfeTkBusI2C``` and ```sfeTkBusSPI```, each implementing the sfeTkIBus interface using the Arduino SDK.
42+
43+
The results is outlined in the following class diagram:
44+
45+
![Device Class](images/sfetk_ibus_class.png)

docs/docs.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)