forked from qmk/qmk_firmware
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Keyboard] Add Nuphy Air60 v2 keyboard
- Loading branch information
Showing
15 changed files
with
3,701 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
/* | ||
Copyright 2023 @ Nuphy <https://nuphy.com/> | ||
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/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "quantum.h" | ||
|
||
enum custom_keycodes { | ||
RF_DFU = QK_KB_0, | ||
LNK_USB, | ||
LNK_RF, | ||
LNK_BLE1, | ||
LNK_BLE2, | ||
LNK_BLE3, | ||
|
||
MAC_TASK, | ||
MAC_SEARCH, | ||
MAC_VOICE, | ||
MAC_CONSOLE, | ||
MAC_DND, | ||
MAC_PRT, | ||
MAC_PRTA, | ||
|
||
SIDE_VAI, | ||
SIDE_VAD, | ||
SIDE_MOD, | ||
SIDE_HUI, | ||
SIDE_SPI, | ||
SIDE_SPD, | ||
|
||
DEV_RESET, | ||
SLEEP_MODE, | ||
BAT_SHOW, | ||
RGB_TEST, | ||
SHIFT_GRV, | ||
BAT_NUM | ||
}; | ||
|
||
|
||
typedef enum { | ||
RX_Idle, | ||
RX_Receiving, | ||
RX_Done, | ||
RX_Fail, | ||
RX_OV_ERR, | ||
RX_SUM_ERR, | ||
RX_CMD_ERR, | ||
RX_DATA_ERR, | ||
RX_DATA_OV, | ||
RX_FORMAT_ERR, | ||
|
||
TX_OK = 0XE0, | ||
TX_DONE, | ||
TX_BUSY, | ||
TX_TIMEOUT, | ||
TX_DATA_ERR, | ||
|
||
} TYPE_RX_STATE; | ||
|
||
|
||
#define RF_LONG_PRESS_DELAY 30 | ||
#define DEV_RESET_PRESS_DELAY 30 | ||
#define RGB_TEST_PRESS_DELAY 30 | ||
|
||
|
||
#define UART_HEAD 0x5A | ||
#define FUNC_VALID_LEN 32 | ||
|
||
#define RF_IDLE 0 | ||
#define RF_PAIRING 1 | ||
#define RF_LINKING 2 | ||
#define RF_CONNECT 3 | ||
#define RF_DISCONNECT 4 | ||
#define RF_SLEEP 5 | ||
#define RF_SNIF 6 | ||
#define RF_INVAILD 0XFE | ||
#define RF_ERR_STATE 0XFF | ||
|
||
#define CMD_POWER_UP 0XF0 | ||
#define CMD_SLEEP 0XF1 | ||
#define CMD_HAND 0XF2 | ||
#define CMD_SNIF 0XF3 | ||
#define CMD_24G_SUSPEND 0XF4 | ||
#define CMD_IDLE_EXIT 0XFE | ||
|
||
#define CMD_RPT_MS 0XE0 | ||
#define CMD_RPT_BYTE_KB 0XE1 | ||
#define CMD_RPT_BIT_KB 0XE2 | ||
#define CMD_RPT_CONSUME 0XE3 | ||
#define CMD_RPT_SYS 0XE4 | ||
|
||
#define CMD_SET_LINK 0XC0 | ||
#define CMD_SET_CONFIG 0XC1 | ||
#define CMD_GET_CONFIG 0XC2 | ||
#define CMD_SET_NAME 0XC3 | ||
#define CMD_GET_NAME 0XC4 | ||
#define CMD_CLR_DEVICE 0XC5 | ||
#define CMD_NEW_ADV 0XC7 | ||
#define CMD_RF_STS_SYSC 0XC9 | ||
#define CMD_SET_24G_NAME 0XCA | ||
#define CMD_GO_TEST 0XCF | ||
|
||
#define CMD_RF_DFU 0XB1 | ||
|
||
#define CMD_WRITE_DATA 0X80 | ||
#define CMD_READ_DATA 0X81 | ||
|
||
|
||
#define LINK_RF_24 0 | ||
#define LINK_BT_1 1 | ||
#define LINK_BT_2 2 | ||
#define LINK_BT_3 3 | ||
#define LINK_USB 4 | ||
|
||
#define UART_MAX_LEN 64 | ||
typedef struct | ||
{ | ||
uint8_t RXDState; | ||
uint8_t RXDLen; | ||
uint8_t RXDOverTime; | ||
uint8_t TXDLenBack; | ||
uint8_t TXDOffset; | ||
uint8_t TXDBuf[UART_MAX_LEN]; | ||
uint8_t RXDBuf[UART_MAX_LEN]; | ||
} USART_MGR_STRUCT; | ||
|
||
typedef struct | ||
{ | ||
uint8_t link_mode; | ||
uint8_t rf_channel; | ||
uint8_t ble_channel; | ||
uint8_t rf_state; | ||
uint8_t rf_charge; | ||
uint8_t rf_led; | ||
uint8_t rf_baterry; | ||
uint8_t sys_sw_state; | ||
} DEV_INFO_STRUCT; | ||
|
||
|
||
#define SYS_SW_WIN 0xa1 | ||
#define SYS_SW_MAC 0xa2 | ||
|
||
#define RF_LINK_SHOW_TIME 300 | ||
|
||
#define HOST_USB_TYPE 0 | ||
#define HOST_BLE_TYPE 1 | ||
#define HOST_RF_TYPE 2 | ||
|
||
#define LINK_TIMEOUT (uint16_t)(100 * 120) | ||
#define SLEEP_TIME_DELAY (uint16_t)(100 * 360) | ||
#define POWER_DOWN_DELAY (uint16_t)(24) | ||
|
||
typedef struct | ||
{ | ||
uint8_t default_brightness_flag; | ||
uint8_t ee_side_mode; | ||
uint8_t ee_side_light; | ||
uint8_t ee_side_speed; | ||
uint8_t ee_side_rgb; | ||
uint8_t ee_side_colour; | ||
uint8_t sleep_enable; | ||
uint8_t retain2; | ||
} user_config_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
Copyright 2023 @ Nuphy <https://nuphy.com/> | ||
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/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#define TAP_CODE_DELAY 8 | ||
#define DYNAMIC_KEYMAP_MACRO_DELAY 8 | ||
#define EECONFIG_USER_DATA_SIZE 8 | ||
|
||
#define DEV_MODE_PIN C0 | ||
#define SYS_MODE_PIN C1 | ||
#define DC_BOOST_PIN C2 | ||
#define NRF_RESET_PIN B4 | ||
#define NRF_BOOT_PIN B5 | ||
#define NRF_WAKEUP_PIN C4 | ||
|
||
#define RGB_DRIVER_SDB1 C6 | ||
#define RGB_DRIVER_SDB2 C7 | ||
|
||
#define SERIAL_DRIVER SD1 | ||
#define SD1_TX_PIN B6 | ||
#define SD1_TX_PAL_MODE 0 | ||
#define SD1_RX_PIN B7 | ||
#define SD1_RX_PAL_MODE 0 | ||
|
||
|
||
// This is a 7-bit address, that gets left-shifted and bit 0 | ||
// set to 0 for write, 1 for read (as per I2C protocol) | ||
// The address will vary depending on your wiring: | ||
// 0b1110100 AD <-> GND | ||
// 0b1110111 AD <-> VCC | ||
// 0b1110101 AD <-> SCL | ||
// 0b1110110 AD <-> SDA | ||
#define DRIVER_ADDR_1 0b1010000 | ||
#define DRIVER_ADDR_2 0b1010011 | ||
#define ISSI_TIMEOUT 1 | ||
|
||
#define I2C_DRIVER I2CD1 | ||
#define I2C1_SCL_PIN B8 | ||
#define I2C1_SDA_PIN B9 | ||
#define I2C1_CLOCK_SPEED 1000000 | ||
|
||
#define I2C1_SCL_PAL_MODE 1 | ||
#define I2C1_SDA_PAL_MODE 1 | ||
|
||
#define I2C1_TIMINGR_PRESC 0U | ||
#define I2C1_TIMINGR_SCLDEL 0U | ||
#define I2C1_TIMINGR_SDADEL 0U | ||
#define I2C1_TIMINGR_SCLH 0U | ||
#define I2C1_TIMINGR_SCLL 0U | ||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9 | ||
|
||
|
||
#define DRIVER_COUNT 2 | ||
#define DRIVER_1_LED_TOTAL 48 | ||
#define DRIVER_2_LED_TOTAL (16 + 10) | ||
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL) | ||
|
||
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT // Sets the default mode, if none has been set | ||
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended | ||
|
||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS | ||
#define RGB_MATRIX_KEYPRESSES | ||
#define RGB_MATRIX_KEYRELEASES | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
Copyright 2023 @ Nuphy <https://nuphy.com/> | ||
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/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include_next <halconf.h> | ||
|
||
#undef HAL_USE_SERIAL | ||
#define HAL_USE_SERIAL TRUE | ||
|
||
#undef HAL_USE_I2C | ||
#define HAL_USE_I2C TRUE | ||
|
||
|
Oops, something went wrong.