added -q ( quiet ) option to the play command
[clinton/Smoothieware.git] / src / libs / Kernel.cpp
index d36d23e..3355dae 100644 (file)
@@ -10,9 +10,12 @@ using namespace std;
 #include "libs/Kernel.h"
 #include "libs/Module.h"
 #include "libs/Config.h"
-#include "mbed.h"
 #include "libs/nuts_bolts.h"
 #include "libs/SlowTicker.h"
+#include "libs/Adc.h"
+#include "libs/Digipot.h"
+#include "libs/Pauser.h"
+#include "libs/StreamOutputPool.h"
 
 #include "modules/communication/SerialConsole.h"
 #include "modules/communication/GcodeDispatch.h"
@@ -22,9 +25,6 @@ using namespace std;
 #include "modules/robot/Player.h"
 
 
-
-
-
 // List of callback functions, ordered as their corresponding events
 const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = { 
         &Module::on_main_loop, 
@@ -37,10 +37,12 @@ const ModuleCallback kernel_callback_functions[NUMBER_OF_DEFINED_EVENTS] = {
         &Module::on_block_end,
         &Module::on_config_reload,
         &Module::on_play,
-        &Module::on_pause
+        &Module::on_pause,
+        &Module::on_idle
 };
 
-#define baud_rate_setting_ckeckusm 10922
+#define baud_rate_setting_checksum 10922
+#define uart0_checksum             16877
 
 // The kernel is the central point in Smoothie : it stores modules, and handles event calls
 Kernel::Kernel(){
@@ -48,26 +50,30 @@ Kernel::Kernel(){
     // Config first, because we need the baud_rate setting before we start serial 
     this->config         = new Config();
     // Serial second, because the other modules might want to say something
-    this->serial         = new SerialConsole(USBTX, USBRX, this->config->value(baud_rate_setting_ckeckusm)->by_default(9600)->as_number());
+    this->streams        = new StreamOutputPool();
 
-    this->add_module( this->config );
-    this->add_module( this->serial );
+    //this->serial         = new SerialConsole(USBTX, USBRX, this->config->value(uart0_checksum,baud_rate_setting_checksum)->by_default(9600)->as_number());
    
-    this->slow_ticker = new SlowTicker();
-    
-    // Core modules 
-    this->gcode_dispatch = new GcodeDispatch();
-    this->robot          = new Robot();
-    this->stepper        = new Stepper();
-    this->planner        = new Planner();
-    this->player         = new Player();
+    this->add_module( this->config );
+    //this->add_module( this->serial );
 
-    this->add_module( this->gcode_dispatch );
-    this->add_module( this->robot );
-    this->add_module( this->stepper );
-    this->add_module( this->planner );
-    this->add_module( this->player );
+    // HAL stuff 
+    this->slow_ticker          = new SlowTicker();
+    this->step_ticker          = new StepTicker();
+    this->adc                  = new Adc();
+    this->digipot              = new Digipot();
 
+    // LPC17xx-specific 
+    NVIC_SetPriority(TIMER0_IRQn, 1); 
+    NVIC_SetPriority(TIMER2_IRQn, 2); 
+
+    // Core modules 
+    this->add_module( this->gcode_dispatch = new GcodeDispatch() );
+    this->add_module( this->robot          = new Robot()         );
+    this->add_module( this->stepper        = new Stepper()       );
+    this->add_module( this->planner        = new Planner()       );
+    this->add_module( this->player         = new Player()        );
+    this->add_module( this->pauser         = new Pauser()        );
 }
 
 void Kernel::add_module(Module* module){