Clean up usage of QMK_KEYBOARD_H (#20167)

This commit is contained in:
Ryan
2023-03-20 08:12:05 +11:00
committed by GitHub
parent 9d302f9b7f
commit 3c144fac5e
74 changed files with 132 additions and 189 deletions

View File

@@ -1,64 +0,0 @@
#include QMK_KEYBOARD_H
#include "uart.h"
bool sun_bell = false;
bool sun_click = false;
bool command_extra(uint8_t code)
{
switch (code) {
case KC_H:
case KC_SLASH: /* ? */
print("\n\n----- Sun converter Help -----\n");
print("Home: Toggle Bell\n");
print("End: Toggle Click\n");
print("PgUp: LED all On\n");
print("PgDown: LED all Off\n");
print("Insert: Layout\n");
print("Delete: Reset\n");
return false;
case KC_DEL:
print("Reset\n");
uart_write(0x01);
break;
case KC_HOME:
sun_bell = !sun_bell;
if (sun_bell) {
print("Bell On\n");
uart_write(0x02);
} else {
print("Bell Off\n");
uart_write(0x03);
}
break;
case KC_END:
sun_click = !sun_click;
if (sun_click) {
print("Click On\n");
uart_write(0x0A);
} else {
print("Click Off\n");
uart_write(0x0B);
}
break;
case KC_PGUP:
print("LED all on\n");
uart_write(0x0E);
uart_write(0xFF);
break;
case KC_PGDN:
print("LED all off\n");
uart_write(0x0E);
uart_write(0x00);
break;
case KC_INSERT:
print("layout\n");
uart_write(0x0F);
break;
default:
xprintf("Unknown extra command: %02X\n", code);
return false;
}
return true;
}

View File

@@ -15,7 +15,8 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "led.h"
#include "print.h"
#include "uart.h"
void led_set(uint8_t usb_led)

View File

@@ -15,7 +15,11 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
#include "matrix.h"
#include "host.h"
#include "led.h"
#include "debug.h"
#include "wait.h"
#include "uart.h"
/*
@@ -86,9 +90,9 @@ void matrix_init(void)
/* print("."); */
/* while (uart_read()); */
/* uart_write(0x01); */
/* _delay_ms(500); */
/* wait_ms(500); */
/* if (uart_read() == 0xFF) { */
/* _delay_ms(500); */
/* wait_ms(500); */
/* if (uart_read() == 0x04) */
/* break; */
/* } */
@@ -112,7 +116,7 @@ uint8_t matrix_scan(void)
switch (code) {
case 0xFF: // reset success: FF 04
print("reset: ");
_delay_ms(500);
wait_ms(500);
code = uart_read();
xprintf("%02X\n", code);
if (code == 0x04) {
@@ -122,12 +126,12 @@ uint8_t matrix_scan(void)
return 0;
case 0xFE: // layout: FE <layout>
print("layout: ");
_delay_ms(500);
wait_ms(500);
xprintf("%02X\n", uart_read());
return 0;
case 0x7E: // reset fail: 7E 01
print("reset fail: ");
_delay_ms(500);
wait_ms(500);
xprintf("%02X\n", uart_read());
return 0;
case 0x7F: