From c5e4fd39ecbd9bb8bd870c33d2950c9c48e986dd Mon Sep 17 00:00:00 2001 From: dvdb97 Date: Sat, 6 May 2023 15:44:29 +0200 Subject: [PATCH] Reformatted class I2cDevice to match SPIDevice --- include/sta/i2c.hpp | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/include/sta/i2c.hpp b/include/sta/i2c.hpp index db467dd..aa023fd 100644 --- a/include/sta/i2c.hpp +++ b/include/sta/i2c.hpp @@ -1,17 +1,18 @@ -#ifndef STA_I2C_HPP -#define STA_I2C_HPP +#ifndef STA_CORE_I2C_HPP +#define STA_CORE_I2C_HPP #include #include -namespace sta { - class I2cDevice { - protected: - uint16_t address; - Mutex* mutex; - bool master; - bool blocking; +namespace sta +{ + /** + * @brief Interface class for %SPI Hardware. + */ + class I2cDevice + { public: + I2cDevice(uint16_t address_10bit, Mutex* mutex=nullptr, bool master=false, bool blocking=true); virtual bool transmit(uint8_t* data, uint16_t size) = 0; @@ -21,7 +22,13 @@ namespace sta { virtual void acquire(); virtual void release(); - }; -} -#endif // STA_I2C_HPP + protected: + uint16_t address; + Mutex* mutex; + bool master; + bool blocking; + }; +} // namespace sta + +#endif // STA_CORE_I2C_HPP