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 Laser.h Source File

Laser.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 LASER_MODULE_H
00009 #define LASER_MODULE_H
00010 
00011 #include "libs/Module.h"
00012 #include "libs/Pin.h"
00013 #include "libs/Kernel.h"
00014 #include "modules/communication/utils/Gcode.h"
00015 #include "PwmOut.h" // mbed.h lib
00016 
00017 
00018 #define laser_module_enable_checksum        CHECKSUM("laser_module_enable")
00019 #define laser_module_pin_checksum           CHECKSUM("laser_module_pin")
00020 #define laser_module_pwm_period_checksum    CHECKSUM("laser_module_pwm_period")
00021 #define laser_module_max_power_checksum     CHECKSUM("laser_module_max_power")
00022 #define laser_module_tickle_power_checksum  CHECKSUM("laser_module_tickle_power")
00023 
00024 class Laser : public Module{
00025     public:
00026         Laser();
00027         virtual ~Laser() {};
00028         void on_module_loaded();
00029         void on_block_end(void* argument);
00030         void on_block_begin(void* argument);
00031         void on_play(void* argument);
00032         void on_pause(void* argument);
00033         void on_gcode_execute(void* argument);
00034         void on_speed_change(void* argument);
00035         void set_proportional_power();
00036 
00037         mbed::PwmOut*    laser_pin;    // PWM output to regulate the laser power
00038         bool             laser_on;     // Laser status
00039         bool             laser_inverting; // stores whether the pwm period should be inverted
00040         float            laser_max_power; // maximum allowed laser power to be output on the pwm pin
00041         float            laser_tickle_power; // value used to tickle the laser on moves
00042 };
00043 
00044 #endif