aboutsummaryrefslogtreecommitdiff
path: root/keyboards/phantom/phantom.c
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2020-11-02 20:23:54 +1100
committerGitHub <noreply@github.com>2020-11-02 20:23:54 +1100
commit8e71d3d053949593d02a3c1852fd1993d2e3f573 (patch)
treea17bc585db080b0845ef67d8986165cf09cd027e /keyboards/phantom/phantom.c
parente69da2db2c59a8017f0c9dee9933dd508d22b356 (diff)
downloadqmk_firmware-8e71d3d053949593d02a3c1852fd1993d2e3f573.tar.gz
qmk_firmware-8e71d3d053949593d02a3c1852fd1993d2e3f573.zip
Phantom refactor (#10805)
Diffstat (limited to 'keyboards/phantom/phantom.c')
-rw-r--r--keyboards/phantom/phantom.c46
1 files changed, 10 insertions, 36 deletions
diff --git a/keyboards/phantom/phantom.c b/keyboards/phantom/phantom.c
index 2bf1631b9..1017de009 100644
--- a/keyboards/phantom/phantom.c
+++ b/keyboards/phantom/phantom.c
@@ -13,51 +13,25 @@
13 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */ 15 */
16
16#include "phantom.h" 17#include "phantom.h"
17 18
18void matrix_init_kb(void) { 19void keyboard_pre_init_kb(void) {
19 // put your keyboard start-up code here
20 // runs once when the firmware starts up
21 led_init_ports(); 20 led_init_ports();
22 matrix_init_user();
23}
24
25void matrix_scan_kb(void) {
26 // put your looping keyboard code here
27 // runs every cycle (a lot)
28
29 matrix_scan_user();
30}
31 21
32bool process_record_kb(uint16_t keycode, keyrecord_t *record) { 22 keyboard_pre_init_user();
33 // put your per-action keyboard code here
34 // runs for every action, just before processing by the firmware
35
36 return process_record_user(keycode, record);
37} 23}
38 24
39void led_init_ports(void) { 25void led_init_ports(void) {
40 DDRB |= (1<<6) | (1<<7); // OUT 26 setPinOutput(B6);
27 setPinOutput(B7);
41} 28}
42 29
43void led_set_kb(uint8_t usb_led) { 30bool led_update_kb(led_t led_state) {
44 if (usb_led & (1<<USB_LED_CAPS_LOCK)) 31 if (led_update_user(led_state)) {
45 { 32 writePin(B6, led_state.caps_lock);
46 PORTB |= (1<<6); // HI 33 writePin(B7, led_state.scroll_lock);
47 }
48 else
49 {
50 PORTB &= ~(1<<6); // LO
51 }
52
53 if (usb_led & (1<<USB_LED_SCROLL_LOCK))
54 {
55 PORTB |= (1<<7); // HI
56 }
57 else
58 {
59 PORTB &= ~(1<<7); // LO
60 } 34 }
61 35
62 led_set_user(usb_led); 36 return true;
63} 37}