Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SwitchPool.cpp Source File

SwitchPool.cpp

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 #include "libs/Module.h"
00009 #include "libs/Kernel.h"
00010 #include <math.h>
00011 using namespace std;
00012 #include <vector>
00013 #include "SwitchPool.h"
00014 #include "Switch.h"
00015 
00016 #define    switch_checksum              CHECKSUM("switch")
00017 
00018 SwitchPool::SwitchPool(){}
00019 
00020 void SwitchPool::on_module_loaded(){
00021 
00022     vector<uint16_t> modules;
00023     THEKERNEL->config->get_module_list( &modules, switch_checksum );
00024 
00025     for( unsigned int i = 0; i < modules.size(); i++ ){
00026         // If module is enabled
00027         if( THEKERNEL->config->value(switch_checksum, modules[i], enable_checksum )->as_bool() == true ){
00028             Switch* controller = new Switch(modules[i]);
00029             THEKERNEL->add_module(controller);
00030             this->controllers.push_back( controller );
00031         }
00032     }
00033 
00034 }
00035 
00036 
00037 
00038 
00039