| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_i2c_slave_transport.h
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 "erpc_config_internal.h"
13 #if ERPC_THREADS
14 #include "erpc_threading.h"
15 #endif
16 #include "erpc_framed_transport.h"
17
18 #include "fsl_gpio.h"
19 #include "fsl_i2c.h"
20
21 #include <stdlib.h>
22
29 // Classes
32
33 namespace erpc {
39 class I2cSlaveTransport : public FramedTransport
40 {
41 public:
49 I2cSlaveTransport(I2C_Type *i2cBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz);
50
54 virtual ~I2cSlaveTransport(void);
55
61 virtual erpc_status_t init(void);
62
68 void transfer_cb(void);
69
70 protected:
71 I2C_Type *m_i2cBaseAddr;
72 uint32_t m_baudRate;
73 uint32_t m_srcClock_Hz;
74 bool m_isInited;
75 #if ERPC_THREADS
76 Semaphore m_txrxSemaphore;
77 #endif
78
79 private:
89 virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size);
90
100 virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size);
101 };
102
103 } // namespace erpc
104
107 #endif // _EMBEDDED_RPC__I2C_SLAVE_TRANSPORT_H_
erpc::I2cSlaveTransport::m_txrxSemaphore
Semaphore m_txrxSemaphore
Definition: erpc_i2c_slave_transport.h:76
erpc::FramedTransport
Base class for framed transport layers.
Definition: erpc_framed_transport.h:56
erpc::I2cSlaveTransport
Very basic transport to send/receive messages via I2C.
Definition: erpc_i2c_slave_transport.h:39
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc_framed_transport.h
erpc::I2cSlaveTransport::transfer_cb
void transfer_cb(void)
Function called from I2C_SlaveUserCallback when I2C transfer is completed.
Definition: erpc_i2c_slave_transport.cpp:91
erpc::I2cSlaveTransport::m_i2cBaseAddr
I2C_Type * m_i2cBaseAddr
Definition: erpc_i2c_slave_transport.h:71
erpc::I2cSlaveTransport::m_srcClock_Hz
uint32_t m_srcClock_Hz
Definition: erpc_i2c_slave_transport.h:73
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc_threading.h
erpc::I2cSlaveTransport::m_baudRate
uint32_t m_baudRate
Definition: erpc_i2c_slave_transport.h:72
erpc::I2cSlaveTransport::I2cSlaveTransport
I2cSlaveTransport(I2C_Type *i2cBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
Constructor.
Definition: erpc_i2c_slave_transport.cpp:135
erpc::I2cSlaveTransport::m_isInited
bool m_isInited
Definition: erpc_i2c_slave_transport.h:74
erpc::I2cSlaveTransport::~I2cSlaveTransport
virtual ~I2cSlaveTransport(void)
Destructor.
Definition: erpc_i2c_slave_transport.cpp:147
erpc::I2cSlaveTransport::init
virtual erpc_status_t init(void)
Initialize I2C peripheral configuration structure with values specified in I2cTransport constructor...
Definition: erpc_i2c_slave_transport.cpp:157
erpc::Semaphore
Simple semaphore class.
Definition: erpc_threading.h:411