QMK-ify some GPIO macros (#8315)
This commit is contained in:
parent
37a4b53c4f
commit
16a15c1cfc
12 changed files with 34 additions and 94 deletions
|
@ -2,7 +2,6 @@
|
|||
#define SOLENOID_H
|
||||
|
||||
#include <timer.h>
|
||||
#include "pincontrol.h"
|
||||
|
||||
|
||||
#define SOLENOID_DEFAULT_DWELL 12
|
||||
|
@ -45,7 +44,7 @@ void solenoid_toggle(void) {
|
|||
}
|
||||
|
||||
void solenoid_stop(void) {
|
||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
||||
writePinLow(SOLENOID_PIN);
|
||||
solenoid_on = false;
|
||||
solenoid_buzzing = false;
|
||||
}
|
||||
|
@ -59,7 +58,7 @@ void solenoid_fire(void) {
|
|||
solenoid_on = true;
|
||||
solenoid_buzzing = true;
|
||||
solenoid_start = timer_read();
|
||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
||||
writePinHigh(SOLENOID_PIN);
|
||||
}
|
||||
|
||||
void solenoid_check(void) {
|
||||
|
@ -80,20 +79,20 @@ void solenoid_check(void) {
|
|||
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
|
||||
if (!solenoid_buzzing) {
|
||||
solenoid_buzzing = true;
|
||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
||||
writePinHigh(SOLENOID_PIN);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (solenoid_buzzing) {
|
||||
solenoid_buzzing = false;
|
||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
||||
writePinLow(SOLENOID_PIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void solenoid_setup(void) {
|
||||
pinMode(SOLENOID_PIN, PinDirectionOutput);
|
||||
setPinOutput(SOLENOID_PIN);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue