Added new Panel stuff
[clinton/Smoothieware.git] / src / libs / Kernel.h
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #ifndef KERNEL_H
9 #define KERNEL_H
10 #include "libs/Module.h"
11 #include "libs/Config.h"
12 #include "libs/SlowTicker.h"
13 #include "libs/StreamOutputPool.h"
14 #include "libs/StepTicker.h"
15 #include "libs/Adc.h"
16 #include "libs/Pauser.h"
17 #include "libs/PublicData.h"
18 #include "modules/communication/SerialConsole.h"
19 #include "modules/communication/GcodeDispatch.h"
20 #include "modules/robot/Planner.h"
21 #include "modules/robot/Robot.h"
22 #include "modules/robot/Stepper.h"
23 #include "modules/tools/endstops/Endstops.h"
24 #include <array>
25
26 #define THEKERNEL Kernel::instance
27
28 //Module manager
29 class Module;
30 class Conveyor;
31 class SlowTicker;
32 class Kernel {
33 public:
34 Kernel();
35 static Kernel* instance; // the Singleton instance of Kernel usable anywhere
36
37 void add_module(Module* module);
38 void register_for_event(_EVENT_ENUM id_event, Module* module);
39 void call_event(_EVENT_ENUM id_event);
40 void call_event(_EVENT_ENUM id_event, void * argument);
41
42 // These modules are aviable to all other modules
43 SerialConsole* serial;
44 StreamOutputPool* streams;
45
46 GcodeDispatch* gcode_dispatch;
47 Robot* robot;
48 Stepper* stepper;
49 Planner* planner;
50 Config* config;
51 Conveyor* conveyor;
52 Pauser* pauser;
53
54 int debug;
55 SlowTicker* slow_ticker;
56 StepTicker* step_ticker;
57 Adc* adc;
58 PublicData* public_data;
59
60 private:
61 std::array<std::vector<Module*>, NUMBER_OF_DEFINED_EVENTS> hooks; // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered
62
63 };
64
65 #endif