Remove play/pause
[clinton/Smoothieware.git] / src / libs / Module.cpp
1 /*
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.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #include "libs/Module.h"
9 #include "libs/Kernel.h"
10
11 Module::Module(){}
12 Module::~Module(){}
13
14 // this is used to callback the specific method in the Module instance, there must be one for each _EVENT_ENUM and in the same order
15 // NOTE this is stored in Flash so takes up no RAM
16 const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = {
17 &Module::on_main_loop,
18 &Module::on_console_line_received,
19 &Module::on_gcode_received,
20 &Module::on_gcode_execute,
21 &Module::on_speed_change,
22 &Module::on_block_begin,
23 &Module::on_block_end,
24 &Module::on_idle,
25 &Module::on_second_tick,
26 &Module::on_get_public_data,
27 &Module::on_set_public_data,
28 &Module::on_halt
29
30 };
31
32
33 void Module::register_for_event(_EVENT_ENUM event_id){
34 // Events are the basic building blocks of Smoothie. They register for events, and then do stuff when those events are called.
35 // You add things to Smoothie by making a new class that inherits the Module class. See http://smoothieware.org/moduleexample for a crude introduction
36 THEKERNEL->register_for_event(event_id, this);
37 }