GM6000 Digital Heater Controller Build: 16 (Branch = develop)
SDX-1330
appmain.h
Go to the documentation of this file.
1#ifndef Ajax_Main_appmain_h_
2#define Ajax_Main_appmain_h_
3/*-----------------------------------------------------------------------------
4* This file is part of the Colony.Core Project. The Colony.Core Project is an
5* open source project with a BSD type of licensing agreement. See the license
6* agreement (license.txt) in the top/ directory or on the Internet at
7* http://integerfox.com/colony.core/license.txt
8*
9* Copyright (c) 2014-2023 John T. Taylor
10*
11* Redistributions of the source code must retain the above copyright notice.
12*----------------------------------------------------------------------------*/
13/** @file
14
15 This file defines the hardware/platform independent start-up interface(s)
16 for the Ajax application
17 */
18
19#include "Ajax/Ui/PicoDisplay.h" // FIXME: This header file (because it include pimoroni header files) MUST be first :(
20#include "colony_config.h"
21#include "Cpl/Io/Input.h"
22#include "Cpl/Io/Output.h"
23#include "Cpl/TShell/Command.h"
25#include "Driver/NV/Api.h"
26#include "Driver/Crypto/Hash.h"
27#include "Driver/DIO/Pwm.h"
28#include "Driver/DIO/In.h"
30
31
32///
33namespace Ajax {
34///
35namespace Main {
36
37 /** This method launches the start-up sequence, then runs the application, followed
38 by the shutdown sequence. The 'infd' and 'outfd' are the file descriptors
39 to be used for the TShell/Command-Line-Interface.
40
41 NOTES:
42 o The caller is responsible for calling Cpl::System::Api::initialize()
43 o The caller of method MUST be executing in Cpl::System::Thread
44 o This method ONLY returns once the shutdown sequence has
45 been completed.
46 o This method assumes that its thread is DEDICATED for performing the
47 start-up/shutdown sequences. Once the start-up sequence has been
48 completed, this thread stays blocked/in-the-waiting state until the
49 Cpl::System::Shutdown interface is called to exit the application.
50 All "shutdown handlers" will execute in this thread.
51 */
53
54
55/** Expose the TShell command list to facilitate creating platform specific
56 TShell commands.
57 */
59
60/// Expose the Graphic library (to faciliate static screen creation)
61extern pimoroni::PicoGraphics_PenRGB332 g_graphics;
62
63/// Expose a handle to the global Screen Navigation instance
65
66/// Expose the handle to the NV driver
68
69/// Expose the Console hash function
71
72/// Expose the mailbox for the "application" thread (for Ajax this is the Algorithm thread)
74
75/// Expose the mailbox for the "UI" thread
77
78/// Expose the driver for the Heater PWM driver
80
81/// Expose the driver for the Fan PWM driver
83
84/// Expose the driver for the HW Safety Limit input driver
86
87/*
88** Thread Priorities
89*/
90
91/// Thread priority
92#ifndef OPTION_AJAX_MAIN_THREAD_PRIORITY_UI
93#define OPTION_AJAX_MAIN_THREAD_PRIORITY_UI (CPL_SYSTEM_THREAD_PRIORITY_NORMAL + (CPL_SYSTEM_THREAD_PRIORITY_RAISE) )
94#endif
95
96/// Thread priority
97#ifndef OPTION_AJAX_MAIN_THREAD_PRIORITY_APPLICATION
98#define OPTION_AJAX_MAIN_THREAD_PRIORITY_APPLICATION (CPL_SYSTEM_THREAD_PRIORITY_NORMAL)
99#endif
100
101/// Thread priority
102#ifndef OPTION_AJAX_MAIN_THREAD_PRIORITY_STORAGE
103#define OPTION_AJAX_MAIN_THREAD_PRIORITY_STORAGE (CPL_SYSTEM_THREAD_PRIORITY_NORMAL + ( 2* CPL_SYSTEM_THREAD_PRIORITY_LOWER) )
104#endif
105
106/// Thread priority
107#ifndef OPTION_AJAX_MAIN_THREAD_PRIORITY_CONSOLE
108#define OPTION_AJAX_MAIN_THREAD_PRIORITY_CONSOLE (CPL_SYSTEM_THREAD_PRIORITY_NORMAL + ( 3* CPL_SYSTEM_THREAD_PRIORITY_LOWER) )
109#endif
110
111
112/*
113** Magic values
114*/
115/// Minimum amount of time (in milliseconds) the splash screen is displayed
116#ifndef OPTION_AJAX_MAIN_MIN_SPLASH_TIME_MS
117#define OPTION_AJAX_MAIN_MIN_SPLASH_TIME_MS (2*1000)
118#endif
119
120/// Number of entries for the in-RAM logging buffer
121#ifndef OPTION_AJAX_MAIN_MAX_LOGGING_BUFFER_ENTRIES
122#define OPTION_AJAX_MAIN_MAX_LOGGING_BUFFER_ENTRIES 20 // (20+1) * 159 = 3339 = 3.3K
123#endif
124}; // end namespaces
125};
126#endif // end header latch
This class defines the interface - used by ScreenApi instances - to navigate to other screen instance...
Definition Navigation.h:27
This template class implements a singly linked list which maintains the ordering imposed on it by the...
Definition SList.h:30
This class extends the Cpl::Dm::EventLoop and Cpl::Itc:Mailbox classes to support the asynchronous ch...
Definition MailboxServer.h:43
This partially abstract class defines a interface for operating on an input stream (example of a stre...
Definition Input.h:37
This partially abstract class defines a interface for operating on an output stream (example of a str...
Definition Output.h:34
This class defines an abstract interface for a Hashing Algorithms.
Definition Hash.h:34
This class defines a generic interface for sampling a single Digital Input signal.
Definition In.h:32
This class defines a generic interface for controlling a simple PWM output signal.
Definition Pwm.h:35
This class defines the interface for a platform independent Non-volatile storage driver.
Definition Api.h:35
Driver::DIO::Pwm g_heaterPWMDriver
Expose the driver for the Heater PWM driver.
Cpl::Dm::MailboxServer g_uiMbox
Expose the mailbox for the "UI" thread.
pimoroni::PicoGraphics_PenRGB332 g_graphics
Expose the Graphic library (to faciliate static screen creation)
Cpl::Container::SList< Cpl::TShell::Command > g_cmdlist
Expose the TShell command list to facilitate creating platform specific TShell commands.
Ajax::ScreenMgr::Navigation & g_screenNav
Expose a handle to the global Screen Navigation instance.
int runTheApplication(Cpl::Io::Input &infd, Cpl::Io::Output &outfd)
This method launches the start-up sequence, then runs the application, followed by the shutdown seque...
Driver::DIO::In g_hwSafetyDriver
Expose the driver for the HW Safety Limit input driver.
Driver::Crypto::Hash * g_sha512Ptr
Expose the Console hash function.
Driver::DIO::Pwm g_fanPWMDriver
Expose the driver for the Fan PWM driver.
Driver::NV::Api & g_nvramDriver
Expose the handle to the NV driver.
Cpl::Dm::MailboxServer g_appMbox
Expose the mailbox for the "application" thread (for Ajax this is the Algorithm thread)
The 'Ajax' namespace is the root name space all GM6000 application specific source code.