Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Keyboard] Add nuphy air75 v2 keyboard #22751

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3995b36
[Keyboard] Add nuphy air75 v2 keyboard
nuphy-src Dec 25, 2023
3bcceb8
Merge branch 'master' into nuphy-air75
nuphy-src Dec 25, 2023
f4495d4
Fixed some issues as suggested
nuphy-src Dec 27, 2023
f5f1262
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Dec 27, 2023
8c1c967
Merge branch 'master' into nuphy-air75
nuphy-src Jan 2, 2024
7642708
[Keyboard] Adjusted the code format
nuphy-src Jan 7, 2024
9e0eb67
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Jan 7, 2024
1b27fec
Merge branch 'master' into nuphy-air75
nuphy-src Jan 7, 2024
1eb1205
Fix mac layer erroe.
nuphy-src Jan 7, 2024
dbab794
Solved the problem of not sending codes in RF mode
nuphy-src Jan 8, 2024
570bc9c
Add nuphy license header
nuphy-src Jan 8, 2024
2263f4d
Merge branch 'master' into nuphy-air75
nuphy-src Jan 9, 2024
c56e210
Merge branch 'master' into nuphy-air75
nuphy-src Jan 15, 2024
f0c395b
Fix error in info.json
nuphy-src Jan 16, 2024
47553fe
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Jan 16, 2024
2cabdbd
Use process_record_kb function at ansi.c
nuphy-src Jan 24, 2024
26eaa3f
Merge branch 'master' into nuphy-air75
GateLi Jan 31, 2024
05d4515
Fixed some issues as suggested
nuphy-src Feb 5, 2024
2c03060
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Feb 5, 2024
a3ba423
Merge branch 'master' into nuphy-air75
nuphy-src Feb 16, 2024
322c28f
Merge branch 'master' into nuphy-air75
nuphy-src Feb 18, 2024
98a848a
Merge branch 'master' into nuphy-air75
nuphy-src Feb 20, 2024
3e62c4b
Merge branch 'master' into nuphy-air75
nuphy-src Feb 29, 2024
3c28a2e
Fix some formatting issues.
nuphy-src Mar 18, 2024
7789c42
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Mar 18, 2024
29502d6
Modify readme.md
nuphy-src Mar 20, 2024
2b81cf3
Merge branch 'master' into nuphy-air75
nuphy-src Mar 20, 2024
166eb06
Merge branch 'master' into nuphy-air75
nuphy-src Mar 21, 2024
e327732
Merge branch 'master' into nuphy-air75
nuphy-src Mar 22, 2024
8d4f887
Rename some variables in the code.
nuphy-src Apr 1, 2024
67c0c7f
Merge branch 'nuphy-air75' of https://github.com/nuphy-src/qmk_firmwa…
nuphy-src Apr 1, 2024
889d8c3
Update keyboards/nuphy/air75_v2/ansi/info.json
nuphy-src May 6, 2024
00bc5af
Merge remote-tracking branch 'upstream/master' into nuphy-air75
nuphy-src Jul 2, 2024
a4f5754
update
nuphy-src Jul 2, 2024
ae0f28c
Update keyboards/nuphy/air75_v2/ansi/readme.md
nuphy-src Aug 23, 2024
0f6d5f7
rename info.json to keyboard.json
nuphy-src Aug 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions keyboards/nuphy/air75_v2/ansi/ansi.c
nuphy-src marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
/*
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/>.
*/

#include "kb_util.h"
#include "ansi.h"
#include "usb_main.h"

extern bool f_rf_sw_press;
extern bool f_sleep_show;
extern bool f_dev_reset_press;
extern bool f_bat_num_show;
extern bool f_rgb_test_press;
extern bool f_bat_hold;
extern uint16_t no_act_time;
extern uint8_t rf_sw_temp;
extern uint16_t rf_sw_press_delay;
extern uint16_t rf_linking_time;
extern kb_config_t kb_config;
extern DEV_INFO_STRUCT dev_info;


/* qmk process record */
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if(!process_record_user(keycode, record)){
return false;
}
no_act_time = 0;
rf_linking_time = 0;

switch (keycode) {
case RF_DFU:
if (record->event.pressed) {
if (dev_info.link_mode != LINK_USB) return false;
uart_send_cmd(CMD_RF_DFU, 10, 20);
}
return false;

case LNK_USB:
if (record->event.pressed) {
break_all_key();
} else {
dev_info.link_mode = LINK_USB;
uart_send_cmd(CMD_SET_LINK, 10, 10);
}
return false;

case LNK_RF:
if (record->event.pressed) {
if (dev_info.link_mode != LINK_USB) {
rf_sw_temp = LINK_RF_24;
f_rf_sw_press = 1;
break_all_key();
}
} else if (f_rf_sw_press) {
f_rf_sw_press = 0;

if (rf_sw_press_delay < RF_LONG_PRESS_DELAY) {
dev_info.link_mode = rf_sw_temp;
dev_info.rf_channel = rf_sw_temp;
dev_info.ble_channel = rf_sw_temp;
uart_send_cmd(CMD_SET_LINK, 10, 20);
}
}
return false;

case LNK_BLE1:
if (record->event.pressed) {
if (dev_info.link_mode != LINK_USB) {
rf_sw_temp = LINK_BT_1;
f_rf_sw_press = 1;
break_all_key();
}
} else if (f_rf_sw_press) {
f_rf_sw_press = 0;

if (rf_sw_press_delay < RF_LONG_PRESS_DELAY) {
dev_info.link_mode = rf_sw_temp;
dev_info.rf_channel = rf_sw_temp;
dev_info.ble_channel = rf_sw_temp;
uart_send_cmd(CMD_SET_LINK, 10, 20);
}
}
return false;

case LNK_BLE2:
if (record->event.pressed) {
if (dev_info.link_mode != LINK_USB) {
rf_sw_temp = LINK_BT_2;
f_rf_sw_press = 1;
break_all_key();
}
} else if (f_rf_sw_press) {
f_rf_sw_press = 0;

if (rf_sw_press_delay < RF_LONG_PRESS_DELAY) {
dev_info.link_mode = rf_sw_temp;
dev_info.rf_channel = rf_sw_temp;
dev_info.ble_channel = rf_sw_temp;
uart_send_cmd(CMD_SET_LINK, 10, 20);
}
}
return false;

case LNK_BLE3:
if (record->event.pressed) {
if (dev_info.link_mode != LINK_USB) {
rf_sw_temp = LINK_BT_3;
f_rf_sw_press = 1;
break_all_key();
}
} else if (f_rf_sw_press) {
f_rf_sw_press = 0;

if (rf_sw_press_delay < RF_LONG_PRESS_DELAY) {
dev_info.link_mode = rf_sw_temp;
dev_info.rf_channel = rf_sw_temp;
dev_info.ble_channel = rf_sw_temp;
uart_send_cmd(CMD_SET_LINK, 10, 20);
}
}
return false;

case MAC_VOICE:
if (record->event.pressed) {
host_consumer_send(0xcf);
} else {
host_consumer_send(0);
}
return false;

case MAC_DND:
if (record->event.pressed) {
host_system_send(0x9b);
} else {
host_system_send(0);
}
return false;

case SIDE_VAI:
if (record->event.pressed) {
side_light_control(1);
}
return false;

case SIDE_VAD:
if (record->event.pressed) {
side_light_control(0);
}
return false;

case SIDE_MOD:
if (record->event.pressed) {
side_mode_control(1);
}
return false;

case SIDE_HUI:
if (record->event.pressed) {
side_colour_control(1);
}
return false;

case SIDE_SPI:
if (record->event.pressed) {
side_speed_control(1);
}
return false;

case SIDE_SPD:
if (record->event.pressed) {
side_speed_control(0);
}
return false;

case DEV_RESET:
if (record->event.pressed) {
f_dev_reset_press = 1;
break_all_key();
} else {
f_dev_reset_press = 0;
}
return false;

case SLEEP_MODE:
if (record->event.pressed) {
if(kb_config.sleep_enable) kb_config.sleep_enable = false;
else kb_config.sleep_enable = true;
f_sleep_show = 1;
eeconfig_update_kb_datablock(&kb_config);
}
return false;

case BAT_SHOW:
if (record->event.pressed) {
f_bat_hold = !f_bat_hold;
}
return false;

case BAT_NUM:
f_bat_num_show = record->event.pressed;
return false;

case RGB_TEST:
f_rgb_test_press = record->event.pressed;
return false;

default:
return true;
}
return true;
}


bool rgb_matrix_indicators_kb(void)
{
if(!rgb_matrix_indicators_user()){
return false;
}
if(f_bat_num_show) {
num_led_show();
}

// fix power-on brightness is abnormal
rgb_matrix_set_color(RGB_MATRIX_LED_COUNT-1, 0, 0, 0);
return true;
}

/* qmk keyboard post init */
void keyboard_post_init_kb(void) {

gpio_init();
rf_uart_init();
wait_ms(500);
rf_device_init();

break_all_key();
dial_sw_fast_scan();
londing_eeprom_data();
keyboard_post_init_user();
}

/* qmk housekeeping task */
void housekeeping_task_kb(void) {

timer_pro();

uart_receive_pro();

uart_send_report_repeat();

dev_sts_sync();

long_press_key();

dial_sw_scan();

side_led_show();

sleep_handle();
}
50 changes: 50 additions & 0 deletions keyboards/nuphy/air75_v2/ansi/ansi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
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_VOICE,
MAC_DND,

SIDE_VAI,
SIDE_VAD,
SIDE_MOD,
SIDE_HUI,
SIDE_SPI,
SIDE_SPD,

DEV_RESET,
SLEEP_MODE,
BAT_SHOW,
BAT_NUM,
RGB_TEST
};

#define SYS_PRT G(S(KC_3))
#define MAC_PRTA G(S(KC_4))
#define WIN_PRTA G(S(KC_S))
#define MAC_SEARCH G(KC_SPC)
36 changes: 36 additions & 0 deletions keyboards/nuphy/air75_v2/ansi/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
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 DEV_MODE_PIN C0
#define SYS_MODE_PIN C1
#define DC_BOOST_PIN C2
#define NRF_RESET_PIN B4
#define NRF_TEST_PIN B5
#define NRF_WAKEUP_PIN B8
#define DRIVER_LED_CS_PIN C6
#define DRIVER_SIDE_PIN C8
#define DRIVER_SIDE_CS_PIN C9

#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

#define EECONFIG_KB_DATA_SIZE 8
23 changes: 23 additions & 0 deletions keyboards/nuphy/air75_v2/ansi/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
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
Loading