Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Stm32I2C.hxx
Go to the documentation of this file.
1
36#ifndef _FREERTOS_DRIVERS_ST_STM32I2C_HXX_
37#define _FREERTOS_DRIVERS_ST_STM32I2C_HXX_
38
39#include "I2C.hxx"
40
41#include "stm32f_hal_conf.hxx"
42
45class Stm32I2C : public I2C
46{
47public:
54 Stm32I2C(const char *name, I2C_TypeDef *port, uint32_t ev_interrupt,
55 uint32_t er_interrupt);
56
60 {
61 }
62
65 {
66 HAL_I2C_EV_IRQHandler(&i2cHandle_);
67 }
68
71 {
72 HAL_I2C_ER_IRQHandler(&i2cHandle_);
73 }
74
76 inline void complete_from_isr();
78 inline void error_from_isr();
79
80private:
81 void enable() override {}
82 void disable() override {}
89 int transfer(struct i2c_msg *msg, bool stop) override;
90
92 I2C_HandleTypeDef i2cHandle_;
94 int error_;
97
101
103};
104
105#endif // _FREERTOS_DRIVERS_ST_STM32I2C_HXX_
const char * name
device name
Definition Devtab.hxx:266
Private data for an I2C device.
Definition I2C.hxx:51
This class provides a counting semaphore API.
Definition OS.hxx:243
Specialization of I2C driver for STM32 devices.
Definition Stm32I2C.hxx:46
void error_interrupt_handler()
Call this function from the specific i2c interrupt routine in HwInit.
Definition Stm32I2C.hxx:70
I2C_HandleTypeDef i2cHandle_
Stm32 HAL device structure.
Definition Stm32I2C.hxx:92
void error_from_isr()
Internal. This function is called from the error ISR callback.
Definition Stm32I2C.cxx:270
void disable() override
function to disable device
Definition Stm32I2C.hxx:82
OSSem sem
Semaphore to wakeup task level from ISR.
Definition Stm32I2C.hxx:96
void enable() override
function to enable device
Definition Stm32I2C.hxx:81
Stm32I2C()
Default constructor.
~Stm32I2C()
Destructor.
Definition Stm32I2C.hxx:59
int error_
Pending transfer error field.
Definition Stm32I2C.hxx:94
void event_interrupt_handler()
Call this function from the specific i2c interrupt routine in HwInit.
Definition Stm32I2C.hxx:64
void complete_from_isr()
Internal. This function is called from the complete ISR callback.
Definition Stm32I2C.cxx:263
int transfer(struct i2c_msg *msg, bool stop) override
Method to transmit/receive the data.
Definition Stm32I2C.cxx:202
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
Definition macros.h:171