mirror of
https://github.com/dekuNukem/USB4VC.git
synced 2025-10-31 11:26:46 -07:00
updated instruction about nintendo switch controller
This commit is contained in:
@@ -109,8 +109,8 @@ static void MX_USART3_UART_Init(void);
|
||||
/* USER CODE BEGIN 0 */
|
||||
int fputc(int ch, FILE *f)
|
||||
{
|
||||
HAL_UART_Transmit(&huart1, (unsigned char *)&ch, 1, 100);
|
||||
return ch;
|
||||
HAL_UART_Transmit(&huart1, (unsigned char *)&ch, 1, 100);
|
||||
return ch;
|
||||
}
|
||||
|
||||
int16_t byte_to_int16_t(uint8_t lsb, uint8_t msb)
|
||||
@@ -440,9 +440,12 @@ int main(void)
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
// If both enabled, PS2 mouse takes priority
|
||||
if(protocol_status_lookup[PROTOCOL_PS2_MOUSE] == PROTOCOL_STATUS_ENABLED)
|
||||
ps2mouse_update();
|
||||
// serial_mouse_update();
|
||||
else if(protocol_status_lookup[PROTOCOL_MICROSOFT_SERIAL_MOUSE] == PROTOCOL_STATUS_ENABLED)
|
||||
serial_mouse_update();
|
||||
|
||||
if(protocol_status_lookup[PROTOCOL_AT_PS2_KB] == PROTOCOL_STATUS_ENABLED)
|
||||
ps2kb_update();
|
||||
if(spi_error_occured)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-----------
|
||||
Fresh install setup
|
||||
|
||||
raspbi-config
|
||||
enable SPI, I2C, Serial, auto login
|
||||
@@ -6,11 +8,43 @@ set up ssh:
|
||||
ssh-keygen
|
||||
copy PC pub key to rpi ~/.ssh/authorized_keys
|
||||
|
||||
--------------
|
||||
Luma OLED driver
|
||||
|
||||
https://luma-oled.readthedocs.io/en/latest/software.html
|
||||
sudo apt-get update
|
||||
sudo apt-get install python3 python3-pip python3-pil libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev libopenjp2-7 libtiff5 -y
|
||||
sudo -H pip3 install luma.oled
|
||||
|
||||
--------------
|
||||
Nintendo Pro controller
|
||||
https://retropie.org.uk/docs/Nintendo-Switch-Controllers/
|
||||
|
||||
sudo apt install git
|
||||
sudo apt install dkms
|
||||
sudo apt-get install libudev-dev
|
||||
sudo apt-get install libevdev-dev
|
||||
|
||||
git clone https://github.com/nicman23/dkms-hid-nintendo
|
||||
cd dkms-hid-nintendo
|
||||
sudo dkms add .
|
||||
sudo dkms build nintendo -v 3.2
|
||||
sudo dkms install nintendo -v 3.2
|
||||
|
||||
git clone https://github.com/DanielOgorchock/joycond.git
|
||||
cd joycond
|
||||
cmake .
|
||||
sudo make install
|
||||
sudo systemctl enable --now joycond
|
||||
-------------------
|
||||
remove CTRL+ALT+DELETE reboot
|
||||
|
||||
sudo rm /lib/systemd/system/ctrl-alt-del.target
|
||||
sudo ln -s /dev/null /lib/systemd/system/ctrl-alt-del.target
|
||||
sudo systemctl daemon-reload
|
||||
|
||||
-------------------
|
||||
|
||||
run script on launch:
|
||||
|
||||
https://raspberrypi-guide.github.io/programming/run-script-on-boot
|
||||
|
||||
@@ -115,8 +115,9 @@ def change_kb_led(scrolllock, numlock, capslock):
|
||||
led_file.write(str(capslock))
|
||||
|
||||
def raw_input_event_worker():
|
||||
mouse_spi_packet_dict = {}
|
||||
mouse_status_dict = {}
|
||||
mouse_button_state_list = [0] * 5
|
||||
joypad_status_dict = {}
|
||||
print("raw_input_event_worker started")
|
||||
while 1:
|
||||
for key in list(keyboard_opened_device_dict):
|
||||
@@ -153,11 +154,11 @@ def raw_input_event_worker():
|
||||
# buffer those values until a SYNC event
|
||||
if data[0] == EV_REL:
|
||||
if data[2] == REL_X:
|
||||
mouse_spi_packet_dict["x"] = data[4:6]
|
||||
mouse_status_dict["x"] = data[4:6]
|
||||
if data[2] == REL_Y:
|
||||
mouse_spi_packet_dict["y"] = data[4:6]
|
||||
mouse_status_dict["y"] = data[4:6]
|
||||
if data[2] == REL_WHEEL:
|
||||
mouse_spi_packet_dict["scroll"] = data[4:6]
|
||||
mouse_status_dict["scroll"] = data[4:6]
|
||||
|
||||
# mouse button pressed, send it out immediately
|
||||
if data[0] == EV_KEY:
|
||||
@@ -177,17 +178,17 @@ def raw_input_event_worker():
|
||||
pcard_spi.xfer(make_keyboard_spi_packet(data, mouse_opened_device_dict[key][1]))
|
||||
|
||||
# SYNC event happened, send out an update
|
||||
if data[0] == EV_SYN and data[2] == SYN_REPORT and len(mouse_spi_packet_dict) > 0:
|
||||
if data[0] == EV_SYN and data[2] == SYN_REPORT and len(mouse_status_dict) > 0:
|
||||
to_transfer = list(mouse_event_spi_msg_template)
|
||||
if 'x' in mouse_spi_packet_dict:
|
||||
to_transfer[4:6] = mouse_spi_packet_dict['x']
|
||||
if 'y' in mouse_spi_packet_dict:
|
||||
to_transfer[6:8] = mouse_spi_packet_dict['y']
|
||||
if 'scroll' in mouse_spi_packet_dict:
|
||||
to_transfer[8:10] = mouse_spi_packet_dict['scroll']
|
||||
if 'x' in mouse_status_dict:
|
||||
to_transfer[4:6] = mouse_status_dict['x']
|
||||
if 'y' in mouse_status_dict:
|
||||
to_transfer[6:8] = mouse_status_dict['y']
|
||||
if 'scroll' in mouse_status_dict:
|
||||
to_transfer[8:10] = mouse_status_dict['scroll']
|
||||
to_transfer[13:18] = mouse_button_state_list[:]
|
||||
to_transfer[3] = mouse_opened_device_dict[key][1]
|
||||
mouse_spi_packet_dict.clear()
|
||||
mouse_status_dict.clear()
|
||||
pcard_spi.xfer(to_transfer)
|
||||
|
||||
for key in list(gamepad_opened_device_dict):
|
||||
@@ -300,5 +301,5 @@ def get_pboard_info():
|
||||
def set_protocol():
|
||||
this_msg = list(set_protocl_spi_msg_template)
|
||||
this_msg[3] = 1 | 0x80
|
||||
this_msg[4] = 4 #| 0x80
|
||||
this_msg[4] = 4 | 0x80
|
||||
pcard_spi.xfer(this_msg)
|
||||
|
||||
Reference in New Issue
Block a user