You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/ar_ibus.md
+98Lines changed: 98 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,3 +43,101 @@ The first implementation of the IBus interface is for the Arduino development en
43
43
The results is outlined in the following class diagram:
44
44
45
45

46
+
47
+
## sfeTkIBus Use
48
+
49
+
The general steps when using the sfeTkIBus in device development are outlined in the following steps
50
+
51
+
### Platform Independent/Bus Independent Driver
52
+
53
+
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.
54
+
55
+
This implementation would take the following form:
56
+
57
+
```c++
58
+
59
+
classmyDriverClass
60
+
{
61
+
public:
62
+
63
+
myDriverClass(uint8_t address) : _addr{address}{}
64
+
65
+
bool begin()
66
+
{
67
+
// initialize things ...
68
+
69
+
return true;
70
+
}
71
+
void setCommunicationBus(sfeTkIBus *theBus)
72
+
{
73
+
_theBus = theBus;
74
+
}
75
+
76
+
bool updateDeviceData(uint8_t *data, size_t len)
77
+
{
78
+
if (!_theBus || !data || len == 0)
79
+
return false;
80
+
81
+
int status = _theBus->writeRegisterRegion(_addr, THE_REG, data, len);
82
+
83
+
return (status == 0);
84
+
}
85
+
private:
86
+
sfeTkIBus *_theBus
87
+
uint8_t _addr;
88
+
};
89
+
```
90
+
91
+
### Write a Platform Specific Driver, based on the core driver
92
+
93
+
This driver sub-classes from the general/core driver class, builds and configures the desired bus object and passes this into the core driver.
0 commit comments