From 3c188d98a1aebbabb06c635f91195182aa84fa4d Mon Sep 17 00:00:00 2001 From: Dao Tak Isaac Date: Sun, 10 Oct 2021 04:55:00 +0700 Subject: [Keyboard] Add cg108 keyboard and fix keymap Dosa40rgb (#14753) * Add cg108 keyboard and fix keymap Dosa40rgb * Update keyboards/dtisaac/cg108/readme.md * Update keyboards/dtisaac/dosa40rgb/rules.mk * Update keyboards/dtisaac/cg108/info.json * Update keyboards/dtisaac/cg108/keymaps/default/keymap.c * Update keyboards/dtisaac/cg108/rules.mk * Update keyboards/dtisaac/cg108/rules.mk --- .../dtisaac/dosa40rgb/keymaps/default/keymap.c | 55 +--------------------- 1 file changed, 1 insertion(+), 54 deletions(-) (limited to 'keyboards/dtisaac/dosa40rgb/keymaps/default') diff --git a/keyboards/dtisaac/dosa40rgb/keymaps/default/keymap.c b/keyboards/dtisaac/dosa40rgb/keymaps/default/keymap.c index c9bde4bb8d..19fcb7868e 100644 --- a/keyboards/dtisaac/dosa40rgb/keymaps/default/keymap.c +++ b/keyboards/dtisaac/dosa40rgb/keymaps/default/keymap.c @@ -14,8 +14,6 @@ * along with this program. If not, see . */ #include QMK_KEYBOARD_H -#include "spi_master.h" -#include "wait.h" // Defines names for use in layer keycodes and the keymap enum layer_names { @@ -28,14 +26,9 @@ enum layer_names { enum custom_keycodes { BASE, L1, - BLE_DIS, // Disconnect BLE - LED_EN, // Toggle LED }; #define L1 MO(_L1) -const uint8_t cm1[] = "AT+GAPSTOPADV"; -const uint8_t cm2[] = "AT+GAPDISCONNECT"; -const uint8_t cm3[] = "ATZ"; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Base */ @@ -52,7 +45,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ), [_L2] = LAYOUT( - LED_EN, RGB_RMOD, KC_UP, RGB_MOD, RGB_HUI, RGB_VAI, RGB_SAI, RGB_SPI, KC_TRNS, OUT_USB, OUT_BT, BLE_DIS, + RGB_TOG, RGB_RMOD, KC_UP, RGB_MOD, RGB_HUI, RGB_VAI, RGB_SAI, RGB_SPI, KC_TRNS, OUT_USB, OUT_BT, KC_TRNS, KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, RGB_HUD, RGB_VAD, RGB_SAD, RGB_SPD, KC_TRNS, KC_TRNS, KC_BSLS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS @@ -74,49 +67,3 @@ void rgb_matrix_indicators_user(void) rgb_matrix_set_color(22, 200, 0, 200); } } - -void sdep_send(const uint8_t *cmd, uint8_t len) { - - spi_start(AdafruitBleCSPin, false, 0, 2); - uint8_t cnt = 200; - bool ready = false; - - do { - ready = spi_write(0x10) != 0xFE; - if (ready) { - break; - } - spi_stop(); - wait_us(25); - spi_start(AdafruitBleCSPin, false, 0, 2); - } while (cnt--); - - if (ready) { - spi_write(0x00); - spi_write(0x0A); - spi_write(len); - spi_transmit(cmd, len); - } - - spi_stop(); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - - switch (keycode) { - case LED_EN: - if (record->event.pressed) { - DDRB = DDRB ^ 0x20; - PORTB &= ~(1 << 5); - } - return false; - case BLE_DIS: - if (record->event.pressed) { - sdep_send(cm1,sizeof(cm1)); - sdep_send(cm2,sizeof(cm2)); - sdep_send(cm3,sizeof(cm3)); - } - return false; - } - return true; -} \ No newline at end of file -- cgit v1.2.1