1
0
Fork 0

[Keyboard] Update Infinity87 rev. 2 (#14820)

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
mechlovin 2021-11-05 05:08:40 +07:00 committed by GitHub
parent c8da63382c
commit 45b35e6ea1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 192 additions and 255 deletions

View file

@ -18,7 +18,7 @@
#define PRODUCT_ID 0x8702 #define PRODUCT_ID 0x8702
#define DEVICE_VER 0x0001 #define DEVICE_VER 0x0001
#define PRODUCT Infinity 87 rev2 #define PRODUCT Infinity87 rev.2
/* /*
* Keyboard Matrix Assignments * Keyboard Matrix Assignments
@ -30,19 +30,49 @@
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
* *
*/ */
#define MATRIX_ROW_PINS { A3, D5, C3, C2, B3, B4 } #define MATRIX_ROW_PINS { D5, D2, D4, D3, D0, D1 }
#define UNUSED_PINS #define UNUSED_PINS
/* COL2ROW, ROW2COL*/ /* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION ROW2COL #define DIODE_DIRECTION ROW2COL
#define BACKLIGHT_PIN D4 #define USB_POLLING_INTERVAL_MS 1
#define LED_NUM_LOCK_PIN D7
#define LED_CAPS_LOCK_PIN D6
#define LED_SCROLL_LOCK_PIN B4
#define LED_PIN_ON_STATE 1
#define BACKLIGHT_PIN B6
#define BACKLIGHT_LEVELS 3
#define BACKLIGHT_BREATHING #define BACKLIGHT_BREATHING
#define LED_NUM_LOCK_PIN B1 #ifdef RGBLIGHT_ENABLE
#define LED_CAPS_LOCK_PIN B0 #define RGB_DI_PIN E2
#define LED_SCROLL_LOCK_PIN B2 #define RGBLED_NUM 24
#define LED_PIN_ON_STATE 0 #define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
#define RGBLIGHT_EFFECT_BREATHING
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#define RGBLIGHT_EFFECT_SNAKE
#define RGBLIGHT_EFFECT_KNIGHT
#define RGBLIGHT_EFFECT_CHRISTMAS
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
#define RGBLIGHT_EFFECT_RGB_TEST
#define RGBLIGHT_EFFECT_ALTERNATING
#define RGBLIGHT_EFFECT_TWINKLE
/*== customize breathing effect ==*/
/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
/*==== use exp() and sin() ====*/
//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
#endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5 #define DEBOUNCE 5

View file

@ -1,7 +1,7 @@
{ {
"keyboard_name": "infinity87", "keyboard_name": "infinity87 Rev.2",
"url": "", "url": "",
"maintainer": "Team Mechlovin'", "maintainer": "Mechlovin' Studio",
"layouts": { "layouts": {
"LAYOUT_all": { "LAYOUT_all": {
"layout": [ "layout": [

View file

@ -60,61 +60,12 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
return (last_row_value != current_matrix[current_row]); return (last_row_value != current_matrix[current_row]);
} }
#elif (DIODE_DIRECTION == COL2ROW)
static void select_row(uint8_t row) {
setPinOutput(row_pins[row]);
writePinLow(row_pins[row]);
}
static void unselect_row(uint8_t row) { setPinInputHigh(row_pins[row]); }
static void unselect_rows(void) {
for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]);
}
}
static void init_pins(void) {
unselect_rows();
for (uint8_t x = 0; x < MATRIX_COLS; x++) {
setPinInputHigh(col_pins[x]);
}
}
static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
// Store last value of row prior to reading
matrix_row_t last_row_value = current_matrix[current_row];
// Clear data in matrix row
current_matrix[current_row] = 0;
// Select row and wait for row selecton to stabilize
select_row(current_row);
wait_us(30);
// For each col...
for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
// Select the col pin to read (active low)
uint8_t pin_state = readPin(col_pins[col_index]);
// Populate the matrix row with the state of the col pin
current_matrix[current_row] |= pin_state ? 0 : (MATRIX_ROW_SHIFTER << col_index);
}
// Unselect row
unselect_row(current_row);
return (last_row_value != current_matrix[current_row]);
}
#elif (DIODE_DIRECTION == ROW2COL) #elif (DIODE_DIRECTION == ROW2COL)
/* Cols 0 - 16 /* Cols 0 - 16
* These columns use two 74HC138 3 to 8 bit demultiplexer. D6, D7 is the enable pin, must be set high (1) to use it. * These columns use two 74HC138 3 to 8 bit demultiplexer. B0, F1 is the enable pin, must be set high (1) to use it.
* *
* col / pin: PA0 PA1 PA2 PD6 PD7 PC4 * col / pin: PB5 PB7 PF0 PB0 PF1 PE6
* 0: 0 0 0 1 0 0 * 0: 0 0 0 1 0 0
* *
* 1: 0 0 1 1 0 0 * 1: 0 0 1 1 0 0
@ -153,103 +104,103 @@ static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row)
static void select_col(uint8_t col) { static void select_col(uint8_t col) {
switch (col) { switch (col) {
case 0: case 0:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 1: case 1:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 2: case 2:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 3: case 3:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 4: case 4:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 5: case 5:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 6: case 6:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 7: case 7:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D6); writePinHigh(B0);
break; break;
case 8: case 8:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 9: case 9:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 10: case 10:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 11: case 11:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 12: case 12:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 13: case 13:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 14: case 14:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 15: case 15:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinHigh(D7); writePinHigh(F1);
break; break;
case 16: case 16:
writePinLow(C4); writePinLow(E6);
break; break;
} }
} }
@ -257,117 +208,117 @@ static void select_col(uint8_t col) {
static void unselect_col(uint8_t col) { static void unselect_col(uint8_t col) {
switch (col) { switch (col) {
case 0: case 0:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 1: case 1:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 2: case 2:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 3: case 3:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 4: case 4:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 5: case 5:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 6: case 6:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 7: case 7:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D6); writePinLow(B0);
break; break;
case 8: case 8:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 9: case 9:
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 10: case 10:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 11: case 11:
writePinHigh(A0); writePinHigh(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 12: case 12:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 13: case 13:
writePinLow(A0); writePinLow(B5);
writePinHigh(A1); writePinHigh(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 14: case 14:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinLow(A2); writePinLow(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 15: case 15:
writePinLow(A0); writePinLow(B5);
writePinLow(A1); writePinLow(B7);
writePinHigh(A2); writePinHigh(F0);
writePinLow(D7); writePinLow(F1);
break; break;
case 16: case 16:
writePinHigh(C4); writePinHigh(E6);
break; break;
} }
} }
static void unselect_cols(void) { static void unselect_cols(void) {
//Native //Native
writePinHigh(C4); writePinHigh(E6);
//Demultiplexer //Demultiplexer
writePinLow(D6); writePinLow(B0);
writePinLow(D7); writePinLow(F1);
writePinHigh(A0); writePinHigh(B5);
writePinHigh(A1); writePinHigh(B7);
writePinHigh(A2); writePinHigh(F0);
} }
static void init_pins(void) { static void init_pins(void) {
@ -375,12 +326,12 @@ static void init_pins(void) {
for (uint8_t x = 0; x < MATRIX_ROWS; x++) { for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
setPinInputHigh(row_pins[x]); setPinInputHigh(row_pins[x]);
} }
setPinOutput(A0); setPinOutput(B5);
setPinOutput(A1); setPinOutput(B7);
setPinOutput(A2); setPinOutput(F0);
setPinOutput(D6); setPinOutput(B0);
setPinOutput(D7); setPinOutput(F1);
setPinOutput(C4); setPinOutput(E6);
} }
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
@ -426,12 +377,7 @@ void matrix_init_custom(void) {
bool matrix_scan_custom(matrix_row_t current_matrix[]) { bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool changed = false; bool changed = false;
#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) #if defined(DIRECT_PINS) || (DIODE_DIRECTION == ROW2COL)
// Set row, read cols
for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
changed |= read_cols_on_row(current_matrix, current_row);
}
#elif (DIODE_DIRECTION == ROW2COL)
// Set col, read rows // Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
changed |= read_rows_on_col(current_matrix, current_col); changed |= read_rows_on_col(current_matrix, current_col);

View file

@ -2,8 +2,7 @@
![infinity87](https://i.imgur.com/pgtvUTrl.png) ![infinity87](https://i.imgur.com/pgtvUTrl.png)
A replacement PCB for TKL keyboard. south-facing stabilisers, .STEP file in our github A PCB for TKL keyboards.
* Keyboard Maintainer: [Team Mechlovin'](https://github.com/mechlovin) * Keyboard Maintainer: [Team Mechlovin'](https://github.com/mechlovin)
* Hardware Supported: Infinity87 rev.2, AVR. * Hardware Supported: Infinity87 rev.2, AVR.
* Hardware Availability: [Mechlovin.studio](https://mechlovin.studio) * Hardware Availability: [Mechlovin.studio](https://mechlovin.studio)
@ -20,4 +19,3 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to
**Reset Key:** To put the IF87_rev2 into bootloader, push reset swith on the bottom of the PCB. **Reset Key:** To put the IF87_rev2 into bootloader, push reset swith on the bottom of the PCB.
IF87_rev2 used USBasploader from [Erovia tutorial](https://erovia.github.io/posts/thk/#bootloader), thank you [Erovia](https://github.com/Erovia).

View file

@ -15,39 +15,3 @@
*/ */
#include "rev2.h" #include "rev2.h"
void led_init_ports(void) {
setPinOutput(A5);
setPinOutput(A6);
setPinOutput(A7);
setPinOutput(C7);
setPinOutput(C6);
}
layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
writePinHigh(C6);
writePinHigh(C7);
writePinHigh(A7);
writePinHigh(A6);
writePinHigh(A5);
switch (get_highest_layer(state)) {
case 0:
writePinLow(C6);
break;
case 1:
writePinLow(C7);
break;
case 2:
writePinLow(A7);
break;
case 3:
writePinLow(A6);
break;
case 4:
writePinLow(A5);
break;
}
return state;
}

View file

@ -1,19 +1,18 @@
# MCU name # MCU name
MCU = atmega32a MCU = atmega32u4
# Processor frequency
F_CPU = 16000000
# Bootloader selection # Bootloader selection
BOOTLOADER = usbasploader BOOTLOADER = atmel-dfu
# Build Options # Build Options
# change yes to no to disable # change yes to no to disable
# #
CONSOLE_ENABLE = no CONSOLE_ENABLE = no
COMMAND_ENABLE = no COMMAND_ENABLE = no
NKRO_ENABLE = no NKRO_ENABLE = yes
BACKLIGHT_ENABLE = yes BACKLIGHT_ENABLE = yes
RGBLIGHT_ENABLE = yes
CUSTOM_MATRIX = lite CUSTOM_MATRIX = lite
SRC += matrix.c SRC += matrix.c