Skip to content

Commit 15b6ce0

Browse files
committed
finish details
1 parent c5e3271 commit 15b6ce0

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

docs/ar_ibus.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ This class sub-classes from the ```sfeTkIBus``` interface adding additional func
5252
**address** | Returns the address used by this I2C object |
5353

5454
> [!NOTE]
55-
> The ```sfeTkII2C``` class manages the device address for the I2C bus. As such, each I2C device instantiates/uses a instance of the ```sfeTkII2C``` class.
55+
> The ```sfeTkII2C``` class manages the device address for the I2C bus. As such, each I2C device instantiates/uses an instance of the ```sfeTkII2C``` class.
5656
5757
### The sfeTkISPI Implementation
5858

@@ -64,7 +64,7 @@ This class sub-classes from the ```sfeTkIBus``` interface adding additional func
6464
**cs** | Returns the CS Pin used by this SPI object |
6565

6666
> [!NOTE]
67-
> The ```sfeTkISPI``` class manages CS Pin for the SPI bus. As such, each SPI device instantiates/uses a instance of the ```sfeTkISPI``` class.
67+
> The ```sfeTkISPI``` class manages CS Pin for the SPI bus. As such, each SPI device instantiates/uses an instance of the ```sfeTkISPI``` class.
6868
6969
The class diagram of these base class interfaces/implementation:
7070

@@ -111,9 +111,7 @@ This driver has the following unique functionality:
111111
1) A method to set the object that implements the ```sfeTkIBus``` interface object should use. Since
112112
1) If the device supports identification capabilities, the driver provides this functionality.
113113

114-
### Platform Independent/Bus Independent Driver
115-
116-
Develop a platform independent version of a device driver that commutates using the sfeTkIBus interface. This driver should include a method to set the bus object, accepting a pointer to a sfeTkIBus interface/object. Actual bus setup is provided outside of the driver.
114+
#### SImple Example of an Independent Driver Implementation
117115

118116
This implementation would take the following form:
119117

@@ -160,7 +158,17 @@ private:
160158
161159
This driver sub-classes from the general/core driver class, builds and configures the desired bus object and passes this into the core driver.
162160
163-
Basic concept - creating an I2C class in Arduino
161+
The key concepts for these Platform specific drivers include:
162+
163+
1) Perform any platform specific bus setup during the instantiation of the device. This might just be setting the target (pin, address) for the device on the bus.
164+
1) Implement any bus specific device identification use at this level. For example, on I2C, a ping call might be made on the bus before a more detailed identification method is used.
165+
166+
#### Basic concept - creating an I2C class in Arduino
167+
168+
The following is an example of an I2C class in Arduino based on the previous platform independent driver.
169+
170+
> [!NOTE]
171+
> This class implements a ```isConnected()``` method that calls the ```ping()``` method of the I2C bus class being used, and if this passes, then calls the ```checkDeviceID()``` method of the superclass.
164172
165173
```c++
166174
@@ -179,7 +187,7 @@ class myArduinoDriverI2C : public myDriverClass
179187
return myDriverClass::begin();
180188
}
181189
182-
bool ping()
190+
bool isConnected()
183191
{
184192
if (!_theI2CBus.ping())
185193
return false;
@@ -192,7 +200,12 @@ private:
192200
};
193201
```
194202

195-
Basic concept - creating an SPI class in Arduino
203+
#### Basic concept - creating an SPI class in Arduino
204+
205+
The following is a SPI version of the driver implemented in Arduino. While similar to the I2C implementation, it focuses on the specific needs of the SPI bus, specifically the ```SPISettings``` this particular device requires when using the SPI bus.
206+
207+
> [!NOTE]
208+
> This class implements a ```isConnected()``` method that just calls the superclasses ```checkDeviceID()``` method to determine if the device is available on the bus.
196209
197210
```c++
198211

@@ -213,7 +226,7 @@ class myArduinoDriveSPI : public myDriverClass
213226
return myDriverClass::begin();
214227
}
215228

216-
bool ping()
229+
bool isConnected()
217230
{
218231
return checkDeviceID();
219232
}

0 commit comments

Comments
 (0)