Fork of Smoothie to port to mbed non-LPC targets.
Fork of Smoothie by
libs/Kernel.h@2:1df0b61d3b5a, 2014-02-28 (annotated)
- Committer:
- Michael J. Spencer
- Date:
- Fri Feb 28 18:52:52 2014 -0800
- Revision:
- 2:1df0b61d3b5a
- Parent:
- 0:31e91bb0ef3c
- Child:
- 3:f151d08d335c
Update to latest Smoothie.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Michael J. Spencer |
2:1df0b61d3b5a | 1 | /* |
Michael J. Spencer |
2:1df0b61d3b5a | 2 | This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). |
Michael J. Spencer |
2:1df0b61d3b5a | 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. |
Michael J. Spencer |
2:1df0b61d3b5a | 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. |
Michael J. Spencer |
2:1df0b61d3b5a | 5 | You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. |
Michael J. Spencer |
2:1df0b61d3b5a | 6 | */ |
Michael J. Spencer |
2:1df0b61d3b5a | 7 | |
Michael J. Spencer |
2:1df0b61d3b5a | 8 | #ifndef KERNEL_H |
Michael J. Spencer |
2:1df0b61d3b5a | 9 | #define KERNEL_H |
Michael J. Spencer |
2:1df0b61d3b5a | 10 | #include "libs/Module.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 11 | #include "libs/Config.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 12 | #include "libs/SlowTicker.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 13 | #include "libs/StreamOutputPool.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 14 | #include "libs/StepTicker.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 15 | #include "libs/Adc.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 16 | #include "libs/Pauser.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 17 | #include "libs/PublicData.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 18 | #include "modules/communication/SerialConsole.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 19 | #include "modules/communication/GcodeDispatch.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 20 | #include "modules/tools/toolsmanager/ToolsManager.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 21 | #include "modules/robot/Planner.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 22 | #include "modules/robot/Robot.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 23 | #include "modules/robot/Stepper.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 24 | #include "mri.h" |
Michael J. Spencer |
2:1df0b61d3b5a | 25 | #include <array> |
Michael J. Spencer |
2:1df0b61d3b5a | 26 | |
Michael J. Spencer |
2:1df0b61d3b5a | 27 | #define THEKERNEL Kernel::instance |
Michael J. Spencer |
2:1df0b61d3b5a | 28 | |
Michael J. Spencer |
2:1df0b61d3b5a | 29 | //Module manager |
Michael J. Spencer |
2:1df0b61d3b5a | 30 | class Config; |
Michael J. Spencer |
2:1df0b61d3b5a | 31 | class Module; |
Michael J. Spencer |
2:1df0b61d3b5a | 32 | class Conveyor; |
Michael J. Spencer |
2:1df0b61d3b5a | 33 | class SlowTicker; |
Michael J. Spencer |
2:1df0b61d3b5a | 34 | class Pauser; |
Michael J. Spencer |
2:1df0b61d3b5a | 35 | |
Michael J. Spencer |
2:1df0b61d3b5a | 36 | class Kernel { |
Michael J. Spencer |
2:1df0b61d3b5a | 37 | public: |
Michael J. Spencer |
2:1df0b61d3b5a | 38 | Kernel(); |
Michael J. Spencer |
2:1df0b61d3b5a | 39 | static Kernel* instance; // the Singleton instance of Kernel usable anywhere |
Michael J. Spencer |
2:1df0b61d3b5a | 40 | const char* config_override_filename(){ return "/sd/config-override"; } |
Michael J. Spencer |
2:1df0b61d3b5a | 41 | |
Michael J. Spencer |
2:1df0b61d3b5a | 42 | void add_module(Module* module); |
Michael J. Spencer |
2:1df0b61d3b5a | 43 | void register_for_event(_EVENT_ENUM id_event, Module* module); |
Michael J. Spencer |
2:1df0b61d3b5a | 44 | void call_event(_EVENT_ENUM id_event); |
Michael J. Spencer |
2:1df0b61d3b5a | 45 | void call_event(_EVENT_ENUM id_event, void * argument); |
Michael J. Spencer |
2:1df0b61d3b5a | 46 | |
Michael J. Spencer |
2:1df0b61d3b5a | 47 | // These modules are aviable to all other modules |
Michael J. Spencer |
2:1df0b61d3b5a | 48 | SerialConsole* serial; |
Michael J. Spencer |
2:1df0b61d3b5a | 49 | StreamOutputPool* streams; |
Michael J. Spencer |
2:1df0b61d3b5a | 50 | |
Michael J. Spencer |
2:1df0b61d3b5a | 51 | GcodeDispatch* gcode_dispatch; |
Michael J. Spencer |
2:1df0b61d3b5a | 52 | Robot* robot; |
Michael J. Spencer |
2:1df0b61d3b5a | 53 | Stepper* stepper; |
Michael J. Spencer |
2:1df0b61d3b5a | 54 | Planner* planner; |
Michael J. Spencer |
2:1df0b61d3b5a | 55 | Config* config; |
Michael J. Spencer |
2:1df0b61d3b5a | 56 | Conveyor* conveyor; |
Michael J. Spencer |
2:1df0b61d3b5a | 57 | Pauser* pauser; |
Michael J. Spencer |
2:1df0b61d3b5a | 58 | ToolsManager* toolsmanager; |
Michael J. Spencer |
2:1df0b61d3b5a | 59 | |
Michael J. Spencer |
2:1df0b61d3b5a | 60 | int debug; |
Michael J. Spencer |
2:1df0b61d3b5a | 61 | SlowTicker* slow_ticker; |
Michael J. Spencer |
2:1df0b61d3b5a | 62 | StepTicker* step_ticker; |
Michael J. Spencer |
2:1df0b61d3b5a | 63 | Adc* adc; |
Michael J. Spencer |
2:1df0b61d3b5a | 64 | PublicData* public_data; |
Michael J. Spencer |
2:1df0b61d3b5a | 65 | bool use_leds; |
Michael J. Spencer |
2:1df0b61d3b5a | 66 | string current_path; |
Michael J. Spencer |
2:1df0b61d3b5a | 67 | |
Michael J. Spencer |
2:1df0b61d3b5a | 68 | private: |
Michael J. Spencer |
2:1df0b61d3b5a | 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 |
Michael J. Spencer |
2:1df0b61d3b5a | 70 | |
Michael J. Spencer |
2:1df0b61d3b5a | 71 | }; |
Michael J. Spencer |
2:1df0b61d3b5a | 72 | |
Michael J. Spencer |
2:1df0b61d3b5a | 73 | #endif |