Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Kernel.h
00001 /* 00002 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl). 00003 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. 00004 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. 00005 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. 00006 */ 00007 00008 #ifndef KERNEL_H 00009 #define KERNEL_H 00010 #include "libs/Module.h" 00011 #include "libs/Config.h" 00012 #include "libs/SlowTicker.h" 00013 #include "libs/StepTicker.h" 00014 #include "libs/Adc.h" 00015 #include "libs/Digipot.h" 00016 #include "libs/Pauser.h" 00017 #include "modules/communication/SerialConsole.h" 00018 #include "modules/communication/GcodeDispatch.h" 00019 #include "modules/robot/Planner.h" 00020 #include "modules/robot/Robot.h" 00021 #include "modules/robot/Stepper.h" 00022 00023 // See : http://smoothieware.org/listofevents 00024 #define NUMBER_OF_DEFINED_EVENTS 12 00025 #define ON_MAIN_LOOP 0 00026 #define ON_CONSOLE_LINE_RECEIVED 1 00027 #define ON_GCODE_RECEIVED 2 00028 #define ON_STEPPER_WAKE_UP 3 //TODO : Remove the need for this event, then this event itself eg: have planner call stepper directly 00029 #define ON_GCODE_EXECUTE 4 00030 #define ON_SPEED_CHANGE 5 00031 #define ON_BLOCK_BEGIN 6 00032 #define ON_BLOCK_END 7 00033 #define ON_CONFIG_RELOAD 8 00034 #define ON_PLAY 9 00035 #define ON_PAUSE 10 00036 #define ON_IDLE 11 00037 00038 00039 using namespace std; 00040 #include <vector> 00041 00042 typedef void (Module::*ModuleCallback)(void * argument); 00043 00044 //Module manager 00045 class Module; 00046 class Player; 00047 class SlowTicker; 00048 class Kernel { 00049 public: 00050 Kernel(); 00051 void add_module(Module* module); 00052 void register_for_event(unsigned int id_event, Module* module); 00053 void call_event(unsigned int id_event); 00054 void call_event(unsigned int id_event, void * argument); 00055 00056 // These modules are aviable to all other modules 00057 SerialConsole* serial; 00058 GcodeDispatch* gcode_dispatch; 00059 Robot* robot; 00060 Stepper* stepper; 00061 Planner* planner; 00062 Config* config; 00063 Player* player; 00064 Pauser* pauser; 00065 00066 int debug; 00067 SlowTicker* slow_ticker; 00068 StepTicker* step_ticker; 00069 Adc* adc; 00070 Digipot* digipot; 00071 00072 private: 00073 vector<Module*> hooks[NUMBER_OF_DEFINED_EVENTS]; // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered 00074 00075 }; 00076 00077 #endif
Generated on Tue Jul 12 2022 14:14:40 by
1.7.2