ccNOos  v0.0.0
Build Portable Microcontroller Applications!
Application_Solution.h
Go to the documentation of this file.
1 /** \file SysTickExample.h
2 * \brief Cross-Platform Portable SysTickExample Declarations
3 
4  Copyright 2021 InMechaSol, Inc
5 
6  Licensed under the Apache License, Version 2.0 (the "License");
7  you may not use this file except in compliance with the License.
8  You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 
18 Notes:
19 
20 This header demonstrates the usage of the ccNOos library and its dependence
21 on other files in the library. A platform specific main(.c,.cpp) file need
22 only include this single header to implement a platform specific ccNOos_tests
23 application.
24 
25 */
26 
27 #include "../../../executionSystem/execution_system.h"
28 #include "../../../consoleMenu/console_menu.h"
29 
30 
31 ///////////////////////////////////////////////////////////////////////
32 // SysTickClock Example
33 ///////////////////////////////////////////////////////////////////////
34 
35 
36 #ifdef Mn
37 #error ccNOos_Tests: Multiple Examples Selected for Compilation, Not Permitted
38 #else
39 #define Mn SysTickClock
40 #endif
41 
42 #define TIME_STR_LEN (16u)
43 #define MIN_LED_INDEX (0u)
44 #define SEC_LED_INDEX (1u)
45 #define TIME_SERIAL_INDEX (2u)
46 
47 
49 {
51  UI_32 secCount_Last, secCount, minCount_Last, minCount, hrCount;
52  UI_8 MinLEDvalue, SecLEDvalue, Light_Off;
53  char time[TIME_STR_LEN];
54 };
55 
56 #define MODdeclareCREATEINS int lightOff
57 #define MODcallCREATEINS lightOff
58 
60 
61 // platform and application specific io device functions
65 
66 // Re-usable, portable, cross-platform (SysTickClock example setup() function)
68 // Re-usable, portable, cross-platform (SysTickClock example setup() function)
70 // Re-usable, portable, cross-platform (SysTickClock example systick() function)
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 // C SysTickClock Example Application - built from computeModuleClass and Execution System
75 #define __PLATFORM_APP_CTEMPLATE(MODNAME) \
76  struct linkedEntryPointStruct setupListHead = {\
77  nullptr,\
78  (struct computeModuleStruct*)&MODdataINST(Mn),\
79  MODsetup(Mn)\
80  };\
81  struct linkedEntryPointStruct loopListHead = {\
82  nullptr,\
83  (struct computeModuleStruct*)&MODdataINST(Mn),\
84  MODloop(Mn)\
85  };\
86  struct executionEntryStruct exeEntryPoints = {\
87  &setupListHead,\
88  &loopListHead,\
89  nullptr,\
90  &setupListHead\
91  };\
92  void applicationConfig()\
93  {\
94  exeSystem = CreateExecutionSystemStruct(\
95  uSEC_PER_CLOCK);\
96  MODdataINST(Mn) = MODstructCREATE(Mn)(\
97  LIGHT_OFF\
98  );\
99  }
100 #define PLATFORM_APP_CTEMPLATE(MODNAME) __PLATFORM_APP_CTEMPLATE(MODNAME)
101 
102 #ifdef __cplusplus
103 ////////////////////////////////////////////////////////////////////////////////
104 // C++ SysTickClock Example Class - built from computeModuleClass
105 class MODCLASS_NAME(Mn) : public computeModuleClass {
106 private:
108 public:
110  MODCLASS_SETUP_INLINE(Mn);
111  MODCLASS_LOOP_INLINE(Mn);
112  MODCLASS_SYSTICK_INLINE(Mn);
113  MODCLASS_ExcpHndlr_INLINE(Mn);
114 };
115 
116 ////////////////////////////////////////////////////////////////////////////////
117 // C++ SysTickClock Example Application - built from computeModuleClass and Execution System
118 #define __PLATFORM_APP_CLASS(MODNAME) class theApplicationClass{\
119  public:\
120  linkedEntryPointClass setupListHead;\
121  linkedEntryPointClass loopListHead;\
122  linkedEntryPointClass systickListHead;\
123  linkedEntryPointClass exceptionListHead;\
124  MODCLASS_NAME(MODNAME) MODNAME##CompMod;\
125  executionSystemClass* theExecutionSystemPtr;\
126  theApplicationClass() :\
127  MODNAME##CompMod(LIGHT_OFF),\
128  setupListHead(& MODNAME##CompMod, nullptr),\
129  loopListHead(& MODNAME##CompMod, nullptr),\
130  systickListHead(nullptr, nullptr),\
131  exceptionListHead(&MODNAME##CompMod, nullptr)\
132  {\
133  theExecutionSystemPtr = &exeSystem;\
134  theExecutionSystemPtr->LinkTheListsHead(\
135  &setupListHead,\
136  &loopListHead,\
137  &systickListHead,\
138  &exceptionListHead\
139  );\
140  }\
141 }
142 #define PLATFORM_APP_CLASS(MODNAME) __PLATFORM_APP_CLASS(MODNAME)
143 
144 
145 #endif // !__cplusplus
146 
TIME_STR_LEN
#define TIME_STR_LEN
Definition: Application_Solution.h:42
MODdeclarePTRIN
#define MODdeclarePTRIN(mNAME)
Definition: version_config.h:284
MODdeclareLOOP
MODdeclareLOOP(Mn)
Definition: Application_Solution.c:116
COMPMODFIRST
#define COMPMODFIRST
Definition: version_config.h:280
Mn
#define Mn
Definition: Application_Solution.h:39
WriteMinLED
void WriteMinLED(MODdeclarePTRIN(Mn))
Definition: Application_Platform_Main.c:75
MODdeclareCREATEINS
#define MODdeclareCREATEINS
Definition: Application_Solution.h:56
MODdeclareSETUP
MODdeclareSETUP(Mn)
Definition: Application_Solution.c:79
MODCLASS_NAME
MODCLASS_NAME(Mn)
Definition: Application_Solution.cpp:34
MODdeclareCREATE
#define MODdeclareCREATE(mNAME)
Definition: version_config.h:292
MODdeclareSYSTICK
MODdeclareSYSTICK(Mn)
Definition: Application_Solution.c:157
MODdeclareDATA
#define MODdeclareDATA(mNAME)
Definition: version_config.h:288
WriteTimeSerial
void WriteTimeSerial(MODdeclarePTRIN(Mn))
Definition: Application_Platform_Main.c:79
WriteSecLED
void WriteSecLED(MODdeclarePTRIN(Mn))
Definition: Application_Platform_Main.c:77
MODdeclareSTRUCT
MODdeclareSTRUCT(Mn)
Definition: Application_Solution.h:36