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 | |
4cff3ded | 10 | |
879341be JM |
11 | #define THEKERNEL Kernel::instance |
12 | ||
61134a65 JM |
13 | #include "Module.h" |
14 | #include <array> | |
15 | #include <vector> | |
e0d0ea84 JM |
16 | #include <string> |
17 | #include <functional> | |
61134a65 | 18 | |
4cff3ded | 19 | //Module manager |
a0e79e9b | 20 | class Config; |
4cff3ded | 21 | class Module; |
3fceb8eb | 22 | class Conveyor; |
d9ebc974 | 23 | class SlowTicker; |
43b1a6e8 | 24 | class Pauser; |
61134a65 JM |
25 | class SerialConsole; |
26 | class StreamOutputPool; | |
27 | class GcodeDispatch; | |
28 | class Robot; | |
29 | class Stepper; | |
30 | class Planner; | |
61134a65 JM |
31 | class StepTicker; |
32 | class Adc; | |
33 | class PublicData; | |
43b1a6e8 | 34 | |
4cff3ded AW |
35 | class Kernel { |
36 | public: | |
37 | Kernel(); | |
879341be | 38 | static Kernel* instance; // the Singleton instance of Kernel usable anywhere |
33e4cc02 | 39 | const char* config_override_filename(){ return "/sd/config-override"; } |
35089dc7 | 40 | |
4cff3ded | 41 | void add_module(Module* module); |
e0d0ea84 | 42 | void register_for_event(_EVENT_ENUM id_event, std::function<void(void*)>); |
af9072ee MM |
43 | void call_event(_EVENT_ENUM id_event); |
44 | void call_event(_EVENT_ENUM id_event, void * argument); | |
4cff3ded AW |
45 | |
46 | // These modules are aviable to all other modules | |
47 | SerialConsole* serial; | |
df27a6a3 | 48 | StreamOutputPool* streams; |
38d375e7 | 49 | |
4cff3ded AW |
50 | GcodeDispatch* gcode_dispatch; |
51 | Robot* robot; | |
52 | Stepper* stepper; | |
53 | Planner* planner; | |
54 | Config* config; | |
663d7943 | 55 | Conveyor* conveyor; |
81b547a1 | 56 | Pauser* pauser; |
4cff3ded | 57 | |
13e4a3f9 | 58 | int debug; |
3c132bd0 AW |
59 | SlowTicker* slow_ticker; |
60 | StepTicker* step_ticker; | |
61 | Adc* adc; | |
b19aa09d | 62 | PublicData* public_data; |
21320fc6 | 63 | bool use_leds; |
e0d0ea84 | 64 | std::string current_path; |
f29b0272 | 65 | |
4cff3ded | 66 | private: |
e0d0ea84 JM |
67 | // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered |
68 | std::array<std::vector<std::function<void(void*)>>, NUMBER_OF_DEFINED_EVENTS> hooks; | |
4cff3ded AW |
69 | |
70 | }; | |
71 | ||
72 | #endif |