5db40e492813497ff83a86b0db9c1aa8d1eb4903
[clinton/Smoothieware.git] / src / modules / tools / laser / Laser.h
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
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.
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.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8 #ifndef LASER_MODULE_H
9 #define LASER_MODULE_H
10
11 #include "libs/Module.h"
12 #include "libs/Pin.h"
13 #include "libs/Kernel.h"
14 #include "modules/communication/utils/Gcode.h"
15 #include "PwmOut.h" // mbed.h lib
16
17
18 #define laser_module_enable_checksum CHECKSUM("laser_module_enable")
19 #define laser_module_pin_checksum CHECKSUM("laser_module_pin")
20 #define laser_module_pwm_period_checksum CHECKSUM("laser_module_pwm_period")
21 #define laser_module_max_power_checksum CHECKSUM("laser_module_max_power")
22 #define laser_module_tickle_power_checksum CHECKSUM("laser_module_tickle_power")
23
24 class Laser : public Module{
25 public:
26 Laser();
27 virtual ~Laser() {};
28 void on_module_loaded();
29 void on_block_end(void* argument);
30 void on_block_begin(void* argument);
31 void on_play(void* argument);
32 void on_pause(void* argument);
33 void on_gcode_execute(void* argument);
34 void on_speed_change(void* argument);
35 void set_proportional_power();
36
37 mbed::PwmOut* laser_pin; // PWM output to regulate the laser power
38 bool laser_on; // Laser status
39 bool laser_inverting; // stores whether the pwm period should be inverted
40 float laser_max_power; // maximum allowed laser power to be output on the pwm pin
41 float laser_tickle_power; // value used to tickle the laser on moves
42 };
43
44 #endif