solenoid.h (1809B)
1 /* Copyright 2018 mtdjr - modified by ishtob 2 * Driver for solenoid written for QMK 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #pragma once 19 20 #ifndef SOLENOID_DEFAULT_DWELL 21 # define SOLENOID_DEFAULT_DWELL 12 22 #endif 23 24 #ifndef SOLENOID_MAX_DWELL 25 # define SOLENOID_MAX_DWELL 100 26 #endif 27 28 #ifndef SOLENOID_MIN_DWELL 29 # define SOLENOID_MIN_DWELL 4 30 #endif 31 32 #ifndef SOLENOID_DWELL_STEP_SIZE 33 # define SOLENOID_DWELL_STEP_SIZE 1 34 #endif 35 36 #ifndef SOLENOID_DEFAULT_BUZZ 37 # define SOLENOID_DEFAULT_BUZZ 0 38 #endif 39 40 #ifndef SOLENOID_BUZZ_ACTUATED 41 # define SOLENOID_BUZZ_ACTUATED SOLENOID_MIN_DWELL 42 #endif 43 44 #ifndef SOLENOID_BUZZ_NONACTUATED 45 # define SOLENOID_BUZZ_NONACTUATED SOLENOID_MIN_DWELL 46 #endif 47 48 #ifndef SOLENOID_PINS 49 # ifdef SOLENOID_PIN 50 # define SOLENOID_PINS {SOLENOID_PIN} 51 # else 52 # error SOLENOID_PINS array not defined 53 # endif 54 #endif 55 56 void solenoid_buzz_on(void); 57 void solenoid_buzz_off(void); 58 void solenoid_set_buzz(uint8_t buzz); 59 60 void solenoid_set_dwell(uint8_t dwell); 61 62 void solenoid_stop(uint8_t index); 63 void solenoid_fire(uint8_t index); 64 void solenoid_fire_handler(void); 65 66 void solenoid_check(void); 67 68 void solenoid_setup(void); 69 void solenoid_shutdown(void);