remove copies of steppermotor pointers in modules and use the ones in robot
[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
11 #define THEKERNEL Kernel::instance
12
13 #include "Module.h"
14 #include <array>
15 #include <vector>
16 #include <string>
17
18 //Module manager
19 class Config;
20 class Module;
21 class Conveyor;
22 class SlowTicker;
23 class Pauser;
24 class SerialConsole;
25 class StreamOutputPool;
26 class GcodeDispatch;
27 class Robot;
28 class Stepper;
29 class Planner;
30 class StepTicker;
31 class Adc;
32 class PublicData;
33
34 class Kernel {
35 public:
36 Kernel();
37 static Kernel* instance; // the Singleton instance of Kernel usable anywhere
38 const char* config_override_filename(){ return "/sd/config-override"; }
39
40 void add_module(Module* module);
41 void register_for_event(_EVENT_ENUM id_event, Module *module);
42 void call_event(_EVENT_ENUM id_event);
43 void call_event(_EVENT_ENUM id_event, void * argument);
44
45 // These modules are aviable to all other modules
46 SerialConsole* serial;
47 StreamOutputPool* streams;
48
49 GcodeDispatch* gcode_dispatch;
50 Robot* robot;
51 Stepper* stepper;
52 Planner* planner;
53 Config* config;
54 Conveyor* conveyor;
55 Pauser* pauser;
56
57 int debug;
58 SlowTicker* slow_ticker;
59 StepTicker* step_ticker;
60 Adc* adc;
61 bool use_leds;
62 std::string current_path;
63 int base_stepping_frequency;
64
65 private:
66 // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered
67 std::array<std::vector<Module*>, NUMBER_OF_DEFINED_EVENTS> hooks;
68
69 };
70
71 #endif