F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
I2cPortAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title I2cPortAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for I2c port
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 
11 namespace Drv {
12 
13  // ----------------------------------------------------------------------
14  // Input Port Member functions
15  // ----------------------------------------------------------------------
16 
18  InputI2cPort() :
19  Fw::InputPortBase(),
20  m_func(nullptr)
21  {
22 
23  }
24 
26  init()
27  {
29  }
30 
33  Fw::PassiveComponentBase* callComp,
34  CompFuncPtr funcPtr
35  )
36  {
37  FW_ASSERT(callComp != nullptr);
38  FW_ASSERT(funcPtr != nullptr);
39 
40  this->m_comp = callComp;
41  this->m_func = funcPtr;
42  this->m_connObj = callComp;
43  }
44 
46  invoke(
47  U32 addr,
48  Fw::Buffer& serBuffer
49  )
50  {
51 #if FW_PORT_TRACING == 1
52  this->trace();
53 #endif
54 
55  FW_ASSERT(this->m_comp != nullptr);
56  FW_ASSERT(this->m_func != nullptr);
57 
58  return this->m_func(this->m_comp, this->m_portNum, addr, serBuffer);
59  }
60 
61 #if FW_PORT_SERIALIZATION == 1
62 
63  Fw::SerializeStatus InputI2cPort ::
64  invokeSerial(Fw::SerializeBufferBase& _buffer)
65  {
66  // For ports with a return type, invokeSerial is not used
67  (void) _buffer;
68 
69  FW_ASSERT(0);
70  return Fw::FW_SERIALIZE_OK;
71  }
72 
73 #endif
74 
75  // ----------------------------------------------------------------------
76  // Output Port Member functions
77  // ----------------------------------------------------------------------
78 
81  Fw::OutputPortBase(),
82  m_port(nullptr)
83  {
84 
85  }
86 
88  init()
89  {
91  }
92 
94  addCallPort(InputI2cPort* callPort)
95  {
96  FW_ASSERT(callPort != nullptr);
97 
98  this->m_port = callPort;
99  this->m_connObj = callPort;
100 
101 #if FW_PORT_SERIALIZATION == 1
102  this->m_serPort = nullptr;
103 #endif
104  }
105 
107  invoke(
108  U32 addr,
109  Fw::Buffer& serBuffer
110  )
111  {
112 #if FW_PORT_TRACING == 1
113  this->trace();
114 #endif
115 
116  FW_ASSERT(this->m_port != nullptr);
117  return this->m_port->invoke(addr, serBuffer);
118  }
119 
120 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Input I2c port.
Definition: I2cPortAc.hpp:26
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: I2cPortAc.cpp:32
InputI2cPort()
Constructor.
Definition: I2cPortAc.cpp:18
Drv::I2cStatus invoke(U32 addr, Fw::Buffer &serBuffer)
Invoke a port interface.
Definition: I2cPortAc.cpp:46
void init()
Initialization function.
Definition: I2cPortAc.cpp:26
void init()
Initialization function.
Definition: I2cPortAc.cpp:88
OutputI2cPort()
Constructor.
Definition: I2cPortAc.cpp:80
void addCallPort(InputI2cPort *callPort)
Register an input port.
Definition: I2cPortAc.cpp:94
Drv::I2cStatus invoke(U32 addr, Fw::Buffer &serBuffer)
Invoke a port interface.
Definition: I2cPortAc.cpp:107
NATIVE_INT_TYPE m_portNum
virtual void init()
PassiveComponentBase * m_comp
virtual void init()
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:33
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.