F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
11namespace Drv {
12
13 // ----------------------------------------------------------------------
14 // Input Port Member functions
15 // ----------------------------------------------------------------------
16
17 InputI2cPort ::
18 InputI2cPort() :
19 Fw::InputPortBase(),
20 m_func(nullptr)
21 {
22
23 }
24
25 void InputI2cPort ::
26 init()
27 {
29 }
30
31 void InputI2cPort ::
32 addCallComp(
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
45 Drv::I2cStatus InputI2cPort ::
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);
71 }
72
73#endif
74
75 // ----------------------------------------------------------------------
76 // Output Port Member functions
77 // ----------------------------------------------------------------------
78
79 OutputI2cPort ::
80 OutputI2cPort() :
81 Fw::OutputPortBase(),
82 m_port(nullptr)
83 {
84
85 }
86
87 void OutputI2cPort ::
88 init()
89 {
91 }
92
93 void OutputI2cPort ::
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
106 Drv::I2cStatus OutputI2cPort ::
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
virtual void init()
virtual void init()
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.