Dominik Tlapak
/
I2C
V1.0
Diff: main.cpp
- Revision:
- 3:5a3eedf8ad2d
- Parent:
- 2:bc5080fc7926
diff -r bc5080fc7926 -r 5a3eedf8ad2d main.cpp --- a/main.cpp Tue Oct 06 16:57:27 2020 +0000 +++ b/main.cpp Tue Oct 06 17:23:29 2020 +0000 @@ -1,10 +1,10 @@ #include "mbed.h" -class MyClass1 +class MyClass { public: - MyClass1() : m_messwert(0.0) {} - ~MyClass1() {} + MyClass() : m_messwert(0.0) {} + ~MyClass() {} double getMesswert() { return m_messwert; @@ -13,21 +13,43 @@ double m_messwert; }; +class MyClassA +{ +public: + MyClassA(int x, bool wahr) : m_x(x), m_wahr(wahr) {} + int getx() {return m_x;} + +private: + int m_x; + bool m_wahr; +}; + class I2CSensor { -private: - char m_data[4]; public: - I2CSensor(PinName sda, PinName scl) : i2c(sda, scl) {} + I2CSensor(PinName sda, PinName scl) : m_i2c(sda, scl) {} ~I2CSensor() {} - inline float read(uint8_t adress) - { - I2C.read(adress,m_data,4,false); - return (float)m_data; - }; + inline float read() {return 0.0f;} private: - I2C i2c; +I2C m_i2c; +}; +class MyClassC +{ + private: + const int m_a; + int& m_b; + int m_c; + int m_d; + + public: + MyClassC(int& refB) : m_a(5), m_b(refB), m_d(0) { + m_c = 20; + } + + static int foo() { + return 10; + } };