Skip to content

Commit 7a157a5

Browse files
committed
latest and greatest - with more detail on arduino impl
1 parent 376dc5d commit 7a157a5

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

docs/ar_ibus.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ The interface methods:
3838
**readRegisterWord** | Read a word of data from a particular register of a device |
3939
**readRegisterRegion** | Read an array of data from a particular register of a device |
4040

41+
> Note: This interface only defines the methods to read and write data on the given bus. Any address, or bus specific settings is provided/implemented by the implementation/specialization of this interface.
42+
4143
### The sfeTkII2C Implementation
4244

4345
This class sub-classes from the ```sfeTkIBus``` interface adding additional functionally focused on supporting an I2C implementation. This interface provides the additional functionality.
@@ -48,7 +50,7 @@ This class sub-classes from the ```sfeTkIBus``` interface adding additional func
4850
**setAddress** | Set the I2C address to use for this I2C object |
4951
**address** | Returns the address used by this I2C object |
5052

51-
> Note: The ```sfeTkII2C``` class manages the I2C address
53+
> Note: The ```sfeTkII2C``` class manages the device address for the I2C bus. As such, each I2C device instantiates/uses a instance of the ```sfeTkII2C``` class.
5254
5355
### The sfeTkISPI Implementation
5456

@@ -59,15 +61,51 @@ This class sub-classes from the ```sfeTkIBus``` interface adding additional func
5961
**setCS** | Set the CS Pin to use for this SPI object |
6062
**cs** | Returns the CS Pin used by this SPI object |
6163

62-
> Note: The ```sfeTkISPI``` class manages the CS Pin
64+
> Note: The ```sfeTkISPI``` class manages CS Pin for the SPI bus. As such, each SPI device instantiates/uses a instance of the ```sfeTkISPI``` class.
6365
6466
The class diagram of these base class interfaces/implementation:
6567

6668
![IBus diagram](images/tk_IBUS.png)
6769

70+
## sfeTkIIBus - Arduino Implementation
71+
72+
The initial implementation of the toolkit IBus interface is for the Arduino environment. This implementation consists of two classes, ```sfeTkArdI2C``` and ```sfeTkArdSPI```, each of which sub-class from their respective bus type interfaces within the core toolkit.
73+
74+
These driver implementations provide the platform specific implementation for the toolkit bus interfaces, supporting the methods defined by the interfaces, as well as contain and manage the platform specific settings and attributes for each bus type.
75+
76+
> Note: The intent is that each user of an particular bus - a device in most cases - contains an instance of the specific bus object.
77+
78+
The class diagram for the Arduino implementation is as follows:
79+
80+
![Arduino IBus Implementation](images/tk_ibus_ard.png)
81+
82+
### The sfeTkArdI2C Class
83+
84+
This class provides the Arduino implementation of I2C in the SparkFun Toolkit. It implements the methods of the ```sfeTkIIBus``` and ```sfeTkII2C``` interfaces, as well as manages any Arduino specific state.
85+
86+
### The sfeTkArdSPI Class
87+
88+
This class provides the Arduino implementation of SPI in the SparkFun Toolkit. It implements the methods of the ```sfeTkIIBus``` and ```sfeTkISPI``` interfaces, as well as manages any Arduino specific state for the SPI bus - namely the SPISettings class.
89+
90+
Before each use of the SPI bus, the methods of the ```sfeTkArdSPI``` uses an internal SPISettings class to ensure the SPI bus is operating in the desired mode for the device.
91+
6892
## sfeTkIBus Use
6993

70-
The general steps when using the sfeTkIBus in device development are outlined in the following steps
94+
The general steps when using the sfeTkIBus in device development are outlined in the following steps. This example uses the Arduino implementation of the bus.
95+
96+
The general pattern for a device driver implementation that uses the SparkFun Toolkit is the following:
97+
98+
### Implement a Platform Independent Driver
99+
100+
The first step is to implement a core, platform independent version of the driver that communicates to the target device using the methods of a ```sfeTkIIBus``` interface.
101+
102+
>[!IMPORTANT]
103+
> At this level, the driver is only using a ```sfeTkIBus``` interface, not any specific bus implementation.
104+
105+
This driver has the following unique functionality:
106+
107+
1) A method to set the object that implements the ```sfeTkIBus``` interface object should use. Since
108+
1) If the device supports identification capabilities, the driver provides this functionality.
71109

72110
### Platform Independent/Bus Independent Driver
73111

docs/images/tk_ibus_ard.png

198 KB
Loading

0 commit comments

Comments
 (0)