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

@@ -11,22 +11,25 @@ namespace sta
*
* @ingroup sta_core_i2c
*/
class I2cDevice : public Device
class I2CDevice : public Device
{
public:
/**
* @param intf %I2C hardware interface
* @param csPin The peripheral's address.
*/
I2cDevice(I2c * intf, int addr);
I2CDevice(I2C * intf, int address, bool master=false, bool blocking=true);
protected:
void select() override;
void deselect() override;
private:
int addr_; /**< device address */
I2C * intf_;
int address_; /**< device address */
int master_;
int blocking_;
};
} // namespace sta
@@ -34,4 +37,4 @@ namespace sta
#endif // STA_CORE_I2C_DEVICE_HPP
#endif // STA_CORE_I2C_DEVICE_HPP

View File

@@ -16,18 +16,24 @@ namespace sta
*
* @ingroup sta_core_i2c
*/
class I2c : public Interface
class I2C : public Interface
{
public:
I2c(Mutex * mutex=nullptr);
I2C(Mutex * mutex=nullptr);
/**
* @brief Address selection for the I2C bus.
*
* @param address The address to select.
* @brief Specify the mode of communication via the bus.
*
* @param master
* @param blocking
*/
virtual void selectAddress(uint16_t address) = 0;
void setSettings(uint16_t address, bool master, bool blocking);
protected:
uint16_t address_;
bool master_;
bool blocking_;
};
} // namespace sta
#endif // STA_CORE_I2C_I2C_HPP
#endif // STA_CORE_I2C_I2C_HPP

View File

@@ -83,4 +83,4 @@ namespace sta
} // namespace sta
#endif // STA_CORE_BUS_SERIAL_INTERFACE_HPP
#endif // STA_CORE_BUS_SERIAL_INTERFACE_HPP