eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc_lpi2c_slave_transport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022-2023 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _EMBEDDED_RPC__LPI2C_SLAVE_TRANSPORT_H_
10 #define _EMBEDDED_RPC__LPI2C_SLAVE_TRANSPORT_H_
11 
12 #include "erpc_config_internal.h"
13 #if ERPC_THREADS
14 #include "erpc_threading.h"
15 #endif
17 
18 extern "C" {
19 #include "fsl_gpio.h"
20 #include "fsl_lpi2c.h"
21 }
22 
29 // Classes
32 
33 namespace erpc {
40 {
41 public:
49  LPI2cSlaveTransport(LPI2C_Type *lpi2cBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz);
50 
54  virtual ~LPI2cSlaveTransport(void);
55 
61  virtual erpc_status_t init(void);
62 
68  void transfer_cb(void);
69 
70 protected:
71  LPI2C_Type *m_lpi2cBaseAddr;
72  uint32_t m_baudRate;
73  uint32_t m_srcClock_Hz;
74  bool m_isInited;
75 #if ERPC_THREADS
77 #endif
78 
79 private:
82 
92  virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) override;
93 
103  virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) override;
104 };
105 
106 } // namespace erpc
107 
110 #endif // _EMBEDDED_RPC__LPI2C_SLAVE_TRANSPORT_H_
Base class for framed transport layers.
Definition: erpc_framed_transport.hpp:56
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
LPI2C_Type * m_lpi2cBaseAddr
Definition: erpc_lpi2c_slave_transport.hpp:71
Very basic transport to send/receive messages via LPI2C.
Definition: erpc_lpi2c_slave_transport.hpp:39
virtual erpc_status_t init(void)
Initialize LPI2C peripheral configuration structure with values specified in LPI2cTransport construct...
Definition: erpc_lpi2c_slave_transport.cpp:160
uint32_t m_baudRate
Definition: erpc_lpi2c_slave_transport.hpp:72
virtual ~LPI2cSlaveTransport(void)
Destructor.
Definition: erpc_lpi2c_slave_transport.cpp:150
virtual erpc_status_t underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when receiving data.
Definition: erpc_framed_transport.cpp:177
Semaphore m_txrxSemaphore
Definition: erpc_lpi2c_slave_transport.hpp:76
uint32_t m_srcClock_Hz
Definition: erpc_lpi2c_slave_transport.hpp:73
Definition: erpc_arbitrated_client_manager.hpp:25
void transfer_cb(void)
Function called from LPI2C_SlaveUserCallback when LPI2C transfer is completed.
Definition: erpc_lpi2c_slave_transport.cpp:95
virtual erpc_status_t underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when sending data.
Definition: erpc_framed_transport.cpp:170
bool m_isInited
Definition: erpc_lpi2c_slave_transport.hpp:74
LPI2cSlaveTransport(LPI2C_Type *lpi2cBaseAddr, uint32_t baudRate, uint32_t srcClock_Hz)
Constructor.
Definition: erpc_lpi2c_slave_transport.cpp:140
Simple semaphore class.
Definition: erpc_threading.h:442