Skip to content

Commit

Permalink
USB HID keyboard support
Browse files Browse the repository at this point in the history
  • Loading branch information
WiseLord committed Feb 23, 2019
1 parent fa86f43 commit 315d67f
Show file tree
Hide file tree
Showing 30 changed files with 7,043 additions and 10 deletions.
28 changes: 23 additions & 5 deletions Makefile
Expand Up @@ -115,7 +115,19 @@ C_SOURCES += tuner/stations.c
C_SOURCES += tuner/tuner.c
C_DEFS += $(addprefix -D_, $(TUNER_LIST))

# USB source files
C_SOURCES += \
usb/usbd_amp.c \
usb/usbd_conf.c \
usb/usbd_desc.c \
usb/usbhid.c

C_INCLUDES += \
-Iusb

C_SOURCES += \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dma.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_exti.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_gpio.c \
Expand All @@ -125,18 +137,24 @@ C_SOURCES += \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_rtc.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_spi.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c \
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c \
drivers/STM32_USB_Device_Library/Core/Src/usbd_core.c \
drivers/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c \
drivers/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c \
system/system_stm32f1xx.c

C_INCLUDES = \
C_INCLUDES += \
-Idrivers/STM32F1xx_HAL_Driver/Inc \
-Idrivers/STM32_USB_Device_Library/Core/Inc \
-Idrivers/CMSIS/Device/ST/STM32F1xx/Include \
-Idrivers/CMSIS/Include
-Idrivers/CMSIS/Include \
-Isystem

AS_DEFS =
AS_DEFS +=

ASM_SOURCES = \
system/startup_stm32f103xb.s
ASM_SOURCES += \
system/startup_stm32f103xb.s

# Build directory
BUILD_DIR = build
Expand Down
7 changes: 7 additions & 0 deletions actions.c
Expand Up @@ -16,6 +16,7 @@
#include "swtimers.h"
#include "tuner/stations.h"
#include "tuner/tuner.h"
#include "usb/usbhid.h"

static void actionGetButtons(void);
static void actionGetEncoder(void);
Expand Down Expand Up @@ -703,6 +704,12 @@ void actionHandle(bool visible)
tunerMove(TUNER_DIR_DOWN);
}
actionSetScreen(SCREEN_TUNER, 5000);
} else if (inType == IN_PC) {
if (action.value > 0) {
usbHidSendKey(HIDKEY_MEDIA_NEXTSONG);
} else {
usbHidSendKey(HIDKEY_MEDIA_PREVIOUSSONG);
}
}
break;

Expand Down
23 changes: 23 additions & 0 deletions ampcontrol-f103.files
Expand Up @@ -115,6 +115,10 @@ drivers/CMSIS/Include/cmsis_gcc.h
drivers/CMSIS/Include/core_cm3.h
drivers/CMSIS/Include/core_cmFunc.h
drivers/CMSIS/Include/core_cmInstr.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_def.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd_ex.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_adc.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_bus.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_cortex.h
Expand All @@ -137,6 +141,8 @@ drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usart.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_usb.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_utils.h
drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_ll_wwdg.h
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_adc.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_crc.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_dac.c
Expand All @@ -154,6 +160,13 @@ drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_tim.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usart.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c
drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_utils.c
drivers/STM32_USB_Device_Library/Core/Inc/usbd_core.h
drivers/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h
drivers/STM32_USB_Device_Library/Core/Inc/usbd_def.h
drivers/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h
drivers/STM32_USB_Device_Library/Core/Src/usbd_core.c
drivers/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
drivers/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c
eemap.c
eemap.h
eemul.c
Expand Down Expand Up @@ -208,3 +221,13 @@ tuner/tea5767_regs.h
tuner/tuner.c
tuner/tuner.h
tuner/tunerdefs.h
usb/hidkeys.h
usb/stm32f1xx_hal_conf.h
usb/usbd_amp.c
usb/usbd_amp.h
usb/usbd_conf.c
usb/usbd_conf.h
usb/usbd_desc.c
usb/usbd_desc.h
usb/usbhid.c
usb/usbhid.h
2 changes: 2 additions & 0 deletions ampcontrol-f103.includes
Expand Up @@ -2,3 +2,5 @@
drivers/CMSIS/Device/ST/STM32F1xx/Include
drivers/CMSIS/Include
drivers/STM32F1xx_HAL_Driver/Inc
drivers/STM32_USB_Device_Library/Core/Inc
usb

0 comments on commit 315d67f

Please sign in to comment.