updated led control to be much faster

This commit is contained in:
dekunukem
2021-12-11 21:44:24 +00:00
parent b5008f3eb1
commit 2ab29e06dd
13 changed files with 127 additions and 125 deletions

View File

File diff suppressed because one or more lines are too long

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -27,8 +27,7 @@ Project File Date: 12/07/2021
<h2>Output:</h2>
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'ibmpc'
compiling ps2kb.c...
compiling ps2mouse.c...
compiling main.c...
linking...
Program Size: Code=12128 RO-data=372 RW-data=96 ZI-data=2136
FromELF: creating hex file...
@@ -55,7 +54,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>

View File

@@ -3,7 +3,7 @@
<title>Static Call Graph - [ibmpc\ibmpc.axf]</title></head>
<body><HR>
<H1>Static Call Graph for image ibmpc\ibmpc.axf</H1><HR>
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060750: Last Updated: Sat Dec 11 20:30:44 2021
<BR><P>#&#060CALLGRAPH&#062# ARM Linker, 5060750: Last Updated: Sat Dec 11 21:23:18 2021
<BR><P>
<H3>Maximum Stack Usage = 196 bytes + Unknown(Cycles, Untraceable Function Pointers)</H3><H3>
Call chain for Maximum Stack Depth:</H3>

View File

@@ -35,7 +35,7 @@ I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_tim_ex.h)(0x5DFA0893)
I (../Drivers/CMSIS/Include/cmsis_armcc.h)(0x5DFA0892)
I (../Drivers/CMSIS/Include/core_cmFunc.h)(0x5DFA0892)
I (../Drivers/CMSIS/Device/ST/STM32F0xx/Include/system_stm32f0xx.h)(0x5DFA0880)
I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x5D9B429A)
I (C:\Keil_v5\ARM\ARMCC\include\stdio.h)(0x5D9B429A)
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_ex.h)(0x5DFA0893)
@@ -72,7 +72,7 @@ I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal_tim_ex.h)(0x5DFA0893)
I (../Inc/helpers.h)(0x61B509BF)
I (../Drivers/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h)(0x5DFA0893)
I (../Inc/stm32f0xx_hal_conf.h)(0x61AFDCDB)
I (../Inc/main.h)(0x61AFDCDB)
I (../Inc/main.h)(0x61AFDCDB)
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)
@@ -155,7 +155,7 @@ F (..\Inc\helpers.h)(0x61B509BF)()
-I.\RTE\_ibmpc
-IC:\Users\allen\AppData\Local\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include
-IC:\Users\allen\AppData\Local\Arm\Packs\ARM\CMSIS\5.6.0\CMSIS\Core\Include
-IC:\Users\allen\AppData\Local\Arm\Packs\Keil\STM32F0xx_DFP\2.0.0\Drivers\CMSIS\Device\ST\STM32F0xx\Include

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

Binary file not shown.

View File

@@ -7,9 +7,9 @@ import usb4vc_oled
RPI_APP_VERSION_TUPLE = (0, 0, 1)
usb4vc_oled.print_welcome_screen(RPI_APP_VERSION_TUPLE)
time.sleep(5)
usb4vc_oled.oled_clear()
# usb4vc_oled.print_welcome_screen(RPI_APP_VERSION_TUPLE)
# time.sleep(5)
# usb4vc_oled.oled_clear()
usb4vc_oled.oled_queue_worker.start()
usb4vc_usb_scan.usb_device_scan_thread.start()

View File

@@ -3,7 +3,7 @@ import sys
import time
import spidev
import threading
# import RPi.GPIO as GPIO
import RPi.GPIO as GPIO
from usb4vc_oled import oled_display_queue
@@ -21,9 +21,9 @@ HAVE TO ASSERT BOOT0 THE WHOLE TIME
"""
SLAVE_REQ_PIN = 16
# GPIO.setmode(GPIO.BCM)
# GPIO.setup(SLAVE_REQ_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
# GPIO.add_event_detect(SLAVE_REQ_PIN, GPIO.RISING)
GPIO.setmode(GPIO.BCM)
GPIO.setup(SLAVE_REQ_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.add_event_detect(SLAVE_REQ_PIN, GPIO.RISING)
pcard_spi = spidev.SpiDev(0, 0)
pcard_spi.max_speed_hz = 2000000
@@ -90,13 +90,16 @@ def change_kb_led(ps2kb_led_byte):
scrolllock_list = [os.path.join(led_device_path, x) for x in led_file_list if 'scrolllock' in x]
for item in scrolllock_list:
os.system(f"sudo bash -c 'echo {get_01(ps2kb_led_byte & 0x1)} > {os.path.join(item, 'brightness')}'")
with open(os.path.join(item, 'brightness'), 'w') as led_file:
led_file.write(str(get_01(ps2kb_led_byte & 0x1)))
for item in numlock_list:
os.system(f"sudo bash -c 'echo {get_01(ps2kb_led_byte & 0x2)} > {os.path.join(item, 'brightness')}'")
with open(os.path.join(item, 'brightness'), 'w') as led_file:
led_file.write(str(get_01(ps2kb_led_byte & 0x2)))
for item in capslock_list:
os.system(f"sudo bash -c 'echo {get_01(ps2kb_led_byte & 0x4)} > {os.path.join(item, 'brightness')}'")
with open(os.path.join(item, 'brightness'), 'w') as led_file:
led_file.write(str(get_01(ps2kb_led_byte & 0x4)))
def raw_input_event_worker():
mouse_spi_packet_dict = {}
@@ -159,14 +162,14 @@ def raw_input_event_worker():
mouse_spi_packet_dict.clear()
pcard_spi.xfer(to_transfer)
# if GPIO.event_detected(SLAVE_REQ_PIN):
# slave_result = None
# for x in range(2):
# slave_result = pcard_spi.xfer(make_spi_msg_ack())
# print(slave_result)
# if slave_result[SPI_BUF_INDEX_MAGIC] == SPI_MISO_MAGIC and slave_result[SPI_BUF_INDEX_MSG_TYPE] == SPI_MISO_MSG_KB_LED_REQ:
# change_kb_led(slave_result[3])
# change_kb_led(slave_result[3])
if GPIO.event_detected(SLAVE_REQ_PIN):
slave_result = None
for x in range(2):
slave_result = pcard_spi.xfer(make_spi_msg_ack())
print(int(time.time()), slave_result)
if slave_result[SPI_BUF_INDEX_MAGIC] == SPI_MISO_MAGIC and slave_result[SPI_BUF_INDEX_MSG_TYPE] == SPI_MISO_MSG_KB_LED_REQ:
change_kb_led(slave_result[3])
change_kb_led(slave_result[3])
def usb_device_scan_worker():
print("usb_device_scan_worker started")