Events: add ON_SECOND_TICK event that fires once per second. Also finish moving event...
[clinton/Smoothieware.git] / src / libs / Kernel.h
CommitLineData
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"
0e8b102e 16#include "libs/Digipot.h"
81b547a1 17#include "libs/Pauser.h"
4cff3ded
AW
18#include "modules/communication/SerialConsole.h"
19#include "modules/communication/GcodeDispatch.h"
20#include "modules/robot/Planner.h"
21#include "modules/robot/Robot.h"
22#include "modules/robot/Stepper.h"
4cff3ded 23
4cff3ded
AW
24//Module manager
25class Module;
3a4fa0c1 26class Player;
d9ebc974 27class SlowTicker;
4cff3ded
AW
28class Kernel {
29 public:
30 Kernel();
31 void add_module(Module* module);
af9072ee
MM
32 void register_for_event(_EVENT_ENUM id_event, Module* module);
33 void call_event(_EVENT_ENUM id_event);
34 void call_event(_EVENT_ENUM id_event, void * argument);
4cff3ded
AW
35
36 // These modules are aviable to all other modules
37 SerialConsole* serial;
df27a6a3 38 StreamOutputPool* streams;
38d375e7 39
4cff3ded
AW
40 GcodeDispatch* gcode_dispatch;
41 Robot* robot;
42 Stepper* stepper;
43 Planner* planner;
44 Config* config;
3a4fa0c1 45 Player* player;
81b547a1 46 Pauser* pauser;
4cff3ded 47
13e4a3f9 48 int debug;
3c132bd0
AW
49 SlowTicker* slow_ticker;
50 StepTicker* step_ticker;
51 Adc* adc;
0e8b102e 52 Digipot* digipot;
13e4a3f9 53
4cff3ded 54 private:
db453125 55 Module* hooks[NUMBER_OF_DEFINED_EVENTS][32]; // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered
4cff3ded
AW
56
57};
58
59#endif