From 5c1ef2bddc0fa5d4753d33a5ec8fed5d9da736c8 Mon Sep 17 00:00:00 2001
From: MechMerlin <30334081+mechmerlin@users.noreply.github.com>
Date: Sat, 6 Apr 2019 18:08:57 -0700
Subject: [PATCH] [Keyboard] Panc60 Refactor (#5559)
* remove unneeded uart setting
* use pragma once everywhere
* remove custom matrix support
* fixup readme
* set bootmagic to lite
* remove dependency on custom i2c code
* use the right header files and function calls
---
keyboards/panc60/config.h | 2 -
keyboards/panc60/i2c.c | 106 -------------------------
keyboards/panc60/i2c.h | 27 -------
keyboards/panc60/matrix.c | 145 -----------------------------------
keyboards/panc60/panc60.c | 4 +-
keyboards/panc60/panc60.h | 5 +-
keyboards/panc60/readme.md | 8 +-
keyboards/panc60/rules.mk | 5 +-
keyboards/panc60/usbconfig.h | 5 +-
9 files changed, 11 insertions(+), 296 deletions(-)
delete mode 100644 keyboards/panc60/i2c.c
delete mode 100644 keyboards/panc60/i2c.h
delete mode 100644 keyboards/panc60/matrix.c
diff --git a/keyboards/panc60/config.h b/keyboards/panc60/config.h
index 00bdbc60f1..edb25ad274 100644
--- a/keyboards/panc60/config.h
+++ b/keyboards/panc60/config.h
@@ -39,5 +39,3 @@ along with this program. If not, see .
#define NO_BACKLIGHT_CLOCK
#define BACKLIGHT_LEVELS 1
#define RGBLIGHT_ANIMATIONS
-
-#define NO_UART 1
diff --git a/keyboards/panc60/i2c.c b/keyboards/panc60/i2c.c
deleted file mode 100644
index e8c4455ad1..0000000000
--- a/keyboards/panc60/i2c.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Copyright 2016 Luiz Ribeiro
-
-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 .
-*/
-
-// Please do not modify this file
-
-#include
-#include
-
-#include "i2c.h"
-
-void i2c_set_bitrate(uint16_t bitrate_khz) {
- uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz);
- if (bitrate_div >= 16) {
- bitrate_div = (bitrate_div - 16) / 2;
- }
- TWBR = bitrate_div;
-}
-
-void i2c_init(void) {
- // set pull-up resistors on I2C bus pins
- PORTC |= 0b11;
-
- i2c_set_bitrate(400);
-
- // enable TWI (two-wire interface)
- TWCR |= (1 << TWEN);
-
- // enable TWI interrupt and slave address ACK
- TWCR |= (1 << TWIE);
- TWCR |= (1 << TWEA);
-}
-
-uint8_t i2c_start(uint8_t address) {
- // reset TWI control register
- TWCR = 0;
-
- // begin transmission and wait for it to end
- TWCR = (1<
-
-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 .
-*/
-
-// Please do not modify this file
-
-#ifndef __I2C_H__
-#define __I2C_H__
-
-void i2c_init(void);
-void i2c_set_bitrate(uint16_t bitrate_khz);
-uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length);
-
-#endif
diff --git a/keyboards/panc60/matrix.c b/keyboards/panc60/matrix.c
deleted file mode 100644
index cf0f63837b..0000000000
--- a/keyboards/panc60/matrix.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-Copyright 2018 Jack Humbert
-
-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 .
-*/
-
-#include
-#include
-#include
-#include "matrix.h"
-
-#ifndef DEBOUNCE
-# define DEBOUNCE 5
-#endif
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-__attribute__ ((weak))
-void matrix_init_user(void) { }
-
-__attribute__ ((weak))
-void matrix_scan_user(void) { }
-
-// #define MATRIX_ROW_PINS { B3, B4, B5, B6, B7 }
-// #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3, C2, D7 }
-
-static uint8_t debouncing = DEBOUNCE;
-
-static matrix_row_t matrix[MATRIX_ROWS];
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-void matrix_init(void) {
-
- // disables JTAG so we can use them as columns
- MCUCSR = (1<
#include "action_layer.h"
-#include "i2c.h"
+#include "i2c_master.h"
#include "quantum.h"
__attribute__ ((weak))
@@ -44,7 +44,7 @@ void rgblight_set(void) {
}
i2c_init();
- i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
+ i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
}
#endif
diff --git a/keyboards/panc60/panc60.h b/keyboards/panc60/panc60.h
index 95dcb1f90b..ee4569c615 100644
--- a/keyboards/panc60/panc60.h
+++ b/keyboards/panc60/panc60.h
@@ -13,8 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-#ifndef PANC60_H
-#define PANC60_H
+#pragma once
#include "quantum.h"
@@ -67,5 +66,3 @@
{ K30, KC_NO, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, KC_NO, K3D, K3E }, \
{ KC_NO, K41, K42, KC_NO, KC_NO, KC_NO, KC_NO, K47, KC_NO, KC_NO, K4A, KC_NO, K4C, KC_NO, KC_NO } \
}
-
-#endif
diff --git a/keyboards/panc60/readme.md b/keyboards/panc60/readme.md
index 05ac3d72be..737f238f6c 100644
--- a/keyboards/panc60/readme.md
+++ b/keyboards/panc60/readme.md
@@ -14,6 +14,8 @@ Make example for this keyboard (after setting up your build environment):
Flashing
+**Reset Key:** Hold down the key located at `K40`, commonly programmed as left control while plugging in the keyboard. You may also hold down the key located at `K00`, commonly programmed as the `Esc` key.
+
ps2avr(GB) boards use an atmega32a microcontroller and a different bootloader. It is not flashable using the regular QMK methods.
To put the panc60 into reset, hold left control while plugging in.
@@ -36,9 +38,9 @@ macOS:
```
3. Install the following packages:
```
- brew install python
- brew install pyusb
- brew install --HEAD`https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb
+ brew install python3
+ pip3 install pyusb
+ brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb
4. Place your keyboard into reset.
5. Flash the board by typing `bootloadHID -r` followed by the path to your `.hex` file.
diff --git a/keyboards/panc60/rules.mk b/keyboards/panc60/rules.mk
index 588562a95b..8438751822 100644
--- a/keyboards/panc60/rules.mk
+++ b/keyboards/panc60/rules.mk
@@ -31,7 +31,7 @@ F_CPU = 12000000
BOOTLOADER = bootloadHID
# build options
-BOOTMAGIC_ENABLE = yes
+BOOTMAGIC_ENABLE = lite
MOUSEKEY_ENABLE = yes
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = yes
@@ -43,8 +43,7 @@ RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0
# custom matrix setup
-CUSTOM_MATRIX = yes
-SRC = matrix.c i2c.c
+SRC = i2c_master.c
# programming options
PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex
diff --git a/keyboards/panc60/usbconfig.h b/keyboards/panc60/usbconfig.h
index d2d848fcdc..54a7d20f14 100644
--- a/keyboards/panc60/usbconfig.h
+++ b/keyboards/panc60/usbconfig.h
@@ -8,8 +8,7 @@
* This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $
*/
-#ifndef __usbconfig_h_included__
-#define __usbconfig_h_included__
+#pragma once
#include "config.h"
@@ -392,5 +391,3 @@ section at the end of this file).
/* #define USB_INTR_PENDING EIFR */
#define USB_INTR_PENDING_BIT INTF1
#define USB_INTR_VECTOR INT1_vect
-
-#endif /* __usbconfig_h_included__ */