diff options
| author | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-05-19 09:50:57 -0700 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-05-19 09:50:57 -0700 |
| commit | d67eb20aed97410e11a17f7f5799d822f98a7558 (patch) | |
| tree | 57a61a8c925f0c7fa203e1e8fc703958bf64581e /keyboards | |
| parent | 11c7cd47aee697ac73bf7ec5704086e2a15d7dca (diff) | |
| download | qmk_firmware-d67eb20aed97410e11a17f7f5799d822f98a7558.tar.gz qmk_firmware-d67eb20aed97410e11a17f7f5799d822f98a7558.zip | |
[Keyboard] Pearl Refactors (#5907)
* use pragma once
* remove custom matrix
* remove custom i2c code in favor of QMK's i2c_master
* rename to all lower case readme
* update readme
* turn off bootmagic as it doesn't work anyway
* Update keyboards/pearl/readme.md
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
Diffstat (limited to 'keyboards')
| -rw-r--r-- | keyboards/pearl/README.md | 85 | ||||
| -rw-r--r-- | keyboards/pearl/config.h | 4 | ||||
| -rw-r--r-- | keyboards/pearl/i2c.c | 106 | ||||
| -rw-r--r-- | keyboards/pearl/i2c.h | 27 | ||||
| -rw-r--r-- | keyboards/pearl/matrix.c | 106 | ||||
| -rw-r--r-- | keyboards/pearl/pearl.c | 67 | ||||
| -rw-r--r-- | keyboards/pearl/pearl.h | 6 | ||||
| -rw-r--r-- | keyboards/pearl/readme.md | 47 | ||||
| -rw-r--r-- | keyboards/pearl/rules.mk | 5 | ||||
| -rw-r--r-- | keyboards/pearl/usbconfig.h | 5 |
10 files changed, 102 insertions, 356 deletions
diff --git a/keyboards/pearl/README.md b/keyboards/pearl/README.md deleted file mode 100644 index ec54ba80f..000000000 --- a/keyboards/pearl/README.md +++ /dev/null | |||
| @@ -1,85 +0,0 @@ | |||
| 1 | # Pearl 40% | ||
| 2 | |||
| 3 | Pearl 40% is a keyboard designed by Koobaczech. It uses an Atmel | ||
| 4 | ATMEGA32A MCU. | ||
| 5 | |||
| 6 | ## Compiling and flashing | ||
| 7 | |||
| 8 | These instructions are for building and flashing your Pearl 40% without | ||
| 9 | Bootmapper Client. | ||
| 10 | |||
| 11 | ### Requirements | ||
| 12 | |||
| 13 | #### Windows | ||
| 14 | |||
| 15 | (to be written, help needed) | ||
| 16 | |||
| 17 | #### Mac | ||
| 18 | |||
| 19 | Apart from regular QMK and AVR dependencies you need to install | ||
| 20 | `bootloadHID`. You can install it with `homebrew` as follows: | ||
| 21 | |||
| 22 | $ brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb | ||
| 23 | |||
| 24 | If you don't use `homebrew` you can try following the compiling | ||
| 25 | instructions defined below in the Linux section. | ||
| 26 | |||
| 27 | #### Linux | ||
| 28 | |||
| 29 | For Linux you require all regular QMK dependencies, but make sure you're | ||
| 30 | using `gcc-avr` version 4.9 or higher. 4.8 and lower do not contain the | ||
| 31 | proper definitions for ATMEGA32A MCUs and QMK will fail while attempting | ||
| 32 | to compile a HEX for Pearl 40%. | ||
| 33 | |||
| 34 | E.g. you cannot compile Pearl 40% HEX on a regular Ubuntu 14.04 as | ||
| 35 | `gcc-avr` version is maxed to 4.8 on it. | ||
| 36 | |||
| 37 | Additionally you need an operational `bootloadHID` binary. | ||
| 38 | |||
| 39 | You can install `bootloadHID` by taking the following steps: | ||
| 40 | |||
| 41 | $ git clone https://github.com/robertgzr/bootloadHID ~/tmp/bootloadHIDsrc | ||
| 42 | $ cd ~/tmp/bootloadHIDsrc/commandline | ||
| 43 | $ make VENDORID=0x16c0 PRODUCTID=0x05DF # vid and pid for atmega32a | ||
| 44 | $ chmod +x bootloadHID && cp bootloadHID /usr/bin/bootloadHID | ||
| 45 | |||
| 46 | Running `which bootloadHID` should return `/usr/bin/bootloadHID`. | ||
| 47 | |||
| 48 | ### Compiling | ||
| 49 | |||
| 50 | Enter the QMK root directory and compile a keymap with the following | ||
| 51 | command: | ||
| 52 | |||
| 53 | $ make pearl:<keymap> | ||
| 54 | |||
| 55 | where `<keymap>` is a layout directory under the `pearl` directory. | ||
| 56 | |||
| 57 | QMK should compile a HEX (called `pearl_<keymap>.hex`) for you, which | ||
| 58 | you can flash using `bootloadHID`. | ||
| 59 | |||
| 60 | ### Flashing | ||
| 61 | |||
| 62 | To enable Pearl 40% bootloading mode, unplug the keyboard, then plug it | ||
| 63 | in while holding `Esc` at the same time (the top-leftmost switch on the | ||
| 64 | PCB, next to the USB connector). Once the board is in bootload mode, | ||
| 65 | issue the following command (you might require `sudo` to perform the | ||
| 66 | command): | ||
| 67 | |||
| 68 | # assuming we're still in the QMK root dir where you compiled a HEX into | ||
| 69 | $ bootloadHID -r ./pearl_<keymap>.hex | ||
| 70 | |||
| 71 | You should see something similar to | ||
| 72 | |||
| 73 | > Page size = <value> | ||
| 74 | > Device size = <value>; <value> remaining | ||
| 75 | > Uploading <value> bytes starting at 0 (0x0) | ||
| 76 | > <value> ... <current value> | ||
| 77 | |||
| 78 | where `<current value>` should be slowly increasing as the HEX is being | ||
| 79 | flashed to the board. If there is some warning about `resource busy` it | ||
| 80 | should still work OK. | ||
| 81 | |||
| 82 | Once done the board underglow should turn red and the new firmware has | ||
| 83 | been flashed. If you can't type on the board try plugging it in again | ||
| 84 | (without holding any keys to prevent accidentally setting it into | ||
| 85 | bootload mode again). | ||
diff --git a/keyboards/pearl/config.h b/keyboards/pearl/config.h index 6edf170d9..00850b8f0 100644 --- a/keyboards/pearl/config.h +++ b/keyboards/pearl/config.h | |||
| @@ -35,8 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 35 | #define MATRIX_ROWS 4 | 35 | #define MATRIX_ROWS 4 |
| 36 | #define MATRIX_COLS 13 | 36 | #define MATRIX_COLS 13 |
| 37 | 37 | ||
| 38 | #define MATRIX_ROW_PINS { B0, B1, B2, B3, B4, B5, B6, B7 } | 38 | #define MATRIX_ROW_PINS { B0, B1, B2, B3 } |
| 39 | #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6} | 39 | #define MATRIX_COL_PINS { A0, A1, A2, A3, A4, A5, A6, A7, C7, C6, C5, C4, C3} |
| 40 | #define UNUSED_PINS | 40 | #define UNUSED_PINS |
| 41 | 41 | ||
| 42 | #define DIODE_DIRECTION COL2ROW | 42 | #define DIODE_DIRECTION COL2ROW |
diff --git a/keyboards/pearl/i2c.c b/keyboards/pearl/i2c.c deleted file mode 100644 index a4f952135..000000000 --- a/keyboards/pearl/i2c.c +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | // Please do not modify this file | ||
| 19 | |||
| 20 | #include <avr/io.h> | ||
| 21 | #include <util/twi.h> | ||
| 22 | |||
| 23 | #include "i2c.h" | ||
| 24 | |||
| 25 | void i2c_set_bitrate(uint16_t bitrate_khz) { | ||
| 26 | uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); | ||
| 27 | if (bitrate_div >= 16) { | ||
| 28 | bitrate_div = (bitrate_div - 16) / 2; | ||
| 29 | } | ||
| 30 | TWBR = bitrate_div; | ||
| 31 | } | ||
| 32 | |||
| 33 | void i2c_init(void) { | ||
| 34 | // set pull-up resistors on I2C bus pins | ||
| 35 | PORTC |= 0b11; | ||
| 36 | |||
| 37 | i2c_set_bitrate(400); | ||
| 38 | |||
| 39 | // enable TWI (two-wire interface) | ||
| 40 | TWCR |= (1 << TWEN); | ||
| 41 | |||
| 42 | // enable TWI interrupt and slave address ACK | ||
| 43 | TWCR |= (1 << TWIE); | ||
| 44 | TWCR |= (1 << TWEA); | ||
| 45 | } | ||
| 46 | |||
| 47 | uint8_t i2c_start(uint8_t address) { | ||
| 48 | // reset TWI control register | ||
| 49 | TWCR = 0; | ||
| 50 | |||
| 51 | // begin transmission and wait for it to end | ||
| 52 | TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN); | ||
| 53 | while (!(TWCR & (1<<TWINT))); | ||
| 54 | |||
| 55 | // check if the start condition was successfully transmitted | ||
| 56 | if ((TWSR & 0xF8) != TW_START) { | ||
| 57 | return 1; | ||
| 58 | } | ||
| 59 | |||
| 60 | // transmit address and wait | ||
| 61 | TWDR = address; | ||
| 62 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 63 | while (!(TWCR & (1<<TWINT))); | ||
| 64 | |||
| 65 | // check if the device has acknowledged the READ / WRITE mode | ||
| 66 | uint8_t twst = TW_STATUS & 0xF8; | ||
| 67 | if ((twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK)) { | ||
| 68 | return 1; | ||
| 69 | } | ||
| 70 | |||
| 71 | return 0; | ||
| 72 | } | ||
| 73 | |||
| 74 | void i2c_stop(void) { | ||
| 75 | TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO); | ||
| 76 | } | ||
| 77 | |||
| 78 | uint8_t i2c_write(uint8_t data) { | ||
| 79 | TWDR = data; | ||
| 80 | |||
| 81 | // transmit data and wait | ||
| 82 | TWCR = (1<<TWINT) | (1<<TWEN); | ||
| 83 | while (!(TWCR & (1<<TWINT))); | ||
| 84 | |||
| 85 | if ((TWSR & 0xF8) != TW_MT_DATA_ACK) { | ||
| 86 | return 1; | ||
| 87 | } | ||
| 88 | |||
| 89 | return 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length) { | ||
| 93 | if (i2c_start(address)) { | ||
| 94 | return 1; | ||
| 95 | } | ||
| 96 | |||
| 97 | for (uint16_t i = 0; i < length; i++) { | ||
| 98 | if (i2c_write(data[i])) { | ||
| 99 | return 1; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | |||
| 103 | i2c_stop(); | ||
| 104 | |||
| 105 | return 0; | ||
| 106 | } | ||
diff --git a/keyboards/pearl/i2c.h b/keyboards/pearl/i2c.h deleted file mode 100644 index 93a69c94d..000000000 --- a/keyboards/pearl/i2c.h +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2016 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | // Please do not modify this file | ||
| 19 | |||
| 20 | #ifndef __I2C_H__ | ||
| 21 | #define __I2C_H__ | ||
| 22 | |||
| 23 | void i2c_init(void); | ||
| 24 | void i2c_set_bitrate(uint16_t bitrate_khz); | ||
| 25 | uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); | ||
| 26 | |||
| 27 | #endif | ||
diff --git a/keyboards/pearl/matrix.c b/keyboards/pearl/matrix.c deleted file mode 100644 index 57aa36b5f..000000000 --- a/keyboards/pearl/matrix.c +++ /dev/null | |||
| @@ -1,106 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <avr/io.h> | ||
| 19 | #include <util/delay.h> | ||
| 20 | |||
| 21 | #include "matrix.h" | ||
| 22 | |||
| 23 | #ifndef DEBOUNCE | ||
| 24 | #define DEBOUNCE 5 | ||
| 25 | #endif | ||
| 26 | |||
| 27 | static uint8_t debouncing = DEBOUNCE; | ||
| 28 | |||
| 29 | static matrix_row_t matrix[MATRIX_ROWS]; | ||
| 30 | static matrix_row_t matrix_debouncing[MATRIX_ROWS]; | ||
| 31 | |||
| 32 | void matrix_init(void) { | ||
| 33 | // all outputs for rows high | ||
| 34 | DDRB = 0xFF; | ||
| 35 | PORTB = 0xFF; | ||
| 36 | // all inputs for columns | ||
| 37 | DDRA = 0x00; | ||
| 38 | DDRC &= ~(0x111111<<2); | ||
| 39 | DDRD &= ~(1<<PIND7); | ||
| 40 | // all columns are pulled-up | ||
| 41 | PORTA = 0xFF; | ||
| 42 | PORTC |= (0b111111<<2); | ||
| 43 | PORTD |= (1<<PIND7); | ||
| 44 | |||
| 45 | // initialize matrix state: all keys off | ||
| 46 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 47 | matrix[row] = 0x00; | ||
| 48 | matrix_debouncing[row] = 0x00; | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | void matrix_set_row_status(uint8_t row) { | ||
| 53 | DDRB = (1 << row); | ||
| 54 | PORTB = ~(1 << row); | ||
| 55 | } | ||
| 56 | |||
| 57 | uint8_t bit_reverse(uint8_t x) { | ||
| 58 | x = ((x >> 1) & 0x55) | ((x << 1) & 0xaa); | ||
| 59 | x = ((x >> 2) & 0x33) | ((x << 2) & 0xcc); | ||
| 60 | x = ((x >> 4) & 0x0f) | ((x << 4) & 0xf0); | ||
| 61 | return x; | ||
| 62 | } | ||
| 63 | |||
| 64 | uint8_t matrix_scan(void) { | ||
| 65 | for (uint8_t row = 0; row < MATRIX_ROWS; row++) { | ||
| 66 | matrix_set_row_status(row); | ||
| 67 | _delay_us(5); | ||
| 68 | |||
| 69 | matrix_row_t cols = ( | ||
| 70 | // cols 0..7, PORTA 0 -> 7 | ||
| 71 | (~PINA) & 0xFF | ||
| 72 | ) | ( | ||
| 73 | // cols 8..13, PORTC 7 -> 0 | ||
| 74 | bit_reverse((~PINC) & 0xFF) << 8 | ||
| 75 | ) | ( | ||
| 76 | // col 14, PORTD 7 | ||
| 77 | ((~PIND) & (1 << PIND7)) << 7 | ||
| 78 | ); | ||
| 79 | |||
| 80 | if (matrix_debouncing[row] != cols) { | ||
| 81 | matrix_debouncing[row] = cols; | ||
| 82 | debouncing = DEBOUNCE; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | if (debouncing) { | ||
| 87 | if (--debouncing) { | ||
| 88 | _delay_ms(1); | ||
| 89 | } else { | ||
| 90 | for (uint8_t i = 0; i < MATRIX_ROWS; i++) { | ||
| 91 | matrix[i] = matrix_debouncing[i]; | ||
| 92 | } | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | matrix_scan_user(); | ||
| 97 | |||
| 98 | return 1; | ||
| 99 | } | ||
| 100 | |||
| 101 | inline matrix_row_t matrix_get_row(uint8_t row) { | ||
| 102 | return matrix[row]; | ||
| 103 | } | ||
| 104 | |||
| 105 | void matrix_print(void) { | ||
| 106 | } | ||
diff --git a/keyboards/pearl/pearl.c b/keyboards/pearl/pearl.c index 3bbadb0a7..c8cd8a860 100644 --- a/keyboards/pearl/pearl.c +++ b/keyboards/pearl/pearl.c | |||
| @@ -15,16 +15,11 @@ You should have received a copy of the GNU General Public License | |||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "pearl.h" | ||
| 19 | #include "rgblight.h" | 18 | #include "rgblight.h" |
| 20 | #include "backlight.h" | 19 | #include "i2c_master.h" |
| 21 | |||
| 22 | #include <avr/pgmspace.h> | ||
| 23 | |||
| 24 | #include "action_layer.h" | ||
| 25 | #include "i2c.h" | ||
| 26 | #include "quantum.h" | 20 | #include "quantum.h" |
| 27 | 21 | ||
| 22 | #ifdef RGBLIGHT_ENABLE | ||
| 28 | extern rgblight_config_t rgblight_config; | 23 | extern rgblight_config_t rgblight_config; |
| 29 | 24 | ||
| 30 | void rgblight_set(void) { | 25 | void rgblight_set(void) { |
| @@ -37,23 +32,59 @@ void rgblight_set(void) { | |||
| 37 | } | 32 | } |
| 38 | 33 | ||
| 39 | i2c_init(); | 34 | i2c_init(); |
| 40 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | 35 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); |
| 41 | } | 36 | } |
| 37 | #endif | ||
| 42 | 38 | ||
| 43 | void backlight_init_ports(void) { | 39 | void matrix_init_kb(void) { |
| 44 | DDRD |= (1<<4); | 40 | #ifdef RGBLIGHT_ENABLE |
| 45 | PORTD &= ~(1<<4); | 41 | if (rgblight_config.enable) { |
| 42 | i2c_init(); | ||
| 43 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); | ||
| 44 | } | ||
| 45 | #endif | ||
| 46 | // call user level keymaps, if any | ||
| 47 | matrix_init_user(); | ||
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | void backlight_set(uint8_t level) { | 50 | void matrix_scan_kb(void) { |
| 49 | if (level > 0) { | 51 | #ifdef RGBLIGHT_ENABLE |
| 50 | PORTD |= (1<<4); | 52 | rgblight_task(); |
| 51 | } else { | 53 | #endif |
| 52 | PORTD &= ~(1<<4); | 54 | matrix_scan_user(); |
| 53 | } | 55 | /* Nothing else for now. */ |
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | __attribute__ ((weak)) | 58 | __attribute__ ((weak)) |
| 57 | void matrix_scan_user(void) { | 59 | void matrix_scan_user(void) { |
| 58 | rgblight_task(); | ||
| 59 | } | 60 | } |
| 61 | |||
| 62 | void backlight_init_ports(void) { | ||
| 63 | // initialize pins D0, D1, D4 and D6 as output | ||
| 64 | setPinOutput(D0); | ||
| 65 | setPinOutput(D1); | ||
| 66 | setPinOutput(D4); | ||
| 67 | setPinOutput(D6); | ||
| 68 | |||
| 69 | // turn backlight LEDs on | ||
| 70 | writePinHigh(D0); | ||
| 71 | writePinHigh(D1); | ||
| 72 | writePinHigh(D4); | ||
| 73 | writePinHigh(D6); | ||
| 74 | } | ||
| 75 | |||
| 76 | void backlight_set(uint8_t level) { | ||
| 77 | if (level == 0) { | ||
| 78 | // turn backlight LEDs off | ||
| 79 | writePinLow(D0); | ||
| 80 | writePinLow(D1); | ||
| 81 | writePinLow(D4); | ||
| 82 | writePinLow(D6); | ||
| 83 | } else { | ||
| 84 | // turn backlight LEDs on | ||
| 85 | writePinHigh(D0); | ||
| 86 | writePinHigh(D1); | ||
| 87 | writePinHigh(D4); | ||
| 88 | writePinHigh(D6); | ||
| 89 | } | ||
| 90 | } \ No newline at end of file | ||
diff --git a/keyboards/pearl/pearl.h b/keyboards/pearl/pearl.h index 6f5fbce5d..72df1595d 100644 --- a/keyboards/pearl/pearl.h +++ b/keyboards/pearl/pearl.h | |||
| @@ -15,8 +15,7 @@ You should have received a copy of the GNU General Public License | |||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifndef PEARL_H | 18 | #pragma once |
| 19 | #define PEARL_H | ||
| 20 | 19 | ||
| 21 | #include "quantum.h" | 20 | #include "quantum.h" |
| 22 | #include "pearl.h" | 21 | #include "pearl.h" |
| @@ -56,6 +55,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 56 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO}, \ | 55 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, KC_NO}, \ |
| 57 | { K30, K31, KC_NO, KC_NO, KC_NO, K35, KC_NO, KC_NO, KC_NO, K39, K3A, KC_NO, KC_NO}, \ | 56 | { K30, K31, KC_NO, KC_NO, KC_NO, K35, KC_NO, KC_NO, KC_NO, K39, K3A, KC_NO, KC_NO}, \ |
| 58 | } | 57 | } |
| 59 | |||
| 60 | |||
| 61 | #endif | ||
diff --git a/keyboards/pearl/readme.md b/keyboards/pearl/readme.md new file mode 100644 index 000000000..c39d86cf3 --- /dev/null +++ b/keyboards/pearl/readme.md | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | # Pearl 40% | ||
| 2 | |||
| 3 | Pearl 40% is a keyboard designed by Koobaczech. It uses an Atmel | ||
| 4 | ATMEGA32A MCU. | ||
| 5 | |||
| 6 | Keyboard Maintainer: [Ethan Madden](https://github.com/jetpacktuxedo) | ||
| 7 | Hardware Supported: Pearl | ||
| 8 | Hardware Availability: [Geekhack Group Buy](https://geekhack.org/index.php?topic=92259.0) | ||
| 9 | |||
| 10 | Make example for this keyboard (after setting up your build environment): | ||
| 11 | |||
| 12 | make pearl:default | ||
| 13 | |||
| 14 | Flashing | ||
| 15 | |||
| 16 | ps2avr(GB) boards use an atmega32a microcontroller and a different bootloader. It is not flashable using the regular QMK methods. | ||
| 17 | |||
| 18 | **Reset Key:** Hold down the key located at `K00`. | ||
| 19 | |||
| 20 | Windows: | ||
| 21 | 1. Download [HIDBootFlash](http://vusb.wikidot.com/project:hidbootflash). | ||
| 22 | 2. Place your keyboard into reset. | ||
| 23 | 3. Press the `Find Device` button and ensure that your keyboard is found. | ||
| 24 | 4. Press the `Open .hex File` button and locate the `.hex` file you created. | ||
| 25 | 5. Press the `Flash Device` button and wait for the process to complete. | ||
| 26 | |||
| 27 | macOS: | ||
| 28 | 1. Install homebrew by typing the following: | ||
| 29 | ``` | ||
| 30 | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | ||
| 31 | ``` | ||
| 32 | 2. Install `crosspack-avr`. | ||
| 33 | ``` | ||
| 34 | brew cask install crosspack-avr | ||
| 35 | ``` | ||
| 36 | 3. Install the following packages: | ||
| 37 | ``` | ||
| 38 | brew install python3 | ||
| 39 | pip3 install pyusb | ||
| 40 | brew install --HEAD https://raw.githubusercontent.com/robertgzr/homebrew-tap/master/bootloadhid.rb | ||
| 41 | ``` | ||
| 42 | 4. Place your keyboard into reset. | ||
| 43 | 5. Flash the board by typing `bootloadHID -r` followed by the path to your `.hex` file. | ||
| 44 | |||
| 45 | **Please Note:** You will need to use the `EEP_RST` keycode first, followed by unplugging/replugging the board to get RGB underglow effects to work. | ||
| 46 | |||
| 47 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
diff --git a/keyboards/pearl/rules.mk b/keyboards/pearl/rules.mk index fac85172e..4db92d121 100644 --- a/keyboards/pearl/rules.mk +++ b/keyboards/pearl/rules.mk | |||
| @@ -31,7 +31,7 @@ F_CPU = 12000000 | |||
| 31 | BOOTLOADER = bootloadHID | 31 | BOOTLOADER = bootloadHID |
| 32 | 32 | ||
| 33 | # build options | 33 | # build options |
| 34 | BOOTMAGIC_ENABLE = full | 34 | BOOTMAGIC_ENABLE = no |
| 35 | MOUSEKEY_ENABLE = no | 35 | MOUSEKEY_ENABLE = no |
| 36 | EXTRAKEY_ENABLE = yes | 36 | EXTRAKEY_ENABLE = yes |
| 37 | CONSOLE_ENABLE = yes | 37 | CONSOLE_ENABLE = yes |
| @@ -43,8 +43,7 @@ RGBLIGHT_CUSTOM_DRIVER = yes | |||
| 43 | OPT_DEFS = -DDEBUG_LEVEL=0 | 43 | OPT_DEFS = -DDEBUG_LEVEL=0 |
| 44 | 44 | ||
| 45 | # custom matrix setup | 45 | # custom matrix setup |
| 46 | CUSTOM_MATRIX = yes | 46 | SRC = i2c_master.c |
| 47 | SRC = matrix.c i2c.c | ||
| 48 | 47 | ||
| 49 | # programming options | 48 | # programming options |
| 50 | PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex | 49 | PROGRAM_CMD = ./util/atmega32a_program.py $(TARGET).hex |
diff --git a/keyboards/pearl/usbconfig.h b/keyboards/pearl/usbconfig.h index d2d848fcd..54a7d20f1 100644 --- a/keyboards/pearl/usbconfig.h +++ b/keyboards/pearl/usbconfig.h | |||
| @@ -8,8 +8,7 @@ | |||
| 8 | * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ | 8 | * This Revision: $Id: usbconfig-prototype.h 785 2010-05-30 17:57:07Z cs $ |
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #ifndef __usbconfig_h_included__ | 11 | #pragma once |
| 12 | #define __usbconfig_h_included__ | ||
| 13 | 12 | ||
| 14 | #include "config.h" | 13 | #include "config.h" |
| 15 | 14 | ||
| @@ -392,5 +391,3 @@ section at the end of this file). | |||
| 392 | /* #define USB_INTR_PENDING EIFR */ | 391 | /* #define USB_INTR_PENDING EIFR */ |
| 393 | #define USB_INTR_PENDING_BIT INTF1 | 392 | #define USB_INTR_PENDING_BIT INTF1 |
| 394 | #define USB_INTR_VECTOR INT1_vect | 393 | #define USB_INTR_VECTOR INT1_vect |
| 395 | |||
| 396 | #endif /* __usbconfig_h_included__ */ | ||
