Fixed broken imports after dir structure rework & added stm32 i2c

This commit is contained in:
dvdb97
2023-06-24 15:44:56 +02:00
parent 6b4acfd27b
commit e7ddbbf365
26 changed files with 224 additions and 150 deletions

View File

@@ -5,19 +5,20 @@
namespace sta
{
I2cDevice::I2cDevice(I2c * intf, int addr)
: Device{intf}, addr_{addr}
I2CDevice::I2CDevice(I2C * intf, int address, bool master, bool blocking)
: Device{intf}, intf_{intf}, address_{address}, master_{master}, blocking_{blocking}
{
STA_ASSERT(intf != nullptr);
}
void I2cDevice::select()
void I2CDevice::select()
{
// TODO: Implement address selection here?
// Initialize the interface to match the device's settings.
intf_->setSettings(address_, master_, blocking_);
}
void I2cDevice::deselect()
void I2CDevice::deselect()
{
// TODO: Implement address deselection here?
// Nothing to do here.
}
} // namespace sta

View File

@@ -3,9 +3,16 @@
namespace sta
{
I2c::I2c(Mutex * mutex=nullptr)
I2C::I2C(Mutex * mutex)
: Interface{mutex}
{
}
} // namespace sta
void I2C::setSettings(uint16_t address, bool master, bool blocking)
{
address_ = address;
master_ = master;
blocking_ = blocking;
}
} // namespace sta