Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
4cff3ded AW |
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. | |
df27a6a3 | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
4cff3ded AW |
6 | */ |
7 | ||
8 | #ifndef KERNEL_H | |
9 | #define KERNEL_H | |
10 | #include "libs/Module.h" | |
11 | #include "libs/Config.h" | |
ded56b35 | 12 | #include "libs/SlowTicker.h" |
38d375e7 | 13 | #include "libs/StreamOutputPool.h" |
3b1e82d2 | 14 | #include "libs/StepTicker.h" |
3c132bd0 | 15 | #include "libs/Adc.h" |
81b547a1 | 16 | #include "libs/Pauser.h" |
8293d443 | 17 | #include "libs/PublicData.h" |
4cff3ded AW |
18 | #include "modules/communication/SerialConsole.h" |
19 | #include "modules/communication/GcodeDispatch.h" | |
14ecdbd7 | 20 | #include "modules/tools/toolsmanager/ToolsManager.h" |
4cff3ded AW |
21 | #include "modules/robot/Planner.h" |
22 | #include "modules/robot/Robot.h" | |
23 | #include "modules/robot/Stepper.h" | |
5673fe39 | 24 | #include "mri.h" |
44912e95 | 25 | #include <array> |
4cff3ded | 26 | |
879341be JM |
27 | #define THEKERNEL Kernel::instance |
28 | ||
4cff3ded | 29 | //Module manager |
a0e79e9b | 30 | class Config; |
4cff3ded | 31 | class Module; |
3fceb8eb | 32 | class Conveyor; |
d9ebc974 | 33 | class SlowTicker; |
43b1a6e8 MM |
34 | class Pauser; |
35 | ||
4cff3ded AW |
36 | class Kernel { |
37 | public: | |
38 | Kernel(); | |
879341be | 39 | static Kernel* instance; // the Singleton instance of Kernel usable anywhere |
33e4cc02 | 40 | const char* config_override_filename(){ return "/sd/config-override"; } |
35089dc7 | 41 | |
4cff3ded | 42 | void add_module(Module* module); |
af9072ee MM |
43 | void register_for_event(_EVENT_ENUM id_event, Module* module); |
44 | void call_event(_EVENT_ENUM id_event); | |
45 | void call_event(_EVENT_ENUM id_event, void * argument); | |
4cff3ded AW |
46 | |
47 | // These modules are aviable to all other modules | |
48 | SerialConsole* serial; | |
df27a6a3 | 49 | StreamOutputPool* streams; |
38d375e7 | 50 | |
4cff3ded AW |
51 | GcodeDispatch* gcode_dispatch; |
52 | Robot* robot; | |
53 | Stepper* stepper; | |
54 | Planner* planner; | |
55 | Config* config; | |
663d7943 | 56 | Conveyor* conveyor; |
81b547a1 | 57 | Pauser* pauser; |
14ecdbd7 | 58 | ToolsManager* toolsmanager; |
4cff3ded | 59 | |
13e4a3f9 | 60 | int debug; |
3c132bd0 AW |
61 | SlowTicker* slow_ticker; |
62 | StepTicker* step_ticker; | |
63 | Adc* adc; | |
b19aa09d | 64 | PublicData* public_data; |
21320fc6 | 65 | bool use_leds; |
75f4581c | 66 | string current_path; |
f29b0272 | 67 | |
4cff3ded | 68 | private: |
44912e95 | 69 | 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 |
4cff3ded AW |
70 | |
71 | }; | |
72 | ||
73 | #endif |