QMK-ify some GPIO macros (#8315)
This commit is contained in:
parent
37a4b53c4f
commit
16a15c1cfc
12 changed files with 34 additions and 94 deletions
|
@ -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)
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue