Michael Spencer / Smoothie

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Module.h Source File

Module.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 MODULE_H
00009 #define MODULE_H
00010 
00011 #include <string>
00012 using std::string;
00013 
00014 // See : http://smoothieware.org/listofevents
00015 
00016 enum _EVENT_ENUM {
00017     #define EVENT(name, func) name,
00018     #include "Event.h"
00019     #undef EVENT
00020     NUMBER_OF_DEFINED_EVENTS
00021 };
00022 
00023 class Module;
00024 
00025 typedef void (Module::*ModuleCallback)(void * argument);
00026 
00027 extern const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS];
00028 
00029 // Module base class
00030 // All modules must extend this class, see http://smoothieware.org/moduleexample
00031 class Kernel;
00032 class Module {
00033     public:
00034         Module();
00035         virtual ~Module();
00036         virtual void on_module_loaded();
00037         void register_for_event(        _EVENT_ENUM event_id);
00038         #define EVENT(name, func) virtual void func (void*);
00039         #include "Event.h"
00040         #undef EVENT
00041 };
00042 
00043 #endif