Skip to content

Commit

Permalink
update firmware to V2.1.3
Browse files Browse the repository at this point in the history
1. Cancel the vibration of the left/middle/right button on TP78 touchbar, in order to fix the bug where the combination of the trackpoint and touchbar causes the former to be unable to move.
2. Optimize the connection stability of the TPM module.
3. Modify the HID descriptor configuration of USB/BLE/RF and add knob configuration. **After updating the version, it is necessary to upgrade the receiver firmware.**
4. Update the document to include instructions for VIA, U-disk, and OLED icon descriptions.
  • Loading branch information
ChnMasterOG committed Jul 23, 2024
1 parent 0613cea commit 8b2b59d
Show file tree
Hide file tree
Showing 42 changed files with 418,990 additions and 398,904 deletions.
12 changes: 11 additions & 1 deletion README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ You can submit you code [here](https://github.com/ChnMasterOG/tp78_v2/issues). T

        2. Update WCH SDK to the January 2024 version.

        3. **After updated this version, the Numlock status will be displayed on OLED in RF mode. When the signal is poor and packet loss occurs, the keyboard will automatically initiate a retransmission. The default retransmission time is 10ms, which can be modified through the RF_chk_ms parameter. This function needs to be synchronized and upgraded with the receiver firmware before it can take effect.**
        3. After updated this version, the Numlock status will be displayed on OLED in RF mode. When the signal is poor and packet loss occurs, the keyboard will automatically initiate a retransmission. The default retransmission time is 10ms, which can be modified through the RF_chk_ms parameter. This function needs to be synchronized and upgraded with the receiver firmware before it can take effect.

        4. Adapt to miniFOC and TP78mini expansion modules.

Expand All @@ -232,3 +232,13 @@ You can submit you code [here](https://github.com/ChnMasterOG/tp78_v2/issues). T
- V2.1.2

        1. Support VIA keyboard macro functions. (Keep old U-disk functions)

- V2.1.3

        1. Cancel the vibration of the left/middle/right button on TP78 touchbar, in order to fix the bug where the combination of the trackpoint and touchbar causes the former to be unable to move.

        2. Optimize the connection stability of the TPM module.

        3. Modify the HID descriptor configuration of USB/BLE/RF and add knob configuration. **After updating the version, it is necessary to upgrade the receiver firmware.**

        4. Update the document to include instructions for VIA, U-disk, and OLED icon descriptions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,17 @@ C(mounriver_project - wch软件工程) --> J(VLD_CH582M - 主控板测试工程)
- V2.1.2

        1. 支持VIA修改按键宏功能(保持U盘模式修改,保持M6和M7为触摸条左右按键宏功能)

- V2.1.3

        1. 取消触摸条左中右按键振动,修复小红点和触摸条联合使用会造成小红点无法移动的

BUG

        2. 优化扩展模块连接稳定性

        3. 修改 USB/BLE/RF 的连接描述符配置,新增旋钮配置。更新版本后需要同步升级接收

器固件

        4. 更新文档,增加VIA改键说明、U盘改键说明和OLED图标描述
Binary file modified documents/TP78v2指导文档.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1093777715953807195" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-1583831302431893160" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
Expand Down
19 changes: 19 additions & 0 deletions mounriver_project/KEYBOARD_CH582M/HAL/BLE.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
// HID VOL input report length
#define HID_VOL_IN_RPT_LEN 2 //HID_VOLUME_DATA_LENGTH

// HID SWITCH input report length
#define HID_SWITCH_IN_RPT_LEN HID_SWITCH_DATA_LENGTH

/*********************************************************************
* CONSTANTS
*/
Expand Down Expand Up @@ -404,6 +407,15 @@ uint16 HidEmu_ProcessEvent( uint8 task_id, uint16 events )
return ( events ^ BLE_VOL_REPORT_EVT );
}

if ( events & BLE_SWITCH_REPORT_EVT )
{
#if (defined (BLE_DIAL)) && (BLE_DIAL == TRUE)
HidDev_Report( HID_RPT_ID_DIAL_IN, HID_REPORT_TYPE_INPUT,
HID_SWITCH_IN_RPT_LEN, HIDSwitch ); // HID旋钮report
#endif
return ( events ^ BLE_SWITCH_REPORT_EVT );
}

if ( events & START_ENTER_PASSKEY_EVT )
{
OLED_UI_add_SHOWINFO_task("Passkey=?");
Expand Down Expand Up @@ -496,6 +508,13 @@ static void hidEmu_ProcessTMOSMsg( tmos_event_hdr_t *pMsg )
msg->hdr.status ? tmos_set_event( hidEmuTaskId, BLE_VOL_REPORT_EVT ) : 0;
break;
}
case SWITCH_MESSAGE: {
if (hidEmuConnHandle == GAP_CONNHANDLE_INIT)
break;
SendMSG_t *msg = (SendMSG_t *) pMsg;
msg->hdr.status ? tmos_set_event( hidEmuTaskId, BLE_SWITCH_REPORT_EVT ) : 0;
break;
}
case PASSKEY_MESSAGE: {
SendMSG_t *msg = (SendMSG_t *) pMsg;
msg->hdr.status = GAPBondMgr_PasscodeRsp( hidEmuConnHandle, SUCCESS, BLE_Passkey ); // 发送密码
Expand Down
3 changes: 2 additions & 1 deletion mounriver_project/KEYBOARD_CH582M/HAL/CORE.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ void TP78Reinit(uint8_t mode, enum LP_Type lp_type)
WWDG_ResetCfg(DISABLE); // 关看门狗
#endif
#ifdef HAL_WS2812_PWM
g_record_last_LED_style = led_style_func;
led_style_func = WS2812_Style_Off; g_keyboard_status.changeBL = TRUE; WS2812_Send(); // WS2812 OFF
#endif
#if (defined HAL_OLED) && (HAL_OLED == TRUE)
Expand Down Expand Up @@ -192,7 +193,7 @@ void TP78Reinit(uint8_t mode, enum LP_Type lp_type)
} else { // 唤醒键盘
if (lp_type != lp_shutdown_mode) { // 恢复现场
#if (defined HAL_WS2812_PWM)
DATAFLASH_Read_LEDStyle(); // WS2812
led_style_func = g_record_last_LED_style; g_keyboard_status.changeBL = TRUE;
#endif
#if (defined HAL_HW_I2C) && (HAL_HW_I2C == TRUE)
#if (defined HAL_I2C_TP) && (HAL_I2C_TP == TRUE)
Expand Down
2 changes: 1 addition & 1 deletion mounriver_project/KEYBOARD_CH582M/HAL/I2C_TP.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ uint8_t I2C_TP_ReadPacket(void)
err += HW_I2C_WaitUntilTimeout((expression_func)I2C_GetFlagStatus, I2C_FLAG_RXNE, RESET, HW_I2C_RD_TIMOUT);
HIDMouse[2] = I2C_ReceiveData( );
/* Reserved */
I2C_AcknowledgeConfig(DISABLE);
err += HW_I2C_WaitUntilTimeout((expression_func)I2C_GetFlagStatus, I2C_FLAG_RXNE, RESET, HW_I2C_RD_TIMOUT);
I2C_AcknowledgeConfig(DISABLE);
packet_check[3] = I2C_ReceiveData( );
I2C_GenerateSTOP(ENABLE);
I2C_AcknowledgeConfig(ENABLE);
Expand Down
32 changes: 19 additions & 13 deletions mounriver_project/KEYBOARD_CH582M/HAL/MCU.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,22 @@
#include "HAL.h"

/* HID data */
UINT8 HID_DATA[HID_DATA_LENGTH] = { 0x0, 0x0, 0x0, 0x0, 0x0,
0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x2, 0x0 }; // bit1~bit4: mouse data, bit6~bit13: key data, bit15: vol data
/* 鼠标数据 */
UINT8* HIDMouse = &HID_DATA[1];
// bit1~bit8: key data
// bit10~bit13: mouse data
// bit15: vol data
// bit17: switch data
UINT8 HID_DATA[HID_DATA_LENGTH] = { 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x2, 0x0, 0x0, 0x0, 0x0,
0x3, 0x0,
0x4, 0x0, 0x0};
/* 键盘数据 */
UINT8* HIDKeyboard = &HID_DATA[6];
UINT8* HIDKeyboard = &HID_DATA[1];
/* 鼠标数据 */
UINT8* HIDMouse = &HID_DATA[10];
/* 音量控制数据 */
UINT8* HIDVolume = &HID_DATA[15];
/* 旋钮数据 */
UINT8* HIDSwitch = &HID_DATA[17];

tmosTaskID halTaskID = INVALID_TASK_ID;

Expand Down Expand Up @@ -210,17 +217,18 @@ __attribute__((weak)) void HID_I2CTP_Process(void)
uint8_t tmp;
if (TPINT_GPIO_(ReadPortPin)( TPINT_Pin ) == 0 && g_Enable_Status.tp == TRUE) { // 发送小红点鼠标数据
TP78_Idle_Clr();
if (I2C_TP_ReadPacket() == 0) { // 正常接受完数据包
tmp = I2C_TP_ReadPacket();
if (tmp == 0) { // 正常接受完数据包
#if (defined TP_Reverse) && (TP_Reverse == TRUE)
HIDMouse[1] = -HIDMouse[1]; // 反转X轴
HIDMouse[2] = -HIDMouse[2]; // 反转Y轴
#endif
/* 小红点减速 */
tmp = (char)HIDMouse[1] / (char)g_TP_speed_div;
if ( tmp == 0 && HIDMouse[1]!=0) HIDMouse[1] = ( HIDMouse[1] < 128) ? 1 : -1;
if ( tmp == 0 && HIDMouse[1]!=0) HIDMouse[1] = ( HIDMouse[1] < 128 ) ? 1 : -1;
else HIDMouse[1] = tmp;
tmp = (char)HIDMouse[2] / (char)g_TP_speed_div;
if ( tmp == 0 && HIDMouse[2]!=0) HIDMouse[2] = ( HIDMouse[2] < 128) ? 1 : -1;
if ( tmp == 0 && HIDMouse[2]!=0) HIDMouse[2] = ( HIDMouse[2] < 128 ) ? 1 : -1;
else HIDMouse[2] = tmp;

/* 鼠标事件 */
Expand All @@ -232,8 +240,6 @@ __attribute__((weak)) void HID_I2CTP_Process(void)
OnBoard_SendMsg(RFTaskId, MOUSE_MESSAGE, 1, NULL); // RF鼠标事件
}
} else {
// OLED_UI_add_SHOWINFO_task("TPdat ER");
// OLED_UI_add_CANCELINFO_delay_task(3000);
}
}
}
Expand Down Expand Up @@ -854,7 +860,7 @@ tmosEvents HAL_ProcessEvent( tmosTaskID task_id, tmosEvents events )
#endif
#endif
if (g_Game_Mode == FALSE) {
tmos_start_task( halTaskID, HAL_MOUSE_EVENT, MS1_TO_SYSTEM_TIME(25) ); // 处理鼠标(至少20ms保证蓝牙线程)
tmos_start_task( halTaskID, HAL_MOUSE_EVENT, MS1_TO_SYSTEM_TIME(25) ); // 处理鼠标(至少25ms保证蓝牙线程)
}
return events ^ HAL_MOUSE_EVENT;
}
Expand Down Expand Up @@ -925,7 +931,7 @@ tmosEvents HAL_ProcessEvent( tmosTaskID task_id, tmosEvents events )
#if (defined HAL_WS2812_PWM) && (HAL_WS2812_PWM == TRUE)
HW_WS2812_Process();
#endif
tmos_start_task( halTaskID, WS2812_EVENT, MS1_TO_SYSTEM_TIME(80) ); // 80ms周期控制背光
tmos_start_task( halTaskID, WS2812_EVENT, MS1_TO_SYSTEM_TIME(WS2812_TASK_PERIOD_MS) ); // 80ms周期控制背光
return events ^ WS2812_EVENT;
}

Expand Down
6 changes: 3 additions & 3 deletions mounriver_project/KEYBOARD_CH582M/HAL/MPR121.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ void MPR121_Post_Operation(void)
oper_dat.l_btn_l = TRUE;
MPR121_set_result(&oper_dat);
OLED_UI_add_SHOWINFO_task("L Btn");
MOTOR_GO();
// MOTOR_GO(); // 打开可能导致指点杆异常
} else if (oper_dat.m_btn && oper_dat.m_btn_l == FALSE) {
oper_dat.m_btn_l = TRUE;
MPR121_set_result(&oper_dat);
OLED_UI_add_SHOWINFO_task("M Btn");
MOTOR_GO();
// MOTOR_GO(); // 打开可能导致指点杆异常
} else if (oper_dat.r_btn && oper_dat.r_btn_l == FALSE) {
oper_dat.r_btn_l = TRUE;
MPR121_set_result(&oper_dat);
OLED_UI_add_SHOWINFO_task("R Btn");
MOTOR_GO();
// MOTOR_GO(); // 打开可能导致指点杆异常
} else return;
OLED_UI_add_CANCELINFO_delay_task(2000);
}
11 changes: 11 additions & 0 deletions mounriver_project/KEYBOARD_CH582M/HAL/RF_PHY.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ static void RF_ProcessTMOSMsg( tmos_event_hdr_t *pMsg )
msg->hdr.status ? tmos_set_event( RFTaskId, SBP_RF_VOL_REPORT_EVT ) : 0;
break;
}
case SWITCH_MESSAGE: {
SendMSG_t *msg = (SendMSG_t *) pMsg;
msg->hdr.status ? tmos_set_event( RFTaskId, SBP_RF_SWITCH_REPORT_EVT ) : 0;
break;
}
case HEARTBEAT_MESSAGE: {
SendMSG_t *msg = (SendMSG_t *) pMsg;
msg->hdr.status ? tmos_set_event( RFTaskId, SBP_RF_HEARTBEAT_REPORT_EVT ) : 0;
Expand Down Expand Up @@ -268,6 +273,12 @@ uint16_t RF_ProcessEvent(uint8_t task_id, uint16_t events)
RF_Tx(HIDVolume - 1, HID_VOLUME_DATA_LENGTH + 1, 0xFF, 0xFF);
return events ^ SBP_RF_VOL_REPORT_EVT;
}
if (events & SBP_RF_SWITCH_REPORT_EVT)
{
RF_Shut();
RF_Tx(HIDSwitch - 1, HID_SWITCH_DATA_LENGTH + 1, 0xFF, 0xFF);
return events ^ SBP_RF_SWITCH_REPORT_EVT;
}
if (events & SBP_RF_JUMPBOOT_REPORT_EVT)
{
RF_Shut();
Expand Down
Loading

0 comments on commit 8b2b59d

Please sign in to comment.