@@ -37,14 +37,12 @@ namespace arduino
37
37
class HardwareI2C ;
38
38
}
39
39
40
- class BusDeviceBase ;
40
+ class BusDevice ;
41
41
42
42
/* *************************************************************************************
43
43
* TYPEDEF
44
44
**************************************************************************************/
45
45
46
- typedef mbed::SharedPtr<BusDeviceBase> BusDevice;
47
-
48
46
/* *************************************************************************************
49
47
* CLASS DECLARATION
50
48
**************************************************************************************/
@@ -68,4 +66,31 @@ class BusDeviceBase
68
66
69
67
};
70
68
69
+ class BusDevice
70
+ {
71
+ public:
72
+ BusDevice (BusDeviceBase* dev) : instance(dev) {};
73
+ /*
74
+ BusDevice(arduino::HardwareSPI & spi, int const cs_pin, SPISettings const & spi_settings, byte const fill_symbol = 0xFF) {
75
+ this = BusDeviceBase::create(spi, cs_pin, spi_settings, fill_symbol);
76
+ }
77
+ BusDevice(arduino::HardwareSPI & spi, int const cs_pin, uint32_t const spi_clock, BitOrder const spi_bit_order, SPIMode const spi_bit_mode, byte const fill_symbol = 0xFF);
78
+ BusDevice(arduino::HardwareSPI & spi, SpiBusDeviceConfig::SpiSelectFunc spi_select, SpiBusDeviceConfig::SpiDeselectFunc spi_deselect, SPISettings const & spi_settings, byte const fill_symbol = 0xFF);
79
+ */
80
+ // BusDevice(BusDevice&&) = default;
81
+ BusDevice (arduino::HardwareI2C & wire, byte const slave_addr) {
82
+ *this = BusDeviceBase::create (wire, slave_addr);
83
+ }
84
+ /*
85
+ BusDevice(arduino::HardwareI2C & wire, byte const slave_addr, bool const restart);
86
+ BusDevice(arduino::HardwareI2C & wire, byte const slave_addr, bool const restart, bool const stop);
87
+ */
88
+ IoResponse transfer (IoRequest & req) {
89
+ return instance->transfer (req);
90
+ };
91
+
92
+ private:
93
+ mbed::SharedPtr<BusDeviceBase> instance;
94
+ };
95
+
71
96
#endif /* BUS_DEVICE_H_ */
0 commit comments