Commit | Line | Data |
---|---|---|
df27a6a3 | 1 | /* |
cc1d3b1f AW |
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. | |
df27a6a3 | 5 | you should have received a copy of the gnu general public license along with smoothie. if not, see <http://www.gnu.org/licenses/>. |
cc1d3b1f AW |
6 | */ |
7 | ||
8 | #ifndef SWITCH_H | |
9 | #define SWITCH_H | |
10 | ||
11 | #include "libs/Pin.h" | |
12 | #include <math.h> | |
61134a65 JM |
13 | #include "Pwm.h" |
14 | ||
15 | class Gcode; | |
16 | class StreamOutput; | |
cc1d3b1f | 17 | |
cc1d3b1f AW |
18 | class Switch : public Module { |
19 | public: | |
20 | Switch(); | |
21 | Switch(uint16_t name); | |
11f8ba4e | 22 | |
cc1d3b1f AW |
23 | void on_module_loaded(); |
24 | void on_config_reload(void* argument); | |
3c4f2dd8 | 25 | void on_gcode_received(void* argument); |
cc1d3b1f | 26 | void on_gcode_execute(void* argument); |
e62e8f7c | 27 | void on_main_loop(void* argument); |
2f5d0afa L |
28 | void on_get_public_data(void* argument); |
29 | void on_set_public_data(void* argument); | |
26ef0ec6 L |
30 | uint32_t pinpoll_tick(uint32_t dummy); |
31 | ||
fe04e329 | 32 | private: |
26ef0ec6 L |
33 | void flip(); |
34 | void send_gcode(string msg, StreamOutput* stream); | |
fe04e329 JM |
35 | bool match_output_gcode(const Gcode* gcode) const; |
36 | bool match_input_gcode(const Gcode* gcode) const; | |
cc1d3b1f | 37 | |
4e3d75dd AW |
38 | uint16_t name_checksum; |
39 | Pin input_pin; | |
40 | uint16_t input_pin_behavior; | |
41 | bool input_pin_state; | |
42 | char input_on_command_letter; | |
43 | char input_off_command_letter; | |
44 | uint16_t input_on_command_code; | |
45 | uint16_t input_off_command_code; | |
46 | bool switch_state; | |
47 | float switch_value; | |
48 | bool switch_changed; | |
49 | Pwm output_pin; | |
50 | string output_on_command; | |
51 | string output_off_command; | |
cc1d3b1f AW |
52 | }; |
53 | ||
26ef0ec6 | 54 | #endif // SWITCH_H |