Skip to content

Commit f63faa9

Browse files
committed
[Keyboard] Add Nuphy Air60 v2 keyboard
1 parent 635203a commit f63faa9

15 files changed

Lines changed: 3701 additions & 0 deletions

File tree

keyboards/nuphy/air60_v2/ansi/ansi.c

Lines changed: 767 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/*
2+
Copyright 2023 @ Nuphy <https://nuphy.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+
#pragma once
19+
20+
#include "quantum.h"
21+
22+
enum custom_keycodes {
23+
RF_DFU = QK_KB_0,
24+
LNK_USB,
25+
LNK_RF,
26+
LNK_BLE1,
27+
LNK_BLE2,
28+
LNK_BLE3,
29+
30+
MAC_TASK,
31+
MAC_SEARCH,
32+
MAC_VOICE,
33+
MAC_CONSOLE,
34+
MAC_DND,
35+
MAC_PRT,
36+
MAC_PRTA,
37+
38+
SIDE_VAI,
39+
SIDE_VAD,
40+
SIDE_MOD,
41+
SIDE_HUI,
42+
SIDE_SPI,
43+
SIDE_SPD,
44+
45+
DEV_RESET,
46+
SLEEP_MODE,
47+
BAT_SHOW,
48+
RGB_TEST,
49+
SHIFT_GRV,
50+
BAT_NUM
51+
};
52+
53+
54+
typedef enum {
55+
RX_Idle,
56+
RX_Receiving,
57+
RX_Done,
58+
RX_Fail,
59+
RX_OV_ERR,
60+
RX_SUM_ERR,
61+
RX_CMD_ERR,
62+
RX_DATA_ERR,
63+
RX_DATA_OV,
64+
RX_FORMAT_ERR,
65+
66+
TX_OK = 0XE0,
67+
TX_DONE,
68+
TX_BUSY,
69+
TX_TIMEOUT,
70+
TX_DATA_ERR,
71+
72+
} TYPE_RX_STATE;
73+
74+
75+
#define RF_LONG_PRESS_DELAY 30
76+
#define DEV_RESET_PRESS_DELAY 30
77+
#define RGB_TEST_PRESS_DELAY 30
78+
79+
80+
#define UART_HEAD 0x5A
81+
#define FUNC_VALID_LEN 32
82+
83+
#define RF_IDLE 0
84+
#define RF_PAIRING 1
85+
#define RF_LINKING 2
86+
#define RF_CONNECT 3
87+
#define RF_DISCONNECT 4
88+
#define RF_SLEEP 5
89+
#define RF_SNIF 6
90+
#define RF_INVAILD 0XFE
91+
#define RF_ERR_STATE 0XFF
92+
93+
#define CMD_POWER_UP 0XF0
94+
#define CMD_SLEEP 0XF1
95+
#define CMD_HAND 0XF2
96+
#define CMD_SNIF 0XF3
97+
#define CMD_24G_SUSPEND 0XF4
98+
#define CMD_IDLE_EXIT 0XFE
99+
100+
#define CMD_RPT_MS 0XE0
101+
#define CMD_RPT_BYTE_KB 0XE1
102+
#define CMD_RPT_BIT_KB 0XE2
103+
#define CMD_RPT_CONSUME 0XE3
104+
#define CMD_RPT_SYS 0XE4
105+
106+
#define CMD_SET_LINK 0XC0
107+
#define CMD_SET_CONFIG 0XC1
108+
#define CMD_GET_CONFIG 0XC2
109+
#define CMD_SET_NAME 0XC3
110+
#define CMD_GET_NAME 0XC4
111+
#define CMD_CLR_DEVICE 0XC5
112+
#define CMD_NEW_ADV 0XC7
113+
#define CMD_RF_STS_SYSC 0XC9
114+
#define CMD_SET_24G_NAME 0XCA
115+
#define CMD_GO_TEST 0XCF
116+
117+
#define CMD_RF_DFU 0XB1
118+
119+
#define CMD_WRITE_DATA 0X80
120+
#define CMD_READ_DATA 0X81
121+
122+
123+
#define LINK_RF_24 0
124+
#define LINK_BT_1 1
125+
#define LINK_BT_2 2
126+
#define LINK_BT_3 3
127+
#define LINK_USB 4
128+
129+
#define UART_MAX_LEN 64
130+
typedef struct
131+
{
132+
uint8_t RXDState;
133+
uint8_t RXDLen;
134+
uint8_t RXDOverTime;
135+
uint8_t TXDLenBack;
136+
uint8_t TXDOffset;
137+
uint8_t TXDBuf[UART_MAX_LEN];
138+
uint8_t RXDBuf[UART_MAX_LEN];
139+
} USART_MGR_STRUCT;
140+
141+
typedef struct
142+
{
143+
uint8_t link_mode;
144+
uint8_t rf_channel;
145+
uint8_t ble_channel;
146+
uint8_t rf_state;
147+
uint8_t rf_charge;
148+
uint8_t rf_led;
149+
uint8_t rf_baterry;
150+
uint8_t sys_sw_state;
151+
} DEV_INFO_STRUCT;
152+
153+
154+
#define SYS_SW_WIN 0xa1
155+
#define SYS_SW_MAC 0xa2
156+
157+
#define RF_LINK_SHOW_TIME 300
158+
159+
#define HOST_USB_TYPE 0
160+
#define HOST_BLE_TYPE 1
161+
#define HOST_RF_TYPE 2
162+
163+
#define LINK_TIMEOUT (uint16_t)(100 * 120)
164+
#define SLEEP_TIME_DELAY (uint16_t)(100 * 360)
165+
#define POWER_DOWN_DELAY (uint16_t)(24)
166+
167+
typedef struct
168+
{
169+
uint8_t default_brightness_flag;
170+
uint8_t ee_side_mode;
171+
uint8_t ee_side_light;
172+
uint8_t ee_side_speed;
173+
uint8_t ee_side_rgb;
174+
uint8_t ee_side_colour;
175+
uint8_t sleep_enable;
176+
uint8_t retain2;
177+
} user_config_t;
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
Copyright 2023 @ Nuphy <https://nuphy.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+
#pragma once
19+
20+
#define TAP_CODE_DELAY 8
21+
#define DYNAMIC_KEYMAP_MACRO_DELAY 8
22+
#define EECONFIG_USER_DATA_SIZE 8
23+
24+
#define DEV_MODE_PIN C0
25+
#define SYS_MODE_PIN C1
26+
#define DC_BOOST_PIN C2
27+
#define NRF_RESET_PIN B4
28+
#define NRF_BOOT_PIN B5
29+
#define NRF_WAKEUP_PIN C4
30+
31+
#define RGB_DRIVER_SDB1 C6
32+
#define RGB_DRIVER_SDB2 C7
33+
34+
#define SERIAL_DRIVER SD1
35+
#define SD1_TX_PIN B6
36+
#define SD1_TX_PAL_MODE 0
37+
#define SD1_RX_PIN B7
38+
#define SD1_RX_PAL_MODE 0
39+
40+
41+
// This is a 7-bit address, that gets left-shifted and bit 0
42+
// set to 0 for write, 1 for read (as per I2C protocol)
43+
// The address will vary depending on your wiring:
44+
// 0b1110100 AD <-> GND
45+
// 0b1110111 AD <-> VCC
46+
// 0b1110101 AD <-> SCL
47+
// 0b1110110 AD <-> SDA
48+
#define DRIVER_ADDR_1 0b1010000
49+
#define DRIVER_ADDR_2 0b1010011
50+
#define ISSI_TIMEOUT 1
51+
52+
#define I2C_DRIVER I2CD1
53+
#define I2C1_SCL_PIN B8
54+
#define I2C1_SDA_PIN B9
55+
#define I2C1_CLOCK_SPEED 1000000
56+
57+
#define I2C1_SCL_PAL_MODE 1
58+
#define I2C1_SDA_PAL_MODE 1
59+
60+
#define I2C1_TIMINGR_PRESC 0U
61+
#define I2C1_TIMINGR_SCLDEL 0U
62+
#define I2C1_TIMINGR_SDADEL 0U
63+
#define I2C1_TIMINGR_SCLH 0U
64+
#define I2C1_TIMINGR_SCLL 0U
65+
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9
66+
67+
68+
#define DRIVER_COUNT 2
69+
#define DRIVER_1_LED_TOTAL 48
70+
#define DRIVER_2_LED_TOTAL (16 + 10)
71+
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
72+
73+
#define RGB_MATRIX_DEFAULT_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT // Sets the default mode, if none has been set
74+
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
75+
76+
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
77+
#define RGB_MATRIX_KEYPRESSES
78+
#define RGB_MATRIX_KEYRELEASES
79+
80+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Copyright 2023 @ Nuphy <https://nuphy.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+
#pragma once
19+
20+
#include_next <halconf.h>
21+
22+
#undef HAL_USE_SERIAL
23+
#define HAL_USE_SERIAL TRUE
24+
25+
#undef HAL_USE_I2C
26+
#define HAL_USE_I2C TRUE
27+
28+

0 commit comments

Comments
 (0)