Skip to content

Commit

Permalink
QMK-ify some GPIO macros (qmk#8315)
Browse files Browse the repository at this point in the history
  • Loading branch information
fauxpark authored Apr 30, 2020
1 parent 8866f19 commit a9831d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 61 deletions.
8 changes: 4 additions & 4 deletions drivers/avr/apa102.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }

void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
pinMode(RGB_DI_PIN, PinDirectionOutput);
pinMode(RGB_CLK_PIN, PinDirectionOutput);
setPinOutput(RGB_DI_PIN);
setPinOutput(RGB_CLK_PIN);

apa102_send_array((uint8_t *)ledarray, leds)
}
Expand Down Expand Up @@ -90,7 +90,7 @@ void apa102_end_frame(uint16_t leds) {
void apa102_send_byte(uint8_t byte) {
uint8_t i;
for (i = 0; i < 8; i++) {
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
digitalWrite(RGB_CLK_PIN, PinLevelHigh);
writePin(RGB_DI_PIN, !!(byte & (1 << (7 - i))));
writePinHigh(RGB_CLK_PIN);
}
}
1 change: 0 additions & 1 deletion drivers/avr/ssd1306.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <stdbool.h>
#include <stdio.h>
#include "pincontrol.h"
#include "config.h"

enum ssd1306_cmds {
Expand Down
50 changes: 0 additions & 50 deletions quantum/pincontrol.h

This file was deleted.

11 changes: 5 additions & 6 deletions users/mtdjr/solenoid.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define SOLENOID_H

#include <timer.h>
#include "pincontrol.h"


#define SOLENOID_DEFAULT_DWELL 12
Expand Down Expand Up @@ -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;
}
Expand All @@ -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) {
Expand All @@ -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

0 comments on commit a9831d3

Please sign in to comment.