mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
I2C Error fixes
This commit is contained in:
parent
08e61cb300
commit
94f9cdd884
@ -10,12 +10,13 @@ namespace sta {
|
|||||||
uint16_t address;
|
uint16_t address;
|
||||||
Mutex* mutex;
|
Mutex* mutex;
|
||||||
bool master;
|
bool master;
|
||||||
|
bool blocking;
|
||||||
public:
|
public:
|
||||||
I2cDevice(uint16_t address_10bit, Mutex* mutex=nullptr, bool master=false);
|
I2cDevice(uint16_t address_10bit, Mutex* mutex=nullptr, bool master=false, bool blocking=true);
|
||||||
|
|
||||||
virtual bool transmit(uint8_t* data, uint16_t size, bool blocking=true) = 0;
|
virtual bool transmit(uint8_t* data, uint16_t size) = 0;
|
||||||
|
|
||||||
virtual bool receive(uint8_t* data, uint16_t size, bool blocking=true) = 0;
|
virtual bool receive(uint8_t* data, uint16_t size) = 0;
|
||||||
|
|
||||||
virtual void acquire();
|
virtual void acquire();
|
||||||
|
|
||||||
@ -23,4 +24,4 @@ namespace sta {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // #ifdef STA_I2C_HPP
|
#endif // STA_I2C_HPP
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include <sta/i2c.hpp>
|
#include <sta/i2c.hpp>
|
||||||
|
|
||||||
namespace sta {
|
namespace sta {
|
||||||
I2cDevice::I2cDevice(uint16_t address_7bit, Mutex* mutex, bool master) {
|
I2cDevice::I2cDevice(uint16_t address_7bit, Mutex* mutex, bool master, bool blocking) {
|
||||||
this->address = address_7bit << 1;
|
this->address = address_7bit << 1;
|
||||||
this->mutex = mutex;
|
this->mutex = mutex;
|
||||||
this->master = master;
|
this->master = master;
|
||||||
|
this->blocking = blocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2cDevice::acquire() {
|
void I2cDevice::acquire() {
|
||||||
@ -18,4 +19,4 @@ namespace sta {
|
|||||||
mutex->release();
|
mutex->release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user