Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Smoothie by
Switch.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 SWITCH_H 00009 #define SWITCH_H 00010 00011 #include "libs/Pin.h" 00012 #include <math.h> 00013 00014 class Switch : public Module { 00015 public: 00016 Switch(); 00017 Switch(uint16_t name); 00018 00019 void on_module_loaded(); 00020 void on_config_reload(void* argument); 00021 void on_gcode_received(void* argument); 00022 void on_gcode_execute(void* argument); 00023 void on_main_loop(void* argument); 00024 void on_get_public_data(void* argument); 00025 void on_set_public_data(void* argument); 00026 uint32_t pinpoll_tick(uint32_t dummy); 00027 00028 private: 00029 void flip(); 00030 void send_gcode(string msg, StreamOutput* stream); 00031 bool match_output_gcode(const Gcode* gcode) const; 00032 bool match_input_gcode(const Gcode* gcode) const; 00033 00034 uint16_t name_checksum; 00035 Pin input_pin; 00036 uint16_t input_pin_behavior; 00037 bool input_pin_state; 00038 char input_on_command_letter; 00039 char input_off_command_letter; 00040 uint16_t input_on_command_code; 00041 uint16_t input_off_command_code; 00042 bool switch_state; 00043 float switch_value; 00044 bool switch_changed; 00045 Pwm output_pin; 00046 string output_on_command; 00047 string output_off_command; 00048 }; 00049 00050 #endif // SWITCH_H
Generated on Tue Jul 12 2022 20:09:02 by
1.7.2
