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> | |
13 | ||
cc1d3b1f AW |
14 | class Switch : public Module { |
15 | public: | |
16 | Switch(); | |
17 | Switch(uint16_t name); | |
11f8ba4e | 18 | |
cc1d3b1f AW |
19 | void on_module_loaded(); |
20 | void on_config_reload(void* argument); | |
3c4f2dd8 | 21 | void on_gcode_received(void* argument); |
cc1d3b1f | 22 | void on_gcode_execute(void* argument); |
e62e8f7c | 23 | void on_main_loop(void* argument); |
2f5d0afa L |
24 | void on_get_public_data(void* argument); |
25 | void on_set_public_data(void* argument); | |
26ef0ec6 L |
26 | uint32_t pinpoll_tick(uint32_t dummy); |
27 | ||
fe04e329 | 28 | private: |
26ef0ec6 L |
29 | void flip(); |
30 | void send_gcode(string msg, StreamOutput* stream); | |
fe04e329 JM |
31 | bool match_output_gcode(const Gcode* gcode) const; |
32 | bool match_input_gcode(const Gcode* gcode) const; | |
cc1d3b1f | 33 | |
4e3d75dd AW |
34 | uint16_t name_checksum; |
35 | Pin input_pin; | |
36 | uint16_t input_pin_behavior; | |
37 | bool input_pin_state; | |
38 | char input_on_command_letter; | |
39 | char input_off_command_letter; | |
40 | uint16_t input_on_command_code; | |
41 | uint16_t input_off_command_code; | |
42 | bool switch_state; | |
43 | float switch_value; | |
44 | bool switch_changed; | |
45 | Pwm output_pin; | |
46 | string output_on_command; | |
47 | string output_off_command; | |
cc1d3b1f AW |
48 | }; |
49 | ||
26ef0ec6 | 50 | #endif // SWITCH_H |