eRPC API Reference
Rev. 1.11.0
NXP Semiconductors
Main Page
API Reference
Classes
Files
File List
File Members
erpc_i2c_slave_transport.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2021 NXP
3
* All rights reserved.
4
*
5
*
6
* SPDX-License-Identifier: BSD-3-Clause
7
*/
8
9
#ifndef _EMBEDDED_RPC__I2C_SLAVE_TRANSPORT_H_
10
#define _EMBEDDED_RPC__I2C_SLAVE_TRANSPORT_H_
11
12
#include "<cstdlib>
"
13
#include "
erpc_config_internal.h
"
14
#if ERPC_THREADS
15
#include "
erpc_threading.h
"
16
#endif
17
#include "
erpc_framed_transport.hpp
"
18
19
extern "
C
" {
20
#include "
fsl_gpio.h
"
21
#include "
fsl_i2c.h
"
22
}
23
30
// Classes
33
34
namespace erpc {
40
class I2cSlaveTransport : public FramedTransport
41
{
42
public:
50
I2cSlaveTransport(I2C_Type *i2cBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz);
51
55
virtual ~I2cSlaveTransport(void);
56
62
virtual erpc_status_t init(void);
63
69
void transfer_cb(void);
70
71
protected:
72
I2C_Type *m_i2cBaseAddr; /*!< Base address of I2C peripheral used in this transport layer */
73
uint32_t m_baudRate; /*!< Baud rate of I2C peripheral used in this transport layer */
74
uint32_t m_srcClock_Hz; /*!< Source clock of I2C peripheral used in this transport layer */
75
bool m_isInited; /*!< the I2C peripheral init status flag */
76
#if ERPC_THREADS
77
Semaphore m_txrxSemaphore; /*!< Semaphore used by RTOS to block task until the sending/receiving is not complete */
78
#endif
79
80
private:
90
virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size);
91
101
virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size);
102
};
103
104
} // namespace erpc
105
108
#endif // _EMBEDDED_RPC__I2C_SLAVE_TRANSPORT_H_
Copyright 2016-2020 NXP Semiconductors. All rights reserved.