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 1 commit
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
Prev Previous commit
Next Next commit
update
update

update

update

reset submodule
  • Loading branch information
nuphy-src committed Jul 3, 2024
commit a4f5754d1f1f6ed66b40a59e36fd6e8753f57951
12 changes: 5 additions & 7 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
Expand Up @@ -15,7 +15,7 @@ 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 "user_kb.h"
#include "kb_util.h"
#include "ansi.h"
#include "usb_main.h"

Expand Down Expand Up @@ -152,13 +152,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

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

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

Expand All @@ -176,13 +176,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {

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

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

Expand Down Expand Up @@ -271,6 +271,4 @@ void housekeeping_task_kb(void) {
side_led_show();

sleep_handle();

housekeeping_task_user();
}
52 changes: 26 additions & 26 deletions keyboards/nuphy/air75_v2/ansi/info.json
nuphy-src marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manufacturer": "NuPhy",
"usb":{
"vid": "0x19F5",
drashna marked this conversation as resolved.
Show resolved Hide resolved
"pid": "0x3245",
"pid": "0x3246",
"device_version": "0.0.1",
"no_startup_check": true
},
Expand Down Expand Up @@ -131,32 +131,32 @@
{"matrix": [2, 16], "x": 150, "y": 20, "flags": 4},

{"matrix": [1, 15], "x": 150, "y": 30, "flags": 4},
{"matrix": [3, 13], "x": 127.5, "y": 30, "flags": 4},
{"matrix": [3, 11], "x": 117.5, "y": 30, "flags": 4},
{"matrix": [3, 10], "x": 107.5, "y": 30, "flags": 4},
{"matrix": [3, 9], "x": 97.5, "y": 30, "flags": 4},
{"matrix": [3, 8], "x": 87.5, "y": 30, "flags": 4},
{"matrix": [3, 7], "x": 77.5, "y": 30, "flags": 4},
{"matrix": [3, 6], "x": 67.5, "y": 30, "flags": 4},
{"matrix": [3, 5], "x": 57.5, "y": 30, "flags": 4},
{"matrix": [3, 4], "x": 47.5, "y": 30, "flags": 4},
{"matrix": [3, 3], "x": 37.5, "y": 30, "flags": 4},
{"matrix": [3, 2], "x": 27.5, "y": 30, "flags": 4},
{"matrix": [3, 1], "x": 17.5, "y": 30, "flags": 4},
{"matrix": [3, 13], "x": 127, "y": 30, "flags": 4},
{"matrix": [3, 11], "x": 117, "y": 30, "flags": 4},
{"matrix": [3, 10], "x": 107, "y": 30, "flags": 4},
{"matrix": [3, 9], "x": 97, "y": 30, "flags": 4},
{"matrix": [3, 8], "x": 87, "y": 30, "flags": 4},
{"matrix": [3, 7], "x": 77, "y": 30, "flags": 4},
{"matrix": [3, 6], "x": 67, "y": 30, "flags": 4},
{"matrix": [3, 5], "x": 57, "y": 30, "flags": 4},
{"matrix": [3, 4], "x": 47, "y": 30, "flags": 4},
{"matrix": [3, 3], "x": 37, "y": 30, "flags": 4},
{"matrix": [3, 2], "x": 27, "y": 30, "flags": 4},
{"matrix": [3, 1], "x": 17, "y": 30, "flags": 4},
{"matrix": [3, 0], "x": 0, "y": 30, "flags": 4},

{"matrix": [4, 0], "x": 0, "y": 40, "flags": 4},
{"matrix": [4, 2], "x": 22.5, "y": 40, "flags": 4},
{"matrix": [4, 3], "x": 32.5, "y": 40, "flags": 4},
{"matrix": [4, 4], "x": 42.5, "y": 40, "flags": 4},
{"matrix": [4, 5], "x": 52.5, "y": 40, "flags": 4},
{"matrix": [4, 6], "x": 62.5, "y": 40, "flags": 4},
{"matrix": [4, 7], "x": 72.5, "y": 40, "flags": 4},
{"matrix": [4, 8], "x": 82.5, "y": 40, "flags": 4},
{"matrix": [4, 9], "x": 92.5, "y": 40, "flags": 4},
{"matrix": [4, 10], "x": 102.5, "y": 40, "flags": 4},
{"matrix": [4, 11], "x": 112.5, "y": 40, "flags": 4},
{"matrix": [4, 13], "x": 122.5, "y": 40, "flags": 4},
{"matrix": [4, 2], "x": 22, "y": 40, "flags": 4},
{"matrix": [4, 3], "x": 32, "y": 40, "flags": 4},
{"matrix": [4, 4], "x": 42, "y": 40, "flags": 4},
{"matrix": [4, 5], "x": 52, "y": 40, "flags": 4},
{"matrix": [4, 6], "x": 62, "y": 40, "flags": 4},
{"matrix": [4, 7], "x": 72, "y": 40, "flags": 4},
{"matrix": [4, 8], "x": 82, "y": 40, "flags": 4},
{"matrix": [4, 9], "x": 92, "y": 40, "flags": 4},
{"matrix": [4, 10], "x": 102, "y": 40, "flags": 4},
{"matrix": [4, 11], "x": 112, "y": 40, "flags": 4},
{"matrix": [4, 13], "x": 122, "y": 40, "flags": 4},
{"matrix": [4, 14], "x": 140, "y": 40, "flags": 4},
{"matrix": [2, 15], "x": 150, "y": 40, "flags": 4},

Expand All @@ -166,9 +166,9 @@
{"matrix": [3, 14], "x": 120, "y": 50, "flags": 4},
{"matrix": [5, 10], "x": 110, "y": 50, "flags": 4},
{"matrix": [5, 9], "x": 100, "y": 50, "flags": 4},
{"matrix": [5, 6], "x": 37.5, "y": 50, "flags": 4},
{"matrix": [5, 6], "x": 37, "y": 50, "flags": 4},
{"matrix": [5, 2], "x": 25, "y": 50, "flags": 4},
{"matrix": [5, 1], "x": 12.5, "y": 50, "flags": 4},
{"matrix": [5, 1], "x": 12, "y": 50, "flags": 4},
{"matrix": [5, 0], "x": 0, "y": 50, "flags": 4},
{"flags": 4}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ 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 "user_kb.h"
#include "kb_util.h"
#include "ansi.h"
#include "usb_main.h"
#include "rf_driver.h"

kb_config_t kb_config;
DEV_INFO_STRUCT dev_info = {
.rf_baterry = 100,
.rf_battery = 100,
.link_mode = LINK_USB,
.rf_state = RF_IDLE,
};
Expand Down Expand Up @@ -59,32 +59,32 @@ extern uint8_t side_rgb;
extern uint8_t side_colour;

/**
* @brief gpio initial.
* @brief Initialize GPIO.
*/
void gpio_init(void) {
/* enable led power driver */
setPinOutput(DRIVER_LED_CS_PIN);
setPinOutput(DRIVER_SIDE_CS_PIN);
writePinLow(DRIVER_LED_CS_PIN);
writePinLow(DRIVER_SIDE_CS_PIN);
/* set side led pin output low */
setPinOutput(DRIVER_SIDE_PIN);
writePinLow(DRIVER_SIDE_PIN);
/* enable LED power driver */
gpio_set_pin_output_push_pull(DRIVER_LED_CS_PIN);
gpio_set_pin_output_push_pull(DRIVER_SIDE_CS_PIN);
gpio_write_pin_low(DRIVER_LED_CS_PIN);
gpio_write_pin_low(DRIVER_SIDE_CS_PIN);
/* set side LED pin output low */
gpio_set_pin_output_push_pull(DRIVER_SIDE_PIN);
gpio_write_pin_low(DRIVER_SIDE_PIN);
/* config RF module pin */
setPinOutput(NRF_WAKEUP_PIN);
writePinHigh(NRF_WAKEUP_PIN);
setPinInputHigh(NRF_TEST_PIN);
gpio_set_pin_output_push_pull(NRF_WAKEUP_PIN);
gpio_write_pin_high(NRF_WAKEUP_PIN);
gpio_set_pin_input_high(NRF_TEST_PIN);
/* reset RF module */
setPinOutput(NRF_RESET_PIN);
writePinLow(NRF_RESET_PIN);
gpio_set_pin_output_push_pull(NRF_RESET_PIN);
gpio_write_pin_low(NRF_RESET_PIN);
wait_ms(50);
writePinHigh(NRF_RESET_PIN);
gpio_write_pin_high(NRF_RESET_PIN);
/* config dial switch pin */
setPinInputHigh(DEV_MODE_PIN);
setPinInputHigh(SYS_MODE_PIN);
/* open led DC driver */
setPinOutput(DC_BOOST_PIN);
writePinHigh(DC_BOOST_PIN);
gpio_set_pin_input_high(DEV_MODE_PIN);
gpio_set_pin_input_high(SYS_MODE_PIN);
/* open LED DC driver */
gpio_set_pin_output_push_pull(DC_BOOST_PIN);
gpio_write_pin_high(DC_BOOST_PIN);
}

/**
Expand Down Expand Up @@ -118,7 +118,7 @@ void long_press_key(void) {
rf_sw_press_delay = 0;
}

// The device is restored to factory Settings
// The device is restored to factory settings
if (f_dev_reset_press) {
dev_reset_press_delay++;
if (dev_reset_press_delay >= DEV_RESET_PRESS_DELAY) {
Expand Down Expand Up @@ -246,11 +246,11 @@ void dial_sw_scan(void) {
}
dial_scan_timer = timer_read32();

setPinInputHigh(DEV_MODE_PIN);
setPinInputHigh(SYS_MODE_PIN);
gpio_set_pin_input_high(DEV_MODE_PIN);
gpio_set_pin_input_high(SYS_MODE_PIN);

if (readPin(DEV_MODE_PIN)) dial_scan |= 0X01;
if (readPin(SYS_MODE_PIN)) dial_scan |= 0X02;
if (gpio_read_pin(DEV_MODE_PIN)) dial_scan |= 0X01;
if (gpio_read_pin(SYS_MODE_PIN)) dial_scan |= 0X02;

if (dial_save != dial_scan) {
break_all_key();
Expand Down Expand Up @@ -316,16 +316,16 @@ void dial_sw_fast_scan(void) {
uint8_t dial_check_sys = 0;
uint8_t debounce = 0;

setPinInputHigh(DEV_MODE_PIN);
setPinInputHigh(SYS_MODE_PIN);
gpio_set_pin_input_high(DEV_MODE_PIN);
gpio_set_pin_input_high(SYS_MODE_PIN);

// Debounce to get a stable state
for(debounce=0; debounce<10; debounce++) {
dial_scan_dev = 0;
dial_scan_sys = 0;
if (readPin(DEV_MODE_PIN)) dial_scan_dev = 0x01;
if (gpio_read_pin(DEV_MODE_PIN)) dial_scan_dev = 0x01;
else dial_scan_dev = 0;
if (readPin(SYS_MODE_PIN)) dial_scan_sys = 0x01;
if (gpio_read_pin(SYS_MODE_PIN)) dial_scan_sys = 0x01;
else dial_scan_sys = 0;
if((dial_scan_dev != dial_check_dev)||(dial_scan_sys != dial_check_sys))
{
Expand Down Expand Up @@ -399,7 +399,7 @@ void timer_pro(void) {
void londing_eeprom_data(void) {
eeconfig_read_kb_datablock(&kb_config);
if (kb_config.default_brightness_flag != 0xA5) {
/* first power on, set rgb matrix brightness at middle level*/
/* upon first power on, set RGB matrix brightness to middle level */
rgb_matrix_sethsv(255, 255, RGB_MATRIX_MAXIMUM_BRIGHTNESS - RGB_MATRIX_VAL_STEP * 2);
kb_config.default_brightness_flag = 0xA5;
kb_config.ee_side_mode = side_mode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef enum {
#define RF_DISCONNECT 4
#define RF_SLEEP 5
#define RF_SNIF 6
#define RF_INVAILD 0XFE
#define RF_INVALID 0XFE
#define RF_ERR_STATE 0XFF

#define CMD_POWER_UP 0XF0
Expand Down Expand Up @@ -124,7 +124,7 @@ typedef struct
uint8_t rf_state;
uint8_t rf_charge;
uint8_t rf_led;
uint8_t rf_baterry;
uint8_t rf_battery;
uint8_t sys_sw_state;
} DEV_INFO_STRUCT;

Expand All @@ -147,8 +147,8 @@ void rf_device_init(void);
void uart_send_report_repeat(void);
void uart_receive_pro(void);
void uart_send_report(uint8_t report_type, uint8_t *report_buf, uint8_t report_size);
void side_speed_contol(uint8_t dir);
void side_light_contol(uint8_t dir);
void side_speed_control(uint8_t dir);
void side_light_control(uint8_t dir);
void side_colour_control(uint8_t dir);
void side_mode_control(uint8_t dir);
void side_led_show(void);
Expand Down
24 changes: 12 additions & 12 deletions keyboards/nuphy/air75_v2/ansi/rf.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 "user_kb.h"
#include "kb_util.h"
#include "uart.h" // qmk uart.h
#include "ansi.h"
#include "rf_driver.h"
Expand Down Expand Up @@ -146,7 +146,7 @@ void uart_send_report_repeat(void)
wait_us(200);

if(f_bit_kb_act)
uart_send_report(CMD_RPT_BIT_KB, uart_bit_report_buf, 16);
uart_send_report(CMD_RPT_BIT_KB, uart_bit_report_buf, 16);
}
else {
f_bit_kb_act = 0;
Expand Down Expand Up @@ -256,11 +256,11 @@ void RF_Protocol_Receive(void) {

dev_info.rf_charge = Usart_Mgr.RXDBuf[7];

if (Usart_Mgr.RXDBuf[8] <= 100) dev_info.rf_baterry = Usart_Mgr.RXDBuf[8];
if (dev_info.rf_charge & 0x01) dev_info.rf_baterry = 100;
if (Usart_Mgr.RXDBuf[8] <= 100) dev_info.rf_battery = Usart_Mgr.RXDBuf[8];
if (dev_info.rf_charge & 0x01) dev_info.rf_battery = 100;
}
else {
if (dev_info.rf_state != RF_INVAILD) {
if (dev_info.rf_state != RF_INVALID) {
if (error_cnt >= 5) {
error_cnt = 0;
f_send_channel = 1;
Expand Down Expand Up @@ -447,9 +447,9 @@ void dev_sts_sync(void) {
if (f_rf_reset) {
f_rf_reset = 0;
wait_ms(100);
writePinLow(NRF_RESET_PIN);
gpio_write_pin_low(NRF_RESET_PIN);
wait_ms(50);
writePinHigh(NRF_RESET_PIN);
gpio_write_pin_high(NRF_RESET_PIN);
wait_ms(50);
}
else if (f_send_channel) {
Expand Down Expand Up @@ -506,22 +506,22 @@ void dev_sts_sync(void) {
/**
* @brief Uart send bytes.
* @param Buffer data buf
* @param Length data lenght
* @param Length data length
*/
void UART_Send_Bytes(uint8_t *Buffer, uint32_t Length) {
writePinLow(NRF_WAKEUP_PIN);
gpio_write_pin_low(NRF_WAKEUP_PIN);
wait_us(50);

uart_transmit(Buffer, Length);

wait_us(50 + Length * 30);
writePinHigh(NRF_WAKEUP_PIN);
gpio_write_pin_high(NRF_WAKEUP_PIN);
}

/**
* @brief get checksum.
* @param buf data buf
* @param len data lenght
* @param len data length
*/
uint8_t get_checksum(uint8_t *buf, uint8_t len) {
uint8_t i;
Expand Down Expand Up @@ -560,7 +560,7 @@ void uart_send_report(uint8_t report_type, uint8_t *report_buf, uint8_t report_s
}

/**
* @brief Uart receives data and processes it after completion,.
* @brief Uart receives data and processes it after completion.
*/
void uart_receive_pro(void) {
static bool rcv_start = false;
Expand Down
2 changes: 1 addition & 1 deletion keyboards/nuphy/air75_v2/ansi/rf_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "host_driver.h"
#include "rf_driver.h"
#include "host.h"
#include "user_kb.h"
#include "kb_util.h"

/* Variable declaration */
extern DEV_INFO_STRUCT dev_info;
Expand Down
2 changes: 1 addition & 1 deletion keyboards/nuphy/air75_v2/ansi/rules.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SRC += side.c rf.c sleep.c rf_driver.c user_kb.c side_driver.c
SRC += side.c rf.c sleep.c rf_driver.c kb_util.c side_driver.c

UART_DRIVER_REQUIRED = yes
Loading
Loading