mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
added mousesystems serial mouse support
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#define PROTOCOL_MICROSOFT_SERIAL_MOUSE 5
|
||||
#define PROTOCOL_ADB_MOUSE 6
|
||||
#define PROTOCOL_GENERIC_GAMEPORT_GAMEPAD 7
|
||||
#define PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE 8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -27,18 +27,22 @@ Project File Date: 03/28/2022
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
|
||||
Build target 'ibmpc'
|
||||
compiling helpers.c...
|
||||
compiling xt_kb.c...
|
||||
compiling ps2kb.c...
|
||||
compiling ps2mouse.c...
|
||||
compiling main.c...
|
||||
../Src/main.c(489): warning: #188-D: enumerated type mixed with another type
|
||||
../Src/main.c(511): warning: #188-D: enumerated type mixed with another type
|
||||
HAL_GPIO_WritePin(GAMEPAD_B1_GPIO_Port, GAMEPAD_B1_Pin, !(this_gamepad_event->button_1));
|
||||
../Src/main.c(490): warning: #188-D: enumerated type mixed with another type
|
||||
../Src/main.c(512): warning: #188-D: enumerated type mixed with another type
|
||||
HAL_GPIO_WritePin(GAMEPAD_B2_GPIO_Port, GAMEPAD_B2_Pin, !(this_gamepad_event->button_2));
|
||||
../Src/main.c(491): warning: #188-D: enumerated type mixed with another type
|
||||
../Src/main.c(513): warning: #188-D: enumerated type mixed with another type
|
||||
HAL_GPIO_WritePin(GAMEPAD_B3_GPIO_Port, GAMEPAD_B3_Pin, !(this_gamepad_event->button_3));
|
||||
../Src/main.c(492): warning: #188-D: enumerated type mixed with another type
|
||||
../Src/main.c(514): warning: #188-D: enumerated type mixed with another type
|
||||
HAL_GPIO_WritePin(GAMEPAD_B4_GPIO_Port, GAMEPAD_B4_Pin, !(this_gamepad_event->button_4));
|
||||
../Src/main.c: 4 warnings, 0 errors
|
||||
linking...
|
||||
Program Size: Code=11596 RO-data=764 RW-data=136 ZI-data=2320
|
||||
Program Size: Code=17196 RO-data=768 RW-data=136 ZI-data=2320
|
||||
FromELF: creating hex file...
|
||||
"ibmpc\ibmpc.axf" - 0 Error(s), 4 Warning(s).
|
||||
|
||||
@@ -63,7 +67,7 @@ Package Vendor: Keil
|
||||
<h2>Collection of Component Files used:</h2>
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.3.0
|
||||
Build Time Elapsed: 00:00:01
|
||||
Build Time Elapsed: 00:00:02
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -40,7 +40,7 @@ F (..\Src\helpers.c)(0x61BCF9FD)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O3 --
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_gpio.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_gpio_ex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma_ex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma_ex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_cortex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_flash.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_flash_ex.h)(0x5DFA0893)
|
||||
@@ -78,7 +78,7 @@ F (..\Src\ps2kb.c)(0x627582A5)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O3 --ap
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_def.h)(0x5DFA0893)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h)(0x5DFA0880)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f072xb.h)(0x5DFA0880)
|
||||
I (../Drivers/CMSIS/Include/core_cm0.h)(0x5DFA0892)
|
||||
I (../Drivers/CMSIS/Include/core_cm0.h)(0x5DFA0892)
|
||||
I (C:\Keil_v5\ARM\ARMCC\include\stdint.h)(0x5D9B4298)
|
||||
I (../Drivers/CMSIS/Include/core_cmInstr.h)(0x5DFA0892)
|
||||
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x5DFA0892)
|
||||
@@ -118,7 +118,7 @@ F (..\Src\ps2mouse.c)(0x62757D48)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O3 -
|
||||
I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x5D9B429A)
|
||||
I (C:\Keil_v5\ARM\ARMCC\include\string.h)(0x5D9B4298)
|
||||
I (C:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x5D9B429A)
|
||||
I (../Inc/helpers.h)(0x62783C99)
|
||||
I (../Inc/helpers.h)(0x627A4147)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h)(0x5DFA0893)
|
||||
I (../Inc/stm32f0xx_hal_conf.h)(0x62423606)
|
||||
I (../Inc/main.h)(0x62423606)
|
||||
@@ -155,7 +155,7 @@ I (../Inc/shared.h)(0x61B61A00)
|
||||
I (../Inc/ps2kb.h)(0x6274FBAF)
|
||||
I (../Inc/delay_us.h)(0x617487C7)
|
||||
F (..\Src\ps2mouse.c)(0x62757D48)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O3 --apcs=interwork --split_sections -I ../Inc -I ../Drivers/STM32F0xx_HAL_Driver/Inc -I ../Drivers/STM32F0xx_HAL_Driver/Inc/Legacy -I ../Drivers/CMSIS/Device/ST/STM32F0xx/Include -I ../Drivers/CMSIS/Include
|
||||
|
||||
|
||||
-I.\RTE\_ibmpc
|
||||
|
||||
-IC:\Users\allen\AppData\Local\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include
|
||||
@@ -202,7 +202,7 @@ F (..\Src\xt_kb.c)(0x626F0101)(--c99 -c --cpu Cortex-M0 -D__MICROLIB -g -O3 --ap
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_uart.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_uart_ex.h)(0x5DFA0893)
|
||||
I (../Inc/shared.h)(0x61B61A00)
|
||||
I (../Inc/ps2mouse.h)(0x62757D20)
|
||||
I (../Inc/ps2mouse.h)(0x62757D20)
|
||||
I (../Inc/delay_us.h)(0x617487C7)
|
||||
F (..\Inc\delay_us.h)(0x617487C7)()
|
||||
F (..\Inc\helpers.h)(0x627A4147)()
|
||||
@@ -239,7 +239,7 @@ I (../Inc/shared.h)(0x61B61A00)
|
||||
I (../Drivers/CMSIS/Include/core_cmFunc.h)(0x5DFA0892)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h)(0x5DFA0880)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_rcc_ex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_gpio.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_gpio.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_gpio_ex.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_dma_ex.h)(0x5DFA0893)
|
||||
@@ -275,7 +275,7 @@ I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_uart.h)(0x5DFA0893)
|
||||
I (../Inc/helpers.h)(0x627A4147)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h)(0x5DFA0893)
|
||||
I (../Inc/stm32f0xx_hal_conf.h)(0x62423606)
|
||||
I (../Inc/main.h)(0x62423606)
|
||||
I (../Inc/main.h)(0x62423606)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_rcc.h)(0x5DFA0893)
|
||||
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_def.h)(0x5DFA0893)
|
||||
I (../Drivers/CMSIS/Device/ST/STM32F0xx/Include/stm32f0xx.h)(0x5DFA0880)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -121,6 +121,19 @@ static void MX_IWDG_Init(void);
|
||||
/* USER CODE END PFP */
|
||||
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
void mouse_uart_switch_to_8bit(void)
|
||||
{
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
HAL_UART_Init(&huart3);
|
||||
}
|
||||
|
||||
void mouse_uart_switch_to_7bit(void)
|
||||
{
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_7B;
|
||||
HAL_UART_Init(&huart3);
|
||||
}
|
||||
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
HAL_UART_Transmit(&huart1, (unsigned char *)&ch, 1, 100);
|
||||
@@ -177,6 +190,11 @@ void handle_protocol_switch(uint8_t spi_byte)
|
||||
break;
|
||||
|
||||
case PROTOCOL_MICROSOFT_SERIAL_MOUSE:
|
||||
mouse_uart_switch_to_7bit();
|
||||
break;
|
||||
|
||||
case PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE:
|
||||
mouse_uart_switch_to_8bit();
|
||||
break;
|
||||
|
||||
case PROTOCOL_GENERIC_GAMEPORT_GAMEPAD:
|
||||
@@ -208,6 +226,9 @@ void handle_protocol_switch(uint8_t spi_byte)
|
||||
case PROTOCOL_MICROSOFT_SERIAL_MOUSE:
|
||||
break;
|
||||
|
||||
case PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE:
|
||||
break;
|
||||
|
||||
case PROTOCOL_GENERIC_GAMEPORT_GAMEPAD:
|
||||
gameport_init();
|
||||
break;
|
||||
@@ -415,7 +436,7 @@ void microsoft_serial_mouse_update(void)
|
||||
|
||||
if(serial_mouse_is_tx_in_progress)
|
||||
{
|
||||
if(this_mouse_event->has_button_transition == 0)
|
||||
if(this_mouse_event->has_button_transition == 0) // dont throw away events that have button transitions
|
||||
mouse_buf_pop(&my_mouse_buf);
|
||||
return;
|
||||
}
|
||||
@@ -471,6 +492,7 @@ void protocol_status_lookup_init(void)
|
||||
protocol_status_lookup[PROTOCOL_XT_KB] = PROTOCOL_STATUS_DISABLED;
|
||||
protocol_status_lookup[PROTOCOL_PS2_MOUSE] = PROTOCOL_STATUS_ENABLED;
|
||||
protocol_status_lookup[PROTOCOL_MICROSOFT_SERIAL_MOUSE] = PROTOCOL_STATUS_DISABLED;
|
||||
protocol_status_lookup[PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE] = PROTOCOL_STATUS_DISABLED;
|
||||
protocol_status_lookup[PROTOCOL_GENERIC_GAMEPORT_GAMEPAD] = PROTOCOL_STATUS_ENABLED;
|
||||
}
|
||||
|
||||
@@ -527,19 +549,7 @@ huart3.Init.WordLength = UART_WORDLENGTH_7B;
|
||||
!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
|
||||
void mouse_uart_switch_to_8bit(void)
|
||||
{
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_8B;
|
||||
HAL_UART_Init(&huart3);
|
||||
}
|
||||
|
||||
void mouse_uart_switch_to_7bit(void)
|
||||
{
|
||||
huart3.Init.WordLength = UART_WORDLENGTH_7B;
|
||||
HAL_UART_Init(&huart3);
|
||||
}
|
||||
|
||||
void mousesystem_update(void)
|
||||
void mousesystems_serial_mouse_update(void)
|
||||
{
|
||||
mouse_event* this_mouse_event = mouse_buf_peek(&my_mouse_buf);
|
||||
if(this_mouse_event == NULL)
|
||||
@@ -547,7 +557,7 @@ void mousesystem_update(void)
|
||||
|
||||
if(serial_mouse_is_tx_in_progress)
|
||||
{
|
||||
if(this_mouse_event->has_button_transition == 0)
|
||||
if(this_mouse_event->has_button_transition == 0) // don't throw away mouse events that has button transitions
|
||||
mouse_buf_pop(&my_mouse_buf);
|
||||
return;
|
||||
}
|
||||
@@ -568,7 +578,7 @@ void mousesystem_update(void)
|
||||
HAL_UART_Transmit_IT(&huart3, mousesystems_serial_mouse_output_buf, MOUSESYSTEMS_SERIAL_MOUSE_BUF_SIZE);
|
||||
serial_mouse_is_tx_in_progress = 1;
|
||||
if(this_mouse_event->has_button_transition)
|
||||
HAL_Delay(10);
|
||||
HAL_Delay(10); // wait a bit for the computer to register button press
|
||||
}
|
||||
|
||||
/* USER CODE END 0 */
|
||||
@@ -646,32 +656,31 @@ int main(void)
|
||||
HAL_GPIO_WritePin(ERR_LED_GPIO_Port, ERR_LED_Pin, GPIO_PIN_SET);
|
||||
}
|
||||
|
||||
mouse_uart_switch_to_8bit();
|
||||
while (1)
|
||||
{
|
||||
HAL_IWDG_Refresh(&hiwdg);
|
||||
mousesystem_update();
|
||||
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
|
||||
// // If both enabled, PS2 mouse takes priority
|
||||
// if(is_protocol_enabled(PROTOCOL_PS2_MOUSE) && IS_PS2MOUSE_PRESENT())
|
||||
// ps2mouse_update();
|
||||
// else if(is_protocol_enabled(PROTOCOL_MICROSOFT_SERIAL_MOUSE))
|
||||
// microsoft_serial_mouse_update();
|
||||
// // If both enabled, PS2 keyboard takes priority
|
||||
// if(is_protocol_enabled(PROTOCOL_AT_PS2_KB) && IS_KB_PRESENT())
|
||||
// ps2kb_update();
|
||||
// else if(is_protocol_enabled(PROTOCOL_XT_KB) && IS_KB_PRESENT())
|
||||
// xtkb_update();
|
||||
// If more than one enabled, PS2 mouse takes priority
|
||||
if(is_protocol_enabled(PROTOCOL_PS2_MOUSE) && IS_PS2MOUSE_PRESENT())
|
||||
ps2mouse_update();
|
||||
else if(is_protocol_enabled(PROTOCOL_MICROSOFT_SERIAL_MOUSE))
|
||||
microsoft_serial_mouse_update();
|
||||
else if(is_protocol_enabled(PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE))
|
||||
mousesystems_serial_mouse_update();
|
||||
// If both enabled, PS2 keyboard takes priority
|
||||
if(is_protocol_enabled(PROTOCOL_AT_PS2_KB) && IS_KB_PRESENT())
|
||||
ps2kb_update();
|
||||
else if(is_protocol_enabled(PROTOCOL_XT_KB) && IS_KB_PRESENT())
|
||||
xtkb_update();
|
||||
|
||||
// if(is_protocol_enabled(PROTOCOL_GENERIC_GAMEPORT_GAMEPAD))
|
||||
// gamepad_update();
|
||||
if(is_protocol_enabled(PROTOCOL_GENERIC_GAMEPORT_GAMEPAD))
|
||||
gamepad_update();
|
||||
|
||||
// if(spi_error_occured)
|
||||
// spi_error_dump_reboot();
|
||||
if(spi_error_occured)
|
||||
spi_error_dump_reboot();
|
||||
}
|
||||
/* USER CODE END 3 */
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ PROTOCOL_PS2_MOUSE_NORMAL = {'pid':4, 'display_name':"PS/2"}
|
||||
PROTOCOL_MICROSOFT_SERIAL_MOUSE = {'pid':5, 'display_name':"Microsft Serial"}
|
||||
PROTOCOL_ADB_MOUSE = {'pid':6, 'display_name':"ADB"}
|
||||
PROTOCOL_15PIN_GAMEPORT_GAMEPAD = {'pid':7, 'display_name':"Generic 15-Pin", 'mapping':IBM_GENERIC_USB_GAMEPAD_TO_15PIN_GAMEPORT_GAMEPAD_DEAULT_MAPPING}
|
||||
PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE = {'pid':8, 'display_name':"MouseSys Serial"}
|
||||
PROTOCOL_USB_GP_TO_MOUSE_KB = {'pid':0, 'display_name':'Mouse & KB', 'mapping':GENERIC_USB_GAMEPAD_TO_MOUSE_KB_DEAULT_MAPPING}
|
||||
PROTOCOL_RAW_KEYBOARD = {'pid':125, 'display_name':"Raw data"}
|
||||
PROTOCOL_RAW_MOUSE = {'pid':126, 'display_name':"Raw data"}
|
||||
@@ -294,7 +295,7 @@ def update_from_usb(usb_config_path):
|
||||
os.system("mv -v /home/pi/usb4vc/config.json /home/pi/usb4vc/config/config.json")
|
||||
|
||||
ibmpc_keyboard_protocols = [PROTOCOL_OFF, PROTOCOL_AT_PS2_KB, PROTOCOL_XT_KB]
|
||||
ibmpc_mouse_protocols = [PROTOCOL_OFF, PROTOCOL_PS2_MOUSE_NORMAL, PROTOCOL_MICROSOFT_SERIAL_MOUSE]
|
||||
ibmpc_mouse_protocols = [PROTOCOL_OFF, PROTOCOL_PS2_MOUSE_NORMAL, PROTOCOL_MICROSOFT_SERIAL_MOUSE, PROTOCOL_MOUSESYSTEMS_SERIAL_MOUSE]
|
||||
ibmpc_gamepad_protocols = [PROTOCOL_OFF, PROTOCOL_15PIN_GAMEPORT_GAMEPAD, PROTOCOL_USB_GP_TO_MOUSE_KB]
|
||||
|
||||
adb_keyboard_protocols = [PROTOCOL_OFF, PROTOCOL_ADB_KB]
|
||||
|
||||
Reference in New Issue
Block a user