started hacking on the new conveyor model
[clinton/Smoothieware.git] / src / libs / Module.cpp
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#include "libs/Module.h"
9#include "libs/Kernel.h"
4cff3ded 10
968cfcba 11Module::Module(){}
98761c28 12Module::~Module(){}
4cff3ded 13
d42f8de7 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
eb65d2e6 15// NOTE this is stored in Flash so takes up no RAM
8da186de
JM
16const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = {
17 &Module::on_main_loop,
18 &Module::on_console_line_received,
19 &Module::on_gcode_received,
8da186de 20 &Module::on_idle,
8da186de
JM
21 &Module::on_second_tick,
22 &Module::on_get_public_data,
3d1a4519 23 &Module::on_set_public_data,
0bfaf040
JM
24 &Module::on_halt,
25 &Module::on_enable
3d1a4519 26
8da186de
JM
27};
28
29
af9072ee 30void Module::register_for_event(_EVENT_ENUM event_id){
e0d0ea84
JM
31 // Events are the basic building blocks of Smoothie. They register for events, and then do stuff when those events are called.
32 // You add things to Smoothie by making a new class that inherits the Module class. See http://smoothieware.org/moduleexample for a crude introduction
96f67b65
JM
33 THEKERNEL->register_for_event(event_id, this);
34}