smoothie port to mbed online compiler (smoothieware.org)

Dependencies:   mbed

For documentation, license, ..., please check http://smoothieware.org/

This version has been tested with a 3 axis machine

Committer:
scachat
Date:
Tue Jul 31 21:11:18 2012 +0000
Revision:
0:31e91bb0ef3c
smoothie port to mbed online compiler

Who changed what in which revision?

UserRevisionLine numberNew contents of line
scachat 0:31e91bb0ef3c 1 /*
scachat 0:31e91bb0ef3c 2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
scachat 0:31e91bb0ef3c 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.
scachat 0:31e91bb0ef3c 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.
scachat 0:31e91bb0ef3c 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
scachat 0:31e91bb0ef3c 6 */
scachat 0:31e91bb0ef3c 7
scachat 0:31e91bb0ef3c 8 #ifndef KERNEL_H
scachat 0:31e91bb0ef3c 9 #define KERNEL_H
scachat 0:31e91bb0ef3c 10 #include "libs/Module.h"
scachat 0:31e91bb0ef3c 11 #include "libs/Config.h"
scachat 0:31e91bb0ef3c 12 #include "libs/SlowTicker.h"
scachat 0:31e91bb0ef3c 13 #include "libs/StepTicker.h"
scachat 0:31e91bb0ef3c 14 #include "libs/Adc.h"
scachat 0:31e91bb0ef3c 15 #include "libs/Digipot.h"
scachat 0:31e91bb0ef3c 16 #include "libs/Pauser.h"
scachat 0:31e91bb0ef3c 17 #include "modules/communication/SerialConsole.h"
scachat 0:31e91bb0ef3c 18 #include "modules/communication/GcodeDispatch.h"
scachat 0:31e91bb0ef3c 19 #include "modules/robot/Planner.h"
scachat 0:31e91bb0ef3c 20 #include "modules/robot/Robot.h"
scachat 0:31e91bb0ef3c 21 #include "modules/robot/Stepper.h"
scachat 0:31e91bb0ef3c 22
scachat 0:31e91bb0ef3c 23 // See : http://smoothieware.org/listofevents
scachat 0:31e91bb0ef3c 24 #define NUMBER_OF_DEFINED_EVENTS 12
scachat 0:31e91bb0ef3c 25 #define ON_MAIN_LOOP 0
scachat 0:31e91bb0ef3c 26 #define ON_CONSOLE_LINE_RECEIVED 1
scachat 0:31e91bb0ef3c 27 #define ON_GCODE_RECEIVED 2
scachat 0:31e91bb0ef3c 28 #define ON_STEPPER_WAKE_UP 3 //TODO : Remove the need for this event, then this event itself eg: have planner call stepper directly
scachat 0:31e91bb0ef3c 29 #define ON_GCODE_EXECUTE 4
scachat 0:31e91bb0ef3c 30 #define ON_SPEED_CHANGE 5
scachat 0:31e91bb0ef3c 31 #define ON_BLOCK_BEGIN 6
scachat 0:31e91bb0ef3c 32 #define ON_BLOCK_END 7
scachat 0:31e91bb0ef3c 33 #define ON_CONFIG_RELOAD 8
scachat 0:31e91bb0ef3c 34 #define ON_PLAY 9
scachat 0:31e91bb0ef3c 35 #define ON_PAUSE 10
scachat 0:31e91bb0ef3c 36 #define ON_IDLE 11
scachat 0:31e91bb0ef3c 37
scachat 0:31e91bb0ef3c 38
scachat 0:31e91bb0ef3c 39 using namespace std;
scachat 0:31e91bb0ef3c 40 #include <vector>
scachat 0:31e91bb0ef3c 41
scachat 0:31e91bb0ef3c 42 typedef void (Module::*ModuleCallback)(void * argument);
scachat 0:31e91bb0ef3c 43
scachat 0:31e91bb0ef3c 44 //Module manager
scachat 0:31e91bb0ef3c 45 class Module;
scachat 0:31e91bb0ef3c 46 class Player;
scachat 0:31e91bb0ef3c 47 class SlowTicker;
scachat 0:31e91bb0ef3c 48 class Kernel {
scachat 0:31e91bb0ef3c 49 public:
scachat 0:31e91bb0ef3c 50 Kernel();
scachat 0:31e91bb0ef3c 51 void add_module(Module* module);
scachat 0:31e91bb0ef3c 52 void register_for_event(unsigned int id_event, Module* module);
scachat 0:31e91bb0ef3c 53 void call_event(unsigned int id_event);
scachat 0:31e91bb0ef3c 54 void call_event(unsigned int id_event, void * argument);
scachat 0:31e91bb0ef3c 55
scachat 0:31e91bb0ef3c 56 // These modules are aviable to all other modules
scachat 0:31e91bb0ef3c 57 SerialConsole* serial;
scachat 0:31e91bb0ef3c 58 GcodeDispatch* gcode_dispatch;
scachat 0:31e91bb0ef3c 59 Robot* robot;
scachat 0:31e91bb0ef3c 60 Stepper* stepper;
scachat 0:31e91bb0ef3c 61 Planner* planner;
scachat 0:31e91bb0ef3c 62 Config* config;
scachat 0:31e91bb0ef3c 63 Player* player;
scachat 0:31e91bb0ef3c 64 Pauser* pauser;
scachat 0:31e91bb0ef3c 65
scachat 0:31e91bb0ef3c 66 int debug;
scachat 0:31e91bb0ef3c 67 SlowTicker* slow_ticker;
scachat 0:31e91bb0ef3c 68 StepTicker* step_ticker;
scachat 0:31e91bb0ef3c 69 Adc* adc;
scachat 0:31e91bb0ef3c 70 Digipot* digipot;
scachat 0:31e91bb0ef3c 71
scachat 0:31e91bb0ef3c 72 private:
scachat 0:31e91bb0ef3c 73 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
scachat 0:31e91bb0ef3c 74
scachat 0:31e91bb0ef3c 75 };
scachat 0:31e91bb0ef3c 76
scachat 0:31e91bb0ef3c 77 #endif