-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draytronics Keyboards Refactor & Daisy V2 MacroPad Addition #23873
Changes from all commits
40db716
67be8d5
64281a1
a0b4219
003afd1
13467a0
d7d8e2b
670524a
4f88812
e672b6b
22aa20e
3b08690
6e00080
3a96d62
950d765
c26f670
e7a08ef
2c3dae8
c25c74d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*Copyright 2024 Blake Drayson / Draytronics | ||
|
||
Contact info@draytronics.co.uk | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
This code is inspired by and adapted from the code used in the Printed Pad by Noah Beidelman (@noahbei) | ||
|
||
It also references the concept and some pixel frames (the arasaka logo) form Aleks (@aleksbrgt) | ||
|
||
Other pixel images are either created by me or use the resources of Velency Grpahics https://www.valencygraphics.com/cyberpunk-2077 | ||
|
||
No claim for licence or ownership is made for any logos or similarities to logos or brand names. | ||
*/ | ||
#pragma once | ||
|
||
#define I2C_DRIVER I2CD1 | ||
#define I2C1_SCL_PIN B8 | ||
#define I2C1_SDA_PIN B9 | ||
#define I2C1_SCL_PAL_MODE 1 | ||
#define I2C1_SDA_PAL_MODE 1 | ||
#define I2C1_TIMINGR_PRESC 0x00U | ||
#define I2C1_TIMINGR_SCLDEL 0x03U | ||
#define I2C1_TIMINGR_SDADEL 0x01U | ||
#define I2C1_TIMINGR_SCLH 0x03U | ||
#define I2C1_TIMINGR_SCLL 0x09U | ||
|
||
#define OLED_TIMEOUT 300000 |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,89 @@ | ||||||||||||||||
/*Copyright 2024 Blake Drayson / Draytronics | ||||||||||||||||
|
||||||||||||||||
Contact info@draytronics.co.uk | ||||||||||||||||
|
||||||||||||||||
This program is free software: you can redistribute it and/or modify | ||||||||||||||||
it under the terms of the GNU General Public License as published by | ||||||||||||||||
the Free Software Foundation, either version 2 of the License, or | ||||||||||||||||
(at your option) any later version. | ||||||||||||||||
|
||||||||||||||||
This program is distributed in the hope that it will be useful, | ||||||||||||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||
GNU General Public License for more details. | ||||||||||||||||
|
||||||||||||||||
You should have received a copy of the GNU General Public License | ||||||||||||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||
|
||||||||||||||||
This code is inspired by and adapted from the code used in the Printed Pad by Noah Beidelman (@noahbei) | ||||||||||||||||
|
||||||||||||||||
It also references the concept and some pixel frames (the arasaka logo) form Aleks (@aleksbrgt) | ||||||||||||||||
|
||||||||||||||||
Other pixel images are either created by me or use the resources of Velency Grpahics https://www.valencygraphics.com/cyberpunk-2077 | ||||||||||||||||
|
||||||||||||||||
No claim for licence or ownership is made for any logos or similarities to logos or brand names. | ||||||||||||||||
*/ | ||||||||||||||||
|
||||||||||||||||
#include "daisy_v2.h" | ||||||||||||||||
|
||||||||||||||||
enum my_keycodes { | ||||||||||||||||
ENCODER_PRESS = SAFE_RANGE | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
}; | ||||||||||||||||
|
||||||||||||||||
void board_init(void) { | ||||||||||||||||
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
const uint8_t max_layer = 3; | ||||||||||||||||
uint8_t current_display_mode = 0; | ||||||||||||||||
|
||||||||||||||||
bool hidden = false; | ||||||||||||||||
|
||||||||||||||||
bool key_pressed = false; | ||||||||||||||||
|
||||||||||||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | ||||||||||||||||
if (!process_record_user(keycode, record)) { | ||||||||||||||||
return false; | ||||||||||||||||
} | ||||||||||||||||
#ifdef OLED_ENABLE | ||||||||||||||||
key_pressed = record->event.pressed; | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not the best way to handle this. If you press two keys, and release on, this will be "false", which isn't true. If anything, using a uint8_t instead of bool, and:
Suggested change
|
||||||||||||||||
#endif | ||||||||||||||||
switch(keycode) { | ||||||||||||||||
case ENCODER_PRESS: | ||||||||||||||||
if (record->event.pressed) { | ||||||||||||||||
// on tap | ||||||||||||||||
if (record->tap.count) { | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you're not manually setting tap.count, then this isn't populated, normally. |
||||||||||||||||
tap_code(KC_MUTE); | ||||||||||||||||
} | ||||||||||||||||
#ifdef OLED_ENABLE | ||||||||||||||||
// on hold | ||||||||||||||||
else { | ||||||||||||||||
hidden = false; | ||||||||||||||||
current_display_mode = (current_display_mode + 1) % 4; | ||||||||||||||||
} | ||||||||||||||||
#endif | ||||||||||||||||
} | ||||||||||||||||
return false; | ||||||||||||||||
} | ||||||||||||||||
return true; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
#ifdef OLED_ENABLE | ||||||||||||||||
uint32_t flash_timer = 0; | ||||||||||||||||
bool layer_changed = false; | ||||||||||||||||
|
||||||||||||||||
// when the layer is changed, flash the layer number on the screen | ||||||||||||||||
layer_state_t layer_state_set_kb(layer_state_t state) { | ||||||||||||||||
flash_timer = timer_read(); | ||||||||||||||||
layer_changed = true; | ||||||||||||||||
|
||||||||||||||||
return layer_state_set_user(state); | ||||||||||||||||
} | ||||||||||||||||
#endif | ||||||||||||||||
|
||||||||||||||||
void keyboard_post_init_user(void) { | ||||||||||||||||
//This is an adjustment to resolve the issue that occurs when there is a | ||||||||||||||||
//static colour underglow the first LED can be a different colour on first init. | ||||||||||||||||
rgblight_disable_noeeprom(); | ||||||||||||||||
rgblight_enable_noeeprom(); | ||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*Copyright 2024 Blake Drayson / Draytronics | ||
|
||
Contact info@draytronics.co.uk | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
This code is inspired by and adapted from the code used in the Printed Pad by Noah Beidelman (@noahbei) | ||
|
||
It also references the concept and some pixel frames (the arasaka logo) form Aleks (@aleksbrgt) | ||
|
||
Other pixel images are either created by me or use the resources of Velency Grpahics https://www.valencygraphics.com/cyberpunk-2077 | ||
|
||
No claim for licence or ownership is made for any logos or similarities to logos or brand names. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "quantum.h" | ||
|
||
//for oled key press | ||
extern bool key_pressed; | ||
|
||
// for changing oled display mode | ||
extern uint8_t current_display_mode; | ||
|
||
// for hidden animation toggle | ||
extern bool hidden; | ||
|
||
//for determining when the layer is changed and having a timer for how long we flash the layer | ||
extern uint32_t flash_timer; | ||
extern bool layer_changed; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*Copyright 2024 Blake Drayson / Draytronics | ||
|
||
Contact info@draytronics.co.uk | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
This code is inspired by and adapted from the code used in the Printed Pad by Noah Beidelman (@noahbei) | ||
|
||
It also references the concept and some pixel frames (the arasaka logo) form Aleks (@aleksbrgt) | ||
|
||
Other pixel images are either created by me or use the resources of Velency Grpahics https://www.valencygraphics.com/cyberpunk-2077 | ||
|
||
No claim for licence or ownership is made for any logos or similarities to logos or brand names. | ||
*/ | ||
#pragma once | ||
|
||
#define HAL_USE_I2C TRUE | ||
|
||
#include_next <halconf.h> |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,68 @@ | ||||
{ | ||||
"manufacturer": "Draytronics", | ||||
"keyboard_name": "DAISY", | ||||
"maintainer": "ghostseven", | ||||
"bootloader": "stm32-dfu", | ||||
"diode_direction": "COL2ROW", | ||||
"encoder": { | ||||
"enabled": true, | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
"rotary": [ | ||||
{"pin_a": "A15", "pin_b": "A14"} | ||||
] | ||||
}, | ||||
"features": { | ||||
"bootmagic": true, | ||||
"encoder": true, | ||||
"extrakey": true, | ||||
"mousekey": true, | ||||
"oled": true, | ||||
"rgblight": true | ||||
}, | ||||
"matrix_pins": { | ||||
"cols": ["B11", "B10", "B2", "B1"], | ||||
"rows": ["A2", "A1", "A0"] | ||||
}, | ||||
"processor": "STM32F072", | ||||
"qmk": { | ||||
"tap_keycode_delay": 10 | ||||
}, | ||||
"rgblight": { | ||||
"led_count": 4, | ||||
"animations": { | ||||
"breathing": true, | ||||
"rainbow_mood": true, | ||||
"rainbow_swirl": true, | ||||
"snake": true, | ||||
"knight": true, | ||||
"christmas": true, | ||||
"static_gradient": true, | ||||
"rgb_test": true, | ||||
"alternating": true, | ||||
"twinkle": true | ||||
} | ||||
}, | ||||
"url": "https://www.draytronics.co.uk/daisy", | ||||
"usb": { | ||||
"device_version": "2.0.0", | ||||
"pid": "0x4441", | ||||
"vid": "0x4454" | ||||
}, | ||||
"ws2812": { | ||||
"pin": "B12" | ||||
}, | ||||
"layouts": { | ||||
"LAYOUT": { | ||||
"layout": [ | ||||
{"label": "", "matrix": [0, 0], "x": 0, "y": 0}, | ||||
{"label": "", "matrix": [1, 0], "x": 0, "y": 1}, | ||||
{"label": "", "matrix": [1, 1], "x": 1, "y": 1}, | ||||
{"label": "", "matrix": [1, 2], "x": 2, "y": 1}, | ||||
{"label": "", "matrix": [1, 3], "x": 3, "y": 1}, | ||||
{"label": "", "matrix": [2, 0], "x": 0, "y": 2}, | ||||
{"label": "", "matrix": [2, 1], "x": 1, "y": 2}, | ||||
{"label": "", "matrix": [2, 2], "x": 2, "y": 2}, | ||||
{"label": "", "matrix": [2, 3], "x": 3, "y": 2} | ||||
] | ||||
} | ||||
} | ||||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,69 @@ | ||||||||||||||||||||
/*Copyright 2024 Blake Drayson / Draytronics | ||||||||||||||||||||
|
||||||||||||||||||||
Contact info@draytronics.co.uk | ||||||||||||||||||||
|
||||||||||||||||||||
This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||
it under the terms of the GNU General Public License as published by | ||||||||||||||||||||
the Free Software Foundation, either version 2 of the License, or | ||||||||||||||||||||
(at your option) any later version. | ||||||||||||||||||||
|
||||||||||||||||||||
This program is distributed in the hope that it will be useful, | ||||||||||||||||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||
GNU General Public License for more details. | ||||||||||||||||||||
|
||||||||||||||||||||
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 | ||||||||||||||||||||
|
||||||||||||||||||||
enum layers { | ||||||||||||||||||||
_BASE, | ||||||||||||||||||||
_CODE | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
enum my_keycodes { | ||||||||||||||||||||
ENCODER_PRESS = SAFE_RANGE | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||||||||||||||||||||
|
||||||||||||||||||||
/* | ||||||||||||||||||||
* ┌────────────┐ | ||||||||||||||||||||
* │ Vol / Anim │ | ||||||||||||||||||||
* ├────────────┼────────────┬────────────┬─────────────┐ | ||||||||||||||||||||
* │ Code Layer │ Media Next │ Media Prev │ Media Pause │ | ||||||||||||||||||||
* ├────────────┼────────────┼────────────┼─────────────┤ | ||||||||||||||||||||
* │ Prev Desk │ Miss Ctrl │ App Window │ Next Desk │ | ||||||||||||||||||||
* └────────────┴────────────┴────────────┴─────────────┘ | ||||||||||||||||||||
*/ | ||||||||||||||||||||
[_BASE] = LAYOUT( | ||||||||||||||||||||
ENCODER_PRESS, | ||||||||||||||||||||
MO(_CODE), KC_MPRV, KC_MNXT, KC_MPLY, | ||||||||||||||||||||
C(KC_LEFT), C(KC_UP), C(KC_DOWN), C(KC_RIGHT) | ||||||||||||||||||||
), | ||||||||||||||||||||
/* | ||||||||||||||||||||
* ┌────────────┐ | ||||||||||||||||||||
* │ Vol / Anim │ | ||||||||||||||||||||
* ├────────────┼────────────┬────────────┬─────────────┐ | ||||||||||||||||||||
* │ │ RGB Mode │ RBG Hue │ RGB Toggle │ | ||||||||||||||||||||
* ├────────────┼────────────┼────────────┼─────────────┤ | ||||||||||||||||||||
* │ Scrn Shot │ Force Quit │ GUI + F │ DFU Mode │ | ||||||||||||||||||||
* └────────────┴────────────┴────────────┴─────────────┘ | ||||||||||||||||||||
*/ | ||||||||||||||||||||
[_CODE] = LAYOUT( | ||||||||||||||||||||
ENCODER_PRESS, | ||||||||||||||||||||
_______, RGB_MOD, RGB_HUI, RGB_TOG, | ||||||||||||||||||||
G(S(KC_5)), G(A(KC_ESC)), G(KC_F), QK_BOOT | ||||||||||||||||||||
) | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
bool encoder_update_user(uint8_t index, bool clockwise) { | ||||||||||||||||||||
if (clockwise) { | ||||||||||||||||||||
tap_code(KC_VOLD); | ||||||||||||||||||||
} else { | ||||||||||||||||||||
tap_code(KC_VOLU); | ||||||||||||||||||||
} | ||||||||||||||||||||
return false; | ||||||||||||||||||||
} | ||||||||||||||||||||
Comment on lines
+61
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/*Copyright 2024 Blake Drayson / Draytronics | ||
|
||
Contact info@draytronics.co.uk | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 2 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
This code is inspired by and adapted from the code used in the Printed Pad by Noah Beidelman (@noahbei) | ||
|
||
It also references the concept and some pixel frames (the arasaka logo) form Aleks (@aleksbrgt) | ||
|
||
Other pixel images are either created by me or use the resources of Velency Grpahics https://www.valencygraphics.com/cyberpunk-2077 | ||
|
||
No claim for licence or ownership is made for any logos or similarities to logos or brand names. | ||
*/ | ||
#pragma once | ||
|
||
#include_next <mcuconf.h> | ||
|
||
#undef STM32_I2C_USE_I2C1 | ||
#define STM32_I2C_USE_I2C1 TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be reverted. Any changes here should be a separate PR