mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-06 10:27:34 +00:00
Fixed broken imports after dir structure rework & added stm32 i2c
This commit is contained in:
44
include/sta/devices/stm32/bus/i2c.hpp
Normal file
44
include/sta/devices/stm32/bus/i2c.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef STA_CORE_STM32_I2C_HPP
|
||||
#define STA_CORE_STM32_I2C_HPP
|
||||
|
||||
#include <sta/config.hpp>
|
||||
#ifdef STA_PLATFORM_STM32
|
||||
# include <sta/devices/stm32/hal.hpp>
|
||||
# ifdef HAL_I2C_MODULE_ENABLED
|
||||
# define STA_STM32_I2C_ENABLED
|
||||
# endif // HAL_SPI_MODULE_ENABLED
|
||||
#endif // STA_PLATFORM_STM32
|
||||
|
||||
#ifdef STA_STM32_I2C_ENABLED
|
||||
|
||||
#include <sta/bus/i2c/i2c.hpp>
|
||||
#include <sta/bus/i2c/device.hpp>
|
||||
|
||||
namespace sta
|
||||
{
|
||||
class STM32I2C : public I2C
|
||||
{
|
||||
public:
|
||||
STM32I2C(I2C_HandleTypeDef * handle, Mutex * mutex=nullptr);
|
||||
|
||||
void transfer(uint8_t value) override;
|
||||
void transfer16(uint16_t value) override;
|
||||
void transfer(const uint8_t * buffer, size_t size) override;
|
||||
void transfer(const uint8_t * txBuffer, uint8_t * rxBuffer, size_t size) override;
|
||||
void receive(uint8_t * buffer, size_t size) override;
|
||||
|
||||
void fill(uint8_t value, size_t count) override;
|
||||
private:
|
||||
I2C_HandleTypeDef * handle_;
|
||||
const uint32_t timeout_ = HAL_MAX_DELAY;
|
||||
};
|
||||
|
||||
class STM32I2CDevice : public I2CDevice
|
||||
{
|
||||
STM32I2CDevice();
|
||||
};
|
||||
}
|
||||
|
||||
#endif // STA_STM32_I2C_ENABLED
|
||||
|
||||
#endif // STA_CORE_STM32_I2C_HPP
|
Reference in New Issue
Block a user