├── .code_review_properties ├── .cproject ├── .gitignore ├── .mxproject ├── .project ├── .settings ├── com.atollic.truestudio.debug.hardware_device.prefs ├── language.settings.xml └── org.eclipse.cdt.managedbuilder.core.prefs ├── Drivers ├── CMSIS │ ├── Device │ │ └── ST │ │ │ └── STM32F1xx │ │ │ ├── Include │ │ │ ├── stm32f100xb.h │ │ │ ├── stm32f100xe.h │ │ │ ├── stm32f101x6.h │ │ │ ├── stm32f101xb.h │ │ │ ├── stm32f101xe.h │ │ │ ├── stm32f101xg.h │ │ │ ├── stm32f102x6.h │ │ │ ├── stm32f102xb.h │ │ │ ├── stm32f103x6.h │ │ │ ├── stm32f103xb.h │ │ │ ├── stm32f103xe.h │ │ │ ├── stm32f103xg.h │ │ │ ├── stm32f105xc.h │ │ │ ├── stm32f107xc.h │ │ │ ├── stm32f1xx.h │ │ │ └── system_stm32f1xx.h │ │ │ └── Source │ │ │ └── Templates │ │ │ ├── gcc │ │ │ └── startup_stm32f103x6.s │ │ │ └── system_stm32f1xx.c │ └── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h └── STM32F1xx_HAL_Driver │ ├── Inc │ ├── Legacy │ │ └── stm32_hal_legacy.h │ ├── stm32f1xx_hal.h │ ├── stm32f1xx_hal_adc.h │ ├── stm32f1xx_hal_adc_ex.h │ ├── stm32f1xx_hal_cortex.h │ ├── stm32f1xx_hal_def.h │ ├── stm32f1xx_hal_dma.h │ ├── stm32f1xx_hal_dma_ex.h │ ├── stm32f1xx_hal_flash.h │ ├── stm32f1xx_hal_flash_ex.h │ ├── stm32f1xx_hal_gpio.h │ ├── stm32f1xx_hal_gpio_ex.h │ ├── stm32f1xx_hal_pcd.h │ ├── stm32f1xx_hal_pcd_ex.h │ ├── stm32f1xx_hal_pwr.h │ ├── stm32f1xx_hal_rcc.h │ ├── stm32f1xx_hal_rcc_ex.h │ ├── stm32f1xx_hal_tim.h │ ├── stm32f1xx_hal_tim_ex.h │ └── stm32f1xx_ll_usb.h │ └── Src │ ├── stm32f1xx_hal.c │ ├── stm32f1xx_hal_adc.c │ ├── stm32f1xx_hal_adc_ex.c │ ├── stm32f1xx_hal_cortex.c │ ├── stm32f1xx_hal_dma.c │ ├── stm32f1xx_hal_flash.c │ ├── stm32f1xx_hal_flash_ex.c │ ├── stm32f1xx_hal_gpio.c │ ├── stm32f1xx_hal_pcd.c │ ├── stm32f1xx_hal_pcd_ex.c │ ├── stm32f1xx_hal_pwr.c │ ├── stm32f1xx_hal_rcc.c │ ├── stm32f1xx_hal_rcc_ex.c │ ├── stm32f1xx_hal_tim.c │ ├── stm32f1xx_hal_tim_ex.c │ └── stm32f1xx_ll_usb.c ├── Inc ├── flash_store.h ├── keypad.h ├── periph_init.h ├── rotary.h ├── stm32f1xx_hal_conf.h ├── stm32f1xx_it.h ├── usb_device.h ├── usbd_conf.h ├── usbd_custom_hid_if.h └── usbd_desc.h ├── LICENSE ├── Middlewares └── ST │ └── STM32_USB_Device_Library │ ├── Class │ └── CustomHID │ │ ├── Inc │ │ └── usbd_customhid.h │ │ └── Src │ │ └── usbd_customhid.c │ └── Core │ ├── Inc │ ├── usbd_core.h │ ├── usbd_ctlreq.h │ ├── usbd_def.h │ └── usbd_ioreq.h │ └── Src │ ├── usbd_core.c │ ├── usbd_ctlreq.c │ └── usbd_ioreq.c ├── OSHStudio ├── Images │ ├── 1053081_zps20151924.jpg │ ├── Hardware.ico │ ├── MDB_pic.jpg │ ├── OFF.png │ ├── OFF_small.png │ ├── OFF_small_t.png │ ├── ON_2.png │ ├── ON_small.png │ ├── ON_small_t.png │ ├── boardTypeII.jpg │ ├── cropped-OK-big-green-button.png │ ├── down-pointing-small-red-triangle.png │ ├── dpad.png │ ├── dpad_cb.png │ ├── dpad_cbl.png │ ├── dpad_cl.png │ ├── dpad_clt.png │ ├── dpad_cr.png │ ├── dpad_crb.png │ ├── dpad_ct.png │ ├── dpad_ctr.png │ └── openhardware.ico ├── OSHStudio.pro ├── OSHStudio.pro.user ├── OSHStudio.pro.user.4.8-pre1 ├── OSHStudio.pro.user.c218a21 ├── board_types.cpp ├── draw_helps.cpp ├── file_ops.cpp ├── get_put_config.cpp ├── hid.c ├── hidapi.h ├── main.cpp ├── osh.rc ├── osha2bw.cpp ├── osha2bw.h ├── osha2bw.ui ├── oshaxiswca.cpp ├── oshaxiswca.h ├── oshaxiswca.ui ├── oshbuttonw.cpp ├── oshbuttonw.h ├── oshbuttonw.ui ├── oshpincombobox.cpp ├── oshpincombobox.h ├── oshpincombobox.ui ├── oshshapesw.cpp ├── oshshapesw.h ├── oshshapesw.ui ├── oshsingenc.cpp ├── oshsingenc.h ├── oshsingenc.ui ├── oshstudio.cpp ├── oshstudio.cpp.autosave.lU9852 ├── oshstudio.h ├── oshstudio.qrc ├── oshstudio.ui ├── worker.cpp └── worker.h ├── README.md ├── STM32F103C6_FLASH.ld ├── STM32Mini.png ├── Src ├── flash_store.c ├── keypad.c ├── main.c ├── periph_init.c ├── rotary.c ├── stm32f1xx_it.c ├── usb_device.c ├── usbd_conf.c ├── usbd_custom_hid_if.c └── usbd_desc.c ├── Wiring_Scheme.jpg └── common_types ├── common_defines.h ├── common_functions.h └── common_structs.h /.code_review_properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | property.default.description 5 | 6 | 1970-01-01 :: 00:00:00:000 GMT-10:00 7 | review 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /Debug 2 | /buttoncontroller.elf (1).launch 3 | /buttoncontroller.elf.launch 4 | /buttoncontroller.ioc 5 | /OSH_PB_controller.elf.launch 6 | /build-OSHStudio-Desktop_Qt_5_9_2_MinGW_32bit-Release 7 | /build-OSHStudio-Desktop_Qt_5_10_1_MinGW_32bit-Debug/ 8 | /build-OSHStudio-Desktop_Qt_5_10_1_MinGW_32bit-Release/ 9 | /build-OSHStudio-Desktop_Qt_5_10_1_MinGW_32bit-Profile/ 10 | /build-OSHStudio-Desktop_Qt_5_13_0_MinGW_32_bit-Debug/ 11 | /build-OSHStudio-Desktop_Qt_5_13_0_MinGW_32_bit-Profile/ 12 | /build-OSHStudio-Desktop_Qt_5_13_0_MinGW_32_bit-Release/ 13 | -------------------------------------------------------------------------------- /.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousGenFiles] 2 | HeaderPath=C:/Users/John/Atollic/TrueSTUDIO/ARM_workspace_5.4/buttoncontroller/Inc 3 | SourcePath=C:/Users/John/Atollic/TrueSTUDIO/ARM_workspace_5.4/buttoncontroller/Src 4 | SourceFiles=usb_device.h;usbd_conf.h;usbd_desc.h;usbd_custom_hid_if.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;mxconstants.h;usb_device.c;usbd_conf.c;usbd_desc.c;usbd_custom_hid_if.c;stm32f1xx_it.c;stm32f1xx_hal_msp.c;main.c; 5 | HeaderFiles=usb_device.h;usbd_conf.h;usbd_desc.h;usbd_custom_hid_if.h;stm32f1xx_it.h;stm32f1xx_hal_conf.h;mxconstants.h; 6 | 7 | [PreviousLibFiles] 8 | LibFiles=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_usb.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.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_rcc.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_rcc_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_gpio_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_dma.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_cortex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pwr.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_flash_ex.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim.h;Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_tim_ex.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_def.h;Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h;Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc/usbd_customhid.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_usb.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c;Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h;Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h; 9 | 10 | [PreviousUsedTStudioFiles] 11 | HeaderPath=..\Drivers\STM32F1xx_HAL_Driver\Inc;..\Drivers\STM32F1xx_HAL_Driver\Inc\Legacy;..\Middlewares\ST\STM32_USB_Device_Library\Core\Inc;..\Middlewares\ST\STM32_USB_Device_Library\Class\CustomHID\Inc;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\ST\STM32F1xx\Include; 12 | SourceFiles=../Src/main.c;../Src/usb_device.c;../Src/usbd_conf.c;../Src/usbd_desc.c;../Src/usbd_custom_hid_if.c;../Src/stm32f1xx_it.c;../Src/stm32f1xx_hal_msp.c;../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_usb.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c;../Drivers/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c;../Drivers/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103x6.s;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_core.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c;../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c;../Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Src/usbd_customhid.c; 13 | 14 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | OSH_PB_Controller 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | ?children? 14 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| 15 | 16 | 17 | ?name? 18 | 19 | 20 | 21 | org.eclipse.cdt.make.core.append_environment 22 | true 23 | 24 | 25 | org.eclipse.cdt.make.core.buildArguments 26 | 27 | 28 | 29 | org.eclipse.cdt.make.core.buildCommand 30 | make 31 | 32 | 33 | org.eclipse.cdt.make.core.buildLocation 34 | ${workspace_loc:/STM32100B-EVAL/Debug} 35 | 36 | 37 | org.eclipse.cdt.make.core.contents 38 | org.eclipse.cdt.make.core.activeConfigSettings 39 | 40 | 41 | org.eclipse.cdt.make.core.enableAutoBuild 42 | false 43 | 44 | 45 | org.eclipse.cdt.make.core.enableCleanBuild 46 | true 47 | 48 | 49 | org.eclipse.cdt.make.core.enableFullBuild 50 | true 51 | 52 | 53 | org.eclipse.cdt.make.core.stopOnError 54 | true 55 | 56 | 57 | org.eclipse.cdt.make.core.useDefaultBuildCmd 58 | true 59 | 60 | 61 | 62 | 63 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 64 | 65 | 66 | 67 | 68 | 69 | org.eclipse.cdt.core.cnature 70 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 72 | 73 | 74 | -------------------------------------------------------------------------------- /.settings/com.atollic.truestudio.debug.hardware_device.prefs: -------------------------------------------------------------------------------- 1 | BOARD=None 2 | CODE_LOCATION=FLASH 3 | ENDIAN=Little-endian 4 | MCU=STM32F103C6 5 | MCU_VENDOR=STMicroelectronics 6 | MODEL=Lite 7 | PROBE=ST-LINK 8 | PROJECT_FORMAT_VERSION=2 9 | TARGET=ARM\u00AE 10 | VERSION=4.1.0 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.managedbuilder.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/CPATH/delimiter=; 3 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/CPATH/operation=remove 4 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/C_INCLUDE_PATH/delimiter=; 5 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/C_INCLUDE_PATH/operation=remove 6 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/append=true 7 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/appendContributed=true 8 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/LIBRARY_PATH/delimiter=; 9 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/LIBRARY_PATH/operation=remove 10 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/append=true 11 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/appendContributed=true 12 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xb.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f100xe.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101x6.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xb.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xe.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f101xg.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102x6.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f102xb.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103x6.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xb.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xe.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f103xg.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f105xc.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f107xc.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Drivers/CMSIS/Device/ST/STM32F1xx/Include/stm32f1xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32F1xx/Include/system_stm32f1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V4.2.0 6 | * @date 31-March-2017 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /** @addtogroup CMSIS 39 | * @{ 40 | */ 41 | 42 | /** @addtogroup stm32f10x_system 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief Define to prevent recursive inclusion 48 | */ 49 | #ifndef __SYSTEM_STM32F10X_H 50 | #define __SYSTEM_STM32F10X_H 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | /** @addtogroup STM32F10x_System_Includes 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @addtogroup STM32F10x_System_Exported_types 66 | * @{ 67 | */ 68 | 69 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 70 | extern const uint8_t AHBPrescTable[16U]; /*!< AHB prescalers table values */ 71 | extern const uint8_t APBPrescTable[8U]; /*!< APB prescalers table values */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @addtogroup STM32F10x_System_Exported_Constants 78 | * @{ 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @addtogroup STM32F10x_System_Exported_Macros 86 | * @{ 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @addtogroup STM32F10x_System_Exported_Functions 94 | * @{ 95 | */ 96 | 97 | extern void SystemInit(void); 98 | extern void SystemCoreClockUpdate(void); 99 | /** 100 | * @} 101 | */ 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /*__SYSTEM_STM32F10X_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 117 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. October 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #ifndef _ARM_COMMON_TABLES_H 42 | #define _ARM_COMMON_TABLES_H 43 | 44 | #include "arm_math.h" 45 | 46 | extern const uint16_t armBitRevTable[1024]; 47 | extern const q15_t armRecipTableQ15[64]; 48 | extern const q31_t armRecipTableQ31[64]; 49 | /* extern const q31_t realCoefAQ31[1024]; */ 50 | /* extern const q31_t realCoefBQ31[1024]; */ 51 | extern const float32_t twiddleCoef_16[32]; 52 | extern const float32_t twiddleCoef_32[64]; 53 | extern const float32_t twiddleCoef_64[128]; 54 | extern const float32_t twiddleCoef_128[256]; 55 | extern const float32_t twiddleCoef_256[512]; 56 | extern const float32_t twiddleCoef_512[1024]; 57 | extern const float32_t twiddleCoef_1024[2048]; 58 | extern const float32_t twiddleCoef_2048[4096]; 59 | extern const float32_t twiddleCoef_4096[8192]; 60 | #define twiddleCoef twiddleCoef_4096 61 | extern const q31_t twiddleCoef_16_q31[24]; 62 | extern const q31_t twiddleCoef_32_q31[48]; 63 | extern const q31_t twiddleCoef_64_q31[96]; 64 | extern const q31_t twiddleCoef_128_q31[192]; 65 | extern const q31_t twiddleCoef_256_q31[384]; 66 | extern const q31_t twiddleCoef_512_q31[768]; 67 | extern const q31_t twiddleCoef_1024_q31[1536]; 68 | extern const q31_t twiddleCoef_2048_q31[3072]; 69 | extern const q31_t twiddleCoef_4096_q31[6144]; 70 | extern const q15_t twiddleCoef_16_q15[24]; 71 | extern const q15_t twiddleCoef_32_q15[48]; 72 | extern const q15_t twiddleCoef_64_q15[96]; 73 | extern const q15_t twiddleCoef_128_q15[192]; 74 | extern const q15_t twiddleCoef_256_q15[384]; 75 | extern const q15_t twiddleCoef_512_q15[768]; 76 | extern const q15_t twiddleCoef_1024_q15[1536]; 77 | extern const q15_t twiddleCoef_2048_q15[3072]; 78 | extern const q15_t twiddleCoef_4096_q15[6144]; 79 | extern const float32_t twiddleCoef_rfft_32[32]; 80 | extern const float32_t twiddleCoef_rfft_64[64]; 81 | extern const float32_t twiddleCoef_rfft_128[128]; 82 | extern const float32_t twiddleCoef_rfft_256[256]; 83 | extern const float32_t twiddleCoef_rfft_512[512]; 84 | extern const float32_t twiddleCoef_rfft_1024[1024]; 85 | extern const float32_t twiddleCoef_rfft_2048[2048]; 86 | extern const float32_t twiddleCoef_rfft_4096[4096]; 87 | 88 | 89 | /* floating-point bit reversal tables */ 90 | #define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 ) 91 | #define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 ) 92 | #define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 ) 93 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 ) 94 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 ) 95 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 ) 96 | #define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800) 97 | #define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808) 98 | #define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032) 99 | 100 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH]; 101 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH]; 102 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH]; 103 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; 104 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; 105 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; 106 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH]; 107 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH]; 108 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH]; 109 | 110 | /* fixed-point bit reversal tables */ 111 | #define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 ) 112 | #define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 ) 113 | #define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 ) 114 | #define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 ) 115 | #define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 ) 116 | #define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 ) 117 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 ) 118 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) 119 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) 120 | 121 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH]; 122 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH]; 123 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH]; 124 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH]; 125 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH]; 126 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH]; 127 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; 128 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; 129 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; 130 | 131 | /* Tables for Fast Math Sine and Cosine */ 132 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; 133 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; 134 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; 135 | 136 | #endif /* ARM_COMMON_TABLES_H */ 137 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; 50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; 51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; 52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; 53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; 54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; 55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; 56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; 57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; 58 | 59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; 60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; 61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; 62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; 63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; 64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; 65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; 66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; 67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; 68 | 69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; 70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; 71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; 72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; 73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; 74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; 75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; 76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; 77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMFUNC_H 42 | #define __CORE_CMFUNC_H 43 | 44 | 45 | /* ########################### Core Function Access ########################### */ 46 | /** \ingroup CMSIS_Core_FunctionInterface 47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@} end of CMSIS_Core_RegAccFunctions */ 86 | 87 | #endif /* __CORE_CMFUNC_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMINSTR_H 42 | #define __CORE_CMINSTR_H 43 | 44 | 45 | /* ########################## Core Instruction Access ######################### */ 46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface 47 | Access to dedicated instructions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 86 | 87 | #endif /* __CORE_CMINSTR_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMSIMD_H 42 | #define __CORE_CMSIMD_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* ################### Compiler specific Intrinsics ########################### */ 50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 51 | Access to dedicated SIMD instructions 52 | @{ 53 | */ 54 | 55 | /*------------------ RealView Compiler -----------------*/ 56 | #if defined ( __CC_ARM ) 57 | #include "cmsis_armcc.h" 58 | 59 | /*------------------ ARM Compiler V6 -------------------*/ 60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 61 | #include "cmsis_armcc_V6.h" 62 | 63 | /*------------------ GNU Compiler ----------------------*/ 64 | #elif defined ( __GNUC__ ) 65 | #include "cmsis_gcc.h" 66 | 67 | /*------------------ ICC Compiler ----------------------*/ 68 | #elif defined ( __ICCARM__ ) 69 | #include 70 | 71 | /*------------------ TI CCS Compiler -------------------*/ 72 | #elif defined ( __TMS470__ ) 73 | #include 74 | 75 | /*------------------ TASKING Compiler ------------------*/ 76 | #elif defined ( __TASKING__ ) 77 | /* 78 | * The CMSIS functions have been implemented as intrinsics in the compiler. 79 | * Please use "carm -?i" to get an up to date list of all intrinsics, 80 | * Including the CMSIS ones. 81 | */ 82 | 83 | /*------------------ COSMIC Compiler -------------------*/ 84 | #elif defined ( __CSMC__ ) 85 | #include 86 | 87 | #endif 88 | 89 | /*@} end of group CMSIS_SIMD_intrinsics */ 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __CORE_CMSIMD_H */ 97 | -------------------------------------------------------------------------------- /Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @version V1.1.1 6 | * @date 12-May-2017 7 | * @brief Header file of Extended PCD HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F1xx_HAL_PCD_EX_H 40 | #define __STM32F1xx_HAL_PCD_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F102x6) || defined(STM32F102xB) || \ 47 | defined(STM32F103x6) || defined(STM32F103xB) || \ 48 | defined(STM32F103xE) || defined(STM32F103xG) || \ 49 | defined(STM32F105xC) || defined(STM32F107xC) 50 | 51 | /* Includes ------------------------------------------------------------------*/ 52 | #include "stm32f1xx_hal_def.h" 53 | 54 | /** @addtogroup STM32F1xx_HAL_Driver 55 | * @{ 56 | */ 57 | 58 | /** @addtogroup PCDEx 59 | * @{ 60 | */ 61 | 62 | /* Exported types ------------------------------------------------------------*/ 63 | /* Exported constants --------------------------------------------------------*/ 64 | /* Exported macros -----------------------------------------------------------*/ 65 | /* Exported functions --------------------------------------------------------*/ 66 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 67 | * @{ 68 | */ 69 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 70 | * @{ 71 | */ 72 | #if defined (USB_OTG_FS) 73 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 74 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 75 | #endif /* USB_OTG_FS */ 76 | 77 | #if defined (USB) 78 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, 79 | uint16_t ep_addr, 80 | uint16_t ep_kind, 81 | uint32_t pmaadress); 82 | #endif /* USB */ 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @addtogroup PCDEx_Exported_Functions_Group2 Peripheral State functions 88 | * @{ 89 | */ 90 | void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state); 91 | /** 92 | * @} 93 | */ 94 | /** 95 | * @} 96 | */ 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | #endif /* STM32F102x6 || STM32F102xB || */ 105 | /* STM32F103x6 || STM32F103xB || */ 106 | /* STM32F103xE || STM32F103xG || */ 107 | /* STM32F105xC || STM32F107xC */ 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | 114 | #endif /* __STM32F1xx_HAL_PCD_EX_H */ 115 | 116 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 117 | -------------------------------------------------------------------------------- /Inc/flash_store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : flash_store.h 4 | * @author : Dmitry Skulkin 5 | * @version : 0.1 6 | * @brief : Flash reading/writing library 7 | * 8 | * ---------------------------------------------------------------------------------- 9 | * Copyright (c) 2016 Dmitry Skulkin * 10 | * * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 12 | * of this software and associated documentation files (the "Software"), to deal * 13 | * in the Software without restriction, including without limitation the rights * 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 15 | * copies of the Software, and to permit persons to whom the Software is * 16 | * furnished to do so, subject to the following conditions: * 17 | * * 18 | * The above copyright notice and this permission notice shall be included in all * 19 | * copies or substantial portions of the Software. * 20 | * * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 27 | * SOFTWARE. * 28 | * ---------------------------------------------------------------------------------- 29 | * */ 30 | 31 | #ifndef FLASH_STORE_H_ 32 | #define FLASH_STORE_H_ 33 | 34 | #include 35 | #include 36 | 37 | #define FLASHSIZEREG 0x1FFFF7E0 38 | 39 | //#define FLASHBASE 0x08000000 40 | //#define FLASH_KEY1 ((uint32_t)0x45670123) 41 | //#define FLASH_KEY2 ((uint32_t)0xCDEF89AB) 42 | 43 | uint16_t * get_lastpage_addr(uint16_t * flash_size_reg_addr); 44 | void get_config(void); 45 | void write_flash(void); 46 | 47 | #endif /* FLASH_STORE_H_ */ 48 | -------------------------------------------------------------------------------- /Inc/keypad.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : keypad.h 4 | * @author : Dmitry Skulkin 5 | * @version : 0.1 6 | * @brief : Keypad/buttons support library 7 | * 8 | * ---------------------------------------------------------------------------------- 9 | * Copyright (c) 2016 Dmitry Skulkin * 10 | * * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 12 | * of this software and associated documentation files (the "Software"), to deal * 13 | * in the Software without restriction, including without limitation the rights * 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 15 | * copies of the Software, and to permit persons to whom the Software is * 16 | * furnished to do so, subject to the following conditions: * 17 | * * 18 | * The above copyright notice and this permission notice shall be included in all * 19 | * copies or substantial portions of the Software. * 20 | * * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 27 | * SOFTWARE. * 28 | * ---------------------------------------------------------------------------------- 29 | * */ 30 | 31 | #ifndef KEYPAD_H_ 32 | #define KEYPAD_H_ 33 | 34 | #include 35 | #include "periph_init.h" 36 | 37 | //#define MAXBUTTONS 64 38 | 39 | 40 | struct keypad { 41 | uint8_t pressed; 42 | uint8_t prev_state; 43 | uint8_t current_state; 44 | uint64_t time_pressed; 45 | }; 46 | 47 | typedef enum { 48 | smpl_button, 49 | a2b_button, 50 | rotswitch, 51 | } button_type; 52 | 53 | void CheckRows(uint8_t column, uint8_t type); 54 | void CheckButtons(void); 55 | void SetButtonState(uint8_t i, GPIO_PinState rowstate, button_type type); 56 | void fill_packets_4_buttons(void); 57 | 58 | #endif /* KEYPAD_H_ */ 59 | -------------------------------------------------------------------------------- /Inc/periph_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : periph_init.h 4 | * @author : Dmitry Skulkin 5 | * @version : 0.1 6 | * @brief : Periphery initialization library 7 | * 8 | * ---------------------------------------------------------------------------------- 9 | * Copyright (c) 2016 Dmitry Skulkin * 10 | * * 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 12 | * of this software and associated documentation files (the "Software"), to deal * 13 | * in the Software without restriction, including without limitation the rights * 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 15 | * copies of the Software, and to permit persons to whom the Software is * 16 | * furnished to do so, subject to the following conditions: * 17 | * * 18 | * The above copyright notice and this permission notice shall be included in all * 19 | * copies or substantial portions of the Software. * 20 | * * 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 22 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 23 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 24 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 25 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 26 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 27 | * SOFTWARE. * 28 | * ---------------------------------------------------------------------------------- 29 | * */ 30 | 31 | #ifndef PERIPH_INIT_H_ 32 | #define PERIPH_INIT_H_ 33 | 34 | #include 35 | #include 36 | #include 37 | #include "../common_types/common_structs.h" 38 | 39 | //#define USEDPINS 32 40 | //#define AXISES 6 41 | #define ADC_BUFF_SIZE 12 42 | #define UNIQUEIDREG 0x1FFFF7E8 43 | #define MOUSEMIN -10 44 | #define MOUSEMAX 10 45 | #define MOUSE_THRESHOLD 1 46 | #define FIRMAXWINDOWSSIZE 7 47 | 48 | #define _GPIOA_BASE 0x40010800 49 | #define _GPIOB_BASE 0x40010C00 50 | #define _GPIOC_BASE 0x40011000 51 | #define CRL_OFFSET 0x00 52 | #define CRH_OFFSET 0x04 53 | #define IDR_OFFSET 0x08 54 | #define BSRR_OFFSET 0x10 55 | #define GPIOA_CRL (_GPIOA_BASE+CRL_OFFSET) 56 | #define GPIOA_CRH (_GPIOA_BASE+CRH_OFFSET) 57 | #define GPIOA_BSRR (_GPIOA_BASE+BSRR_OFFSET) 58 | #define GPIOA_IDR (_GPIOA_BASE+IDR_OFFSET) 59 | #define GPIOB_CRL (_GPIOB_BASE+CRL_OFFSET) 60 | #define GPIOB_CRH (_GPIOB_BASE+CRH_OFFSET) 61 | #define GPIOB_BSRR (_GPIOB_BASE+BSRR_OFFSET) 62 | #define GPIOB_IDR (_GPIOB_BASE+IDR_OFFSET) 63 | #define GPIOC_CRL (_GPIOC_BASE+CRL_OFFSET) 64 | #define GPIOC_CRH (_GPIOC_BASE+CRH_OFFSET) 65 | #define GPIOC_BSRR (_GPIOC_BASE+BSRR_OFFSET) 66 | #define GPIOC_IDR (_GPIOC_BASE+IDR_OFFSET) 67 | 68 | 69 | 70 | struct pin_conf { 71 | // pintype pin_type; 72 | uint32_t * conf_reg_addr; 73 | uint32_t * bsrr_reg_addr; 74 | uint32_t * idr_reg_addr; 75 | uint8_t pin_number; 76 | }; 77 | 78 | struct rot_conf { 79 | pintype PINA_Type; 80 | pintype PINB_Type; 81 | uint32_t * PINA_IDR; 82 | uint32_t * PINB_IDR; 83 | // uint16_t PINA; 84 | // uint16_t PINB; 85 | uint16_t PINAmask; 86 | uint16_t PINBmask; 87 | }; 88 | 89 | //struct axis_conf { 90 | // uint8_t calib_min_lowbyte; 91 | // uint8_t calib_min_hibyte; 92 | // uint8_t calib_max_lowbyte; 93 | // uint8_t calib_max_hibyte; 94 | // uint8_t special; 95 | // uint32_t calib_min; 96 | // uint32_t calib_max; 97 | //}; 98 | 99 | struct rot_switches { 100 | uint8_t state; 101 | uint64_t timepressed; 102 | }; 103 | 104 | void gpio_init(void); 105 | void gpio_ports_config(void); 106 | void adc_init(void); 107 | void sysclock_init(void); 108 | void NVIC_init(void); 109 | void processing_axises(uint8_t axis, uint8_t Kstab, uint8_t i); 110 | void fill_packets_4_axises(void); 111 | uint32_t map(uint32_t x, uint32_t in_min, uint32_t in_max, uint32_t out_min, uint32_t out_max); 112 | void custom_usb_config(void); 113 | uint8_t uint8_to_32(uint8_t value); 114 | void periph_deinit(void); 115 | uint16_t getSplinePoint(uint16_t p1, uint16_t p2, uint16_t distance); 116 | uint16_t fir_smoothing(uint16_t orig_value, uint16_t input, uint8_t window_size); 117 | 118 | #endif /* PERIPH_INIT_H_ */ 119 | -------------------------------------------------------------------------------- /Inc/rotary.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : rotary.h 4 | * @author : Dmitry Skulkin 5 | * @version : 0.1 6 | * @brief : Rotary Encoders support library 7 | * 8 | * 9 | * ---------------------------------------------------------------------------------- 10 | * Copyright (c) 2016 Dmitry Skulkin * 11 | * * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 13 | * of this software and associated documentation files (the "Software"), to deal * 14 | * in the Software without restriction, including without limitation the rights * 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 16 | * copies of the Software, and to permit persons to whom the Software is * 17 | * furnished to do so, subject to the following conditions: * 18 | * * 19 | * The above copyright notice and this permission notice shall be included in all * 20 | * copies or substantial portions of the Software. * 21 | * * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 28 | * SOFTWARE. * 29 | * ---------------------------------------------------------------------------------- 30 | * */ 31 | 32 | 33 | #ifndef ROTARY_H_ 34 | #define ROTARY_H_ 35 | 36 | #include 37 | #include "periph_init.h" 38 | 39 | //#define ROTTIME 50 40 | //#define ROTDEBOUNCE 10 41 | 42 | #define DIR_CCW 0x10 43 | #define DIR_CW 0x20 44 | 45 | unsigned char rotary_process(uint8_t _i, pintype type, uint32_t *PINA_Addr, uint32_t *PINB_Addr, uint16_t PINA, uint16_t PINB); 46 | void CheckRotaries(void); 47 | 48 | struct rots { 49 | volatile uint8_t pressed; 50 | volatile uint64_t time_pressed; 51 | volatile uint8_t state; 52 | volatile uint8_t previous_state; 53 | }; 54 | 55 | 56 | #endif /* ROTARY_H_ */ 57 | -------------------------------------------------------------------------------- /Inc/stm32f1xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f1xx_it.h 4 | * @brief This file contains the headers of the interrupt handlers. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2016 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Define to prevent recursive inclusion -------------------------------------*/ 35 | #ifndef __STM32F1xx_IT_H 36 | #define __STM32F1xx_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | /* Exported types ------------------------------------------------------------*/ 44 | /* Exported constants --------------------------------------------------------*/ 45 | /* Exported macro ------------------------------------------------------------*/ 46 | /* Exported functions ------------------------------------------------------- */ 47 | 48 | void NMI_Handler(void); 49 | void HardFault_Handler(void); 50 | void MemManage_Handler(void); 51 | void BusFault_Handler(void); 52 | void UsageFault_Handler(void); 53 | void DebugMon_Handler(void); 54 | void SysTick_Handler(void); 55 | void DMA1_Channel1_IRQHandler(void); 56 | void USB_LP_CAN1_RX0_IRQHandler(void); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* __STM32F1xx_IT_H */ 63 | 64 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 65 | -------------------------------------------------------------------------------- /Inc/usb_device.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file : USB_DEVICE 4 | * @version : v1.0_Cube 5 | * @brief : Header for usb_device file. 6 | ****************************************************************************** 7 | * COPYRIGHT(c) 2016 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | #ifndef __usb_device_H 35 | #define __usb_device_H 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /* Includes ------------------------------------------------------------------*/ 41 | #include "stm32f1xx.h" 42 | #include "stm32f1xx_hal.h" 43 | #include "usbd_def.h" 44 | 45 | extern USBD_HandleTypeDef hUsbDeviceFS; 46 | 47 | /* USB_Device init function */ 48 | void MX_USB_DEVICE_Init(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | #endif /*__usb_device_H */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 64 | -------------------------------------------------------------------------------- /Inc/usbd_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file : usbd_conf.h 4 | * @version : v1.0_Cube 5 | * @brief : Header for usbd_conf file. 6 | ****************************************************************************** 7 | * COPYRIGHT(c) 2016 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | #ifndef __USBD_CONF__H__ 35 | #define __USBD_CONF__H__ 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include 41 | #include 42 | #include 43 | #include "stm32f1xx.h" 44 | #include "stm32f1xx_hal.h" 45 | #include "usbd_def.h" 46 | 47 | /** @addtogroup USBD_OTG_DRIVER 48 | * @{ 49 | */ 50 | 51 | /** @defgroup USBD_CONF 52 | * @brief usb otg low level driver configuration file 53 | * @{ 54 | */ 55 | 56 | /** @defgroup USBD_CONF_Exported_Defines 57 | * @{ 58 | */ 59 | 60 | /*---------- -----------*/ 61 | #define USBD_MAX_NUM_INTERFACES 1 62 | /*---------- -----------*/ 63 | #define USBD_MAX_NUM_CONFIGURATION 1 64 | /*---------- -----------*/ 65 | #define USBD_MAX_STR_DESC_SIZ 512 66 | /*---------- -----------*/ 67 | #define USBD_SUPPORT_USER_STRING 1 68 | /*---------- -----------*/ 69 | #define USBD_DEBUG_LEVEL 0 70 | /*---------- -----------*/ 71 | #define USBD_SELF_POWERED 1 72 | /*---------- -----------*/ 73 | #define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 64 74 | /*---------- -----------*/ 75 | #define USBD_CUSTOM_HID_REPORT_DESC_SIZE 272 //248 //244 //213 //240 //190 //144 76 | /****************************************/ 77 | /* #define for FS and HS identification */ 78 | #define DEVICE_FS 0 79 | 80 | /** @defgroup USBD_Exported_Macros 81 | * @{ 82 | */ 83 | 84 | /* Memory management macros */ 85 | #define USBD_malloc (uint32_t *)USBD_static_malloc 86 | #define USBD_free USBD_static_free 87 | #define USBD_memset /* Not used */ 88 | #define USBD_memcpy /* Not used */ 89 | 90 | #define USBD_Delay HAL_Delay 91 | 92 | /* For footprint reasons and since only one allocation is handled in the HID class 93 | driver, the malloc/free is changed into a static allocation method */ 94 | void *USBD_static_malloc(uint32_t size); 95 | void USBD_static_free(void *p); 96 | 97 | /* DEBUG macros */ 98 | #if (USBD_DEBUG_LEVEL > 0) 99 | #define USBD_UsrLog(...) printf(__VA_ARGS__);\ 100 | printf("\n"); 101 | #else 102 | #define USBD_UsrLog(...) 103 | #endif 104 | 105 | 106 | #if (USBD_DEBUG_LEVEL > 1) 107 | 108 | #define USBD_ErrLog(...) printf("ERROR: ") ;\ 109 | printf(__VA_ARGS__);\ 110 | printf("\n"); 111 | #else 112 | #define USBD_ErrLog(...) 113 | #endif 114 | 115 | 116 | #if (USBD_DEBUG_LEVEL > 2) 117 | #define USBD_DbgLog(...) printf("DEBUG : ") ;\ 118 | printf(__VA_ARGS__);\ 119 | printf("\n"); 120 | #else 121 | #define USBD_DbgLog(...) 122 | #endif 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /** @defgroup USBD_CONF_Exported_Types 135 | * @{ 136 | */ 137 | /** 138 | * @} 139 | */ 140 | 141 | /** @defgroup USBD_CONF_Exported_Macros 142 | * @{ 143 | */ 144 | /** 145 | * @} 146 | */ 147 | 148 | /** @defgroup USBD_CONF_Exported_Variables 149 | * @{ 150 | */ 151 | /** 152 | * @} 153 | */ 154 | 155 | /** @defgroup USBD_CONF_Exported_FunctionsPrototype 156 | * @{ 157 | */ 158 | /** 159 | * @} 160 | */ 161 | #ifdef __cplusplus 162 | } 163 | #endif 164 | 165 | #endif //__USBD_CONF__H__ 166 | 167 | /** 168 | * @} 169 | */ 170 | 171 | /** 172 | * @} 173 | */ 174 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 175 | 176 | -------------------------------------------------------------------------------- /Inc/usbd_custom_hid_if.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file : usbd_custom_hid_if_if.h 4 | * @brief : header file for the usbd_custom_hid_if.c file 5 | ****************************************************************************** 6 | * COPYRIGHT(c) 2016 STMicroelectronics 7 | * 8 | * Redistribution and use in source and binary forms, with or without modification, 9 | * are permitted provided that the following conditions are met: 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 16 | * may be used to endorse or promote products derived from this software 17 | * without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | ****************************************************************************** 31 | */ 32 | 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | 35 | #ifndef __USBD_CUSTOM_HID_IF_H_ 36 | #define __USBD_CUSTOM_HID_IF_H_ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | /* Includes ------------------------------------------------------------------*/ 42 | #include "usbd_customhid.h" 43 | /* USER CODE BEGIN INCLUDE */ 44 | #include "periph_init.h" 45 | /* USER CODE END INCLUDE */ 46 | 47 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 48 | * @{ 49 | */ 50 | 51 | /** @defgroup USBD_CUSTOM_HID 52 | * @brief header 53 | * @{ 54 | */ 55 | 56 | /** @defgroup USBD_CUSTOM_HID_Exported_Defines 57 | * @{ 58 | */ 59 | /* USER CODE BEGIN EXPORTED_DEFINES */ 60 | /* USER CODE END EXPORTED_DEFINES */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup USBD_CUSTOM_HID_Exported_Types 67 | * @{ 68 | */ 69 | /* USER CODE BEGIN EXPORTED_TYPES */ 70 | /* USER CODE END EXPORTED_TYPES */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBD_CUSTOM_HID_Exported_Macros 77 | * @{ 78 | */ 79 | /* USER CODE BEGIN EXPORTED_MACRO */ 80 | /* USER CODE END EXPORTED_MACRO */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup USBD_CUSTOM_HID_Exported_Variables 87 | * @{ 88 | */ 89 | extern USBD_CUSTOM_HID_ItfTypeDef USBD_CustomHID_fops_FS; 90 | 91 | /* USER CODE BEGIN EXPORTED_VARIABLES */ 92 | /* USER CODE END EXPORTED_VARIABLES */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** @defgroup USBD_CUSTOM_HID_Exported_FunctionsPrototype 99 | * @{ 100 | */ 101 | 102 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */ 103 | /* USER CODE END EXPORTED_FUNCTIONS */ 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | #ifdef __cplusplus 117 | } 118 | #endif 119 | 120 | #endif /* __USBD_CUSTOM_HID_IF_H_ */ 121 | 122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 123 | -------------------------------------------------------------------------------- /Inc/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file : usbd_desc.h 4 | * @version : v1.0_Cube 5 | * @brief : Header for usbd_desc file. 6 | ****************************************************************************** 7 | * COPYRIGHT(c) 2016 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Define to prevent recursive inclusion -------------------------------------*/ 35 | #ifndef __USBD_DESC__H__ 36 | #define __USBD_DESC__H__ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | /* Includes ------------------------------------------------------------------*/ 42 | #include "usbd_def.h" 43 | 44 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USB_DESC 49 | * @brief general defines for the usb device library file 50 | * @{ 51 | */ 52 | 53 | /** @defgroup USB_DESC_Exported_Defines 54 | * @{ 55 | */ 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup USBD_DESC_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBD_DESC_Exported_Macros 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USBD_DESC_Exported_Variables 76 | * @{ 77 | */ 78 | extern USBD_DescriptorsTypeDef FS_Desc; 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* __USBD_DESC_H */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Dmitry Skulkin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Middlewares/ST/STM32_USB_Device_Library/Class/CustomHID/Inc/usbd_customhid.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_customhid.h 4 | * @author MCD Application Team 5 | * @version V2.4.1 6 | * @date 19-June-2015 7 | * @brief header file for the usbd_customhid.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_CUSTOMHID_H 30 | #define __USB_CUSTOMHID_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "usbd_ioreq.h" 38 | 39 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBD_CUSTOM_HID 44 | * @brief This file is the Header file for USBD_customhid.c 45 | * @{ 46 | */ 47 | 48 | 49 | /** @defgroup USBD_CUSTOM_HID_Exported_Defines 50 | * @{ 51 | */ 52 | #define CUSTOM_HID_EPIN_ADDR 0x81 53 | //#define CUSTOM_HID_EPIN_SIZE 0x30 54 | #define CUSTOM_HID_EPIN_SIZE 0x40 55 | 56 | #define CUSTOM_HID_EPOUT_ADDR 0x01 57 | //#define CUSTOM_HID_EPOUT_SIZE 0x30 58 | #define CUSTOM_HID_EPOUT_SIZE 0x40 59 | 60 | #define USB_CUSTOM_HID_CONFIG_DESC_SIZ 41 61 | #define USB_CUSTOM_HID_DESC_SIZ 9 62 | 63 | #define CUSTOM_HID_DESCRIPTOR_TYPE 0x21 64 | #define CUSTOM_HID_REPORT_DESC 0x22 65 | 66 | 67 | #define CUSTOM_HID_REQ_SET_PROTOCOL 0x0B 68 | #define CUSTOM_HID_REQ_GET_PROTOCOL 0x03 69 | 70 | #define CUSTOM_HID_REQ_SET_IDLE 0x0A 71 | #define CUSTOM_HID_REQ_GET_IDLE 0x02 72 | 73 | #define CUSTOM_HID_REQ_SET_REPORT 0x09 74 | #define CUSTOM_HID_REQ_GET_REPORT 0x01 75 | /** 76 | * @} 77 | */ 78 | 79 | 80 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 81 | * @{ 82 | */ 83 | typedef enum 84 | { 85 | CUSTOM_HID_IDLE = 0, 86 | CUSTOM_HID_BUSY, 87 | } 88 | CUSTOM_HID_StateTypeDef; 89 | 90 | typedef struct _USBD_CUSTOM_HID_Itf 91 | { 92 | uint8_t *pReport; 93 | int8_t (* Init) (void); 94 | int8_t (* DeInit) (void); 95 | int8_t (* OutEvent) (uint8_t, uint8_t ); 96 | 97 | }USBD_CUSTOM_HID_ItfTypeDef; 98 | 99 | typedef struct 100 | { 101 | uint8_t Report_buf[USBD_CUSTOMHID_OUTREPORT_BUF_SIZE]; 102 | uint32_t Protocol; 103 | uint32_t IdleState; 104 | uint32_t AltSetting; 105 | uint32_t IsReportAvailable; 106 | CUSTOM_HID_StateTypeDef state; 107 | } 108 | USBD_CUSTOM_HID_HandleTypeDef; 109 | /** 110 | * @} 111 | */ 112 | 113 | 114 | 115 | /** @defgroup USBD_CORE_Exported_Macros 116 | * @{ 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @defgroup USBD_CORE_Exported_Variables 124 | * @{ 125 | */ 126 | 127 | extern USBD_ClassTypeDef USBD_CUSTOM_HID; 128 | #define USBD_CUSTOM_HID_CLASS &USBD_CUSTOM_HID 129 | /** 130 | * @} 131 | */ 132 | 133 | /** @defgroup USB_CORE_Exported_Functions 134 | * @{ 135 | */ 136 | uint8_t USBD_CUSTOM_HID_SendReport (USBD_HandleTypeDef *pdev, 137 | uint8_t *report, 138 | uint16_t len); 139 | 140 | 141 | 142 | uint8_t USBD_CUSTOM_HID_RegisterInterface (USBD_HandleTypeDef *pdev, 143 | USBD_CUSTOM_HID_ItfTypeDef *fops); 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | #ifdef __cplusplus 150 | } 151 | #endif 152 | 153 | #endif /* __USB_CUSTOMHID_H */ 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163 | -------------------------------------------------------------------------------- /Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @version V2.4.2 6 | * @date 11-December-2015 7 | * @brief Header file for usbd_core.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_CORE_H 30 | #define __USBD_CORE_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "usbd_conf.h" 38 | #include "usbd_def.h" 39 | #include "usbd_ioreq.h" 40 | #include "usbd_ctlreq.h" 41 | 42 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 43 | * @{ 44 | */ 45 | 46 | /** @defgroup USBD_CORE 47 | * @brief This file is the Header file for usbd_core.c file 48 | * @{ 49 | */ 50 | 51 | 52 | /** @defgroup USBD_CORE_Exported_Defines 53 | * @{ 54 | */ 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | 61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 62 | * @{ 63 | */ 64 | 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | 72 | /** @defgroup USBD_CORE_Exported_Macros 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_CORE_Exported_Variables 81 | * @{ 82 | */ 83 | #define USBD_SOF USBD_LL_SOF 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id); 92 | USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev); 93 | USBD_StatusTypeDef USBD_Start (USBD_HandleTypeDef *pdev); 94 | USBD_StatusTypeDef USBD_Stop (USBD_HandleTypeDef *pdev); 95 | USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass); 96 | 97 | USBD_StatusTypeDef USBD_RunTestMode (USBD_HandleTypeDef *pdev); 98 | USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); 99 | USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx); 100 | 101 | USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup); 102 | USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata); 103 | USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev , uint8_t epnum, uint8_t *pdata); 104 | 105 | USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev); 106 | USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed); 107 | USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev); 108 | USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev); 109 | 110 | USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev); 111 | USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); 112 | USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum); 113 | 114 | USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev); 115 | USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev); 116 | 117 | /* USBD Low Level Driver */ 118 | USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev); 119 | USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev); 120 | USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev); 121 | USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev); 122 | USBD_StatusTypeDef USBD_LL_OpenEP (USBD_HandleTypeDef *pdev, 123 | uint8_t ep_addr, 124 | uint8_t ep_type, 125 | uint16_t ep_mps); 126 | 127 | USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 128 | USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 129 | USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 130 | USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 131 | uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 132 | USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr); 133 | USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev, 134 | uint8_t ep_addr, 135 | uint8_t *pbuf, 136 | uint16_t size); 137 | 138 | USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, 139 | uint8_t ep_addr, 140 | uint8_t *pbuf, 141 | uint16_t size); 142 | 143 | uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr); 144 | void USBD_LL_Delay (uint32_t Delay); 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | 154 | #endif /* __USBD_CORE_H */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 165 | 166 | 167 | 168 | -------------------------------------------------------------------------------- /Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @version V2.4.2 6 | * @date 11-December-2015 7 | * @brief Header file for the usbd_req.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_REQUEST_H 30 | #define __USB_REQUEST_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "usbd_def.h" 38 | 39 | 40 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBD_REQ 45 | * @brief header file for the usbd_req.c file 46 | * @{ 47 | */ 48 | 49 | /** @defgroup USBD_REQ_Exported_Defines 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USBD_REQ_Exported_Types 58 | * @{ 59 | */ 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | 66 | /** @defgroup USBD_REQ_Exported_Macros 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_REQ_Exported_Variables 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 81 | * @{ 82 | */ 83 | 84 | USBD_StatusTypeDef USBD_StdDevReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 85 | USBD_StatusTypeDef USBD_StdItfReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 86 | USBD_StatusTypeDef USBD_StdEPReq (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 87 | 88 | 89 | void USBD_CtlError (USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); 90 | 91 | void USBD_ParseSetupRequest (USBD_SetupReqTypedef *req, uint8_t *pdata); 92 | 93 | void USBD_GetString (uint8_t *desc, uint8_t *unicode, uint16_t *len); 94 | /** 95 | * @} 96 | */ 97 | 98 | #ifdef __cplusplus 99 | } 100 | #endif 101 | 102 | #endif /* __USB_REQUEST_H */ 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | 113 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 114 | -------------------------------------------------------------------------------- /Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @version V2.4.2 6 | * @date 11-December-2015 7 | * @brief Header file for the usbd_ioreq.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBD_IOREQ_H 30 | #define __USBD_IOREQ_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | #include "usbd_def.h" 38 | #include "usbd_core.h" 39 | 40 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBD_IOREQ 45 | * @brief header file for the usbd_ioreq.c file 46 | * @{ 47 | */ 48 | 49 | /** @defgroup USBD_IOREQ_Exported_Defines 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USBD_IOREQ_Exported_Types 58 | * @{ 59 | */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | 67 | 68 | /** @defgroup USBD_IOREQ_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBD_IOREQ_Exported_Variables 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 85 | * @{ 86 | */ 87 | 88 | USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev, 89 | uint8_t *buf, 90 | uint16_t len); 91 | 92 | USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev, 93 | uint8_t *pbuf, 94 | uint16_t len); 95 | 96 | USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev, 97 | uint8_t *pbuf, 98 | uint16_t len); 99 | 100 | USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev, 101 | uint8_t *pbuf, 102 | uint16_t len); 103 | 104 | USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev); 105 | 106 | USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev); 107 | 108 | uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev , 109 | uint8_t epnum); 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | #ifdef __cplusplus 116 | } 117 | #endif 118 | 119 | #endif /* __USBD_IOREQ_H */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 129 | -------------------------------------------------------------------------------- /Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.c 4 | * @author MCD Application Team 5 | * @version V2.4.2 6 | * @date 11-December-2015 7 | * @brief This file provides the IO requests APIs for control endpoints. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbd_ioreq.h" 30 | 31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | 36 | /** @defgroup USBD_IOREQ 37 | * @brief control I/O requests module 38 | * @{ 39 | */ 40 | 41 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USBD_IOREQ_Private_Defines 50 | * @{ 51 | */ 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | /** @defgroup USBD_IOREQ_Private_Macros 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USBD_IOREQ_Private_Variables 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes 76 | * @{ 77 | */ 78 | /** 79 | * @} 80 | */ 81 | 82 | 83 | /** @defgroup USBD_IOREQ_Private_Functions 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @brief USBD_CtlSendData 89 | * send data on the ctl pipe 90 | * @param pdev: device instance 91 | * @param buff: pointer to data buffer 92 | * @param len: length of data to be sent 93 | * @retval status 94 | */ 95 | USBD_StatusTypeDef USBD_CtlSendData (USBD_HandleTypeDef *pdev, 96 | uint8_t *pbuf, 97 | uint16_t len) 98 | { 99 | /* Set EP0 State */ 100 | pdev->ep0_state = USBD_EP0_DATA_IN; 101 | pdev->ep_in[0].total_length = len; 102 | pdev->ep_in[0].rem_length = len; 103 | /* Start the transfer */ 104 | USBD_LL_Transmit (pdev, 0x00, pbuf, len); 105 | 106 | return USBD_OK; 107 | } 108 | 109 | /** 110 | * @brief USBD_CtlContinueSendData 111 | * continue sending data on the ctl pipe 112 | * @param pdev: device instance 113 | * @param buff: pointer to data buffer 114 | * @param len: length of data to be sent 115 | * @retval status 116 | */ 117 | USBD_StatusTypeDef USBD_CtlContinueSendData (USBD_HandleTypeDef *pdev, 118 | uint8_t *pbuf, 119 | uint16_t len) 120 | { 121 | /* Start the next transfer */ 122 | USBD_LL_Transmit (pdev, 0x00, pbuf, len); 123 | 124 | return USBD_OK; 125 | } 126 | 127 | /** 128 | * @brief USBD_CtlPrepareRx 129 | * receive data on the ctl pipe 130 | * @param pdev: device instance 131 | * @param buff: pointer to data buffer 132 | * @param len: length of data to be received 133 | * @retval status 134 | */ 135 | USBD_StatusTypeDef USBD_CtlPrepareRx (USBD_HandleTypeDef *pdev, 136 | uint8_t *pbuf, 137 | uint16_t len) 138 | { 139 | /* Set EP0 State */ 140 | pdev->ep0_state = USBD_EP0_DATA_OUT; 141 | pdev->ep_out[0].total_length = len; 142 | pdev->ep_out[0].rem_length = len; 143 | /* Start the transfer */ 144 | USBD_LL_PrepareReceive (pdev, 145 | 0, 146 | pbuf, 147 | len); 148 | 149 | return USBD_OK; 150 | } 151 | 152 | /** 153 | * @brief USBD_CtlContinueRx 154 | * continue receive data on the ctl pipe 155 | * @param pdev: device instance 156 | * @param buff: pointer to data buffer 157 | * @param len: length of data to be received 158 | * @retval status 159 | */ 160 | USBD_StatusTypeDef USBD_CtlContinueRx (USBD_HandleTypeDef *pdev, 161 | uint8_t *pbuf, 162 | uint16_t len) 163 | { 164 | 165 | USBD_LL_PrepareReceive (pdev, 166 | 0, 167 | pbuf, 168 | len); 169 | return USBD_OK; 170 | } 171 | /** 172 | * @brief USBD_CtlSendStatus 173 | * send zero lzngth packet on the ctl pipe 174 | * @param pdev: device instance 175 | * @retval status 176 | */ 177 | USBD_StatusTypeDef USBD_CtlSendStatus (USBD_HandleTypeDef *pdev) 178 | { 179 | 180 | /* Set EP0 State */ 181 | pdev->ep0_state = USBD_EP0_STATUS_IN; 182 | 183 | /* Start the transfer */ 184 | USBD_LL_Transmit (pdev, 0x00, NULL, 0); 185 | 186 | return USBD_OK; 187 | } 188 | 189 | /** 190 | * @brief USBD_CtlReceiveStatus 191 | * receive zero lzngth packet on the ctl pipe 192 | * @param pdev: device instance 193 | * @retval status 194 | */ 195 | USBD_StatusTypeDef USBD_CtlReceiveStatus (USBD_HandleTypeDef *pdev) 196 | { 197 | /* Set EP0 State */ 198 | pdev->ep0_state = USBD_EP0_STATUS_OUT; 199 | 200 | /* Start the transfer */ 201 | USBD_LL_PrepareReceive ( pdev, 202 | 0, 203 | NULL, 204 | 0); 205 | 206 | return USBD_OK; 207 | } 208 | 209 | 210 | /** 211 | * @brief USBD_GetRxCount 212 | * returns the received data length 213 | * @param pdev: device instance 214 | * @param ep_addr: endpoint address 215 | * @retval Rx Data blength 216 | */ 217 | uint16_t USBD_GetRxCount (USBD_HandleTypeDef *pdev , uint8_t ep_addr) 218 | { 219 | return USBD_LL_GetRxDataSize(pdev, ep_addr); 220 | } 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | 227 | /** 228 | * @} 229 | */ 230 | 231 | 232 | /** 233 | * @} 234 | */ 235 | 236 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 237 | -------------------------------------------------------------------------------- /OSHStudio/Images/1053081_zps20151924.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/1053081_zps20151924.jpg -------------------------------------------------------------------------------- /OSHStudio/Images/Hardware.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/Hardware.ico -------------------------------------------------------------------------------- /OSHStudio/Images/MDB_pic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/MDB_pic.jpg -------------------------------------------------------------------------------- /OSHStudio/Images/OFF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/OFF.png -------------------------------------------------------------------------------- /OSHStudio/Images/OFF_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/OFF_small.png -------------------------------------------------------------------------------- /OSHStudio/Images/OFF_small_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/OFF_small_t.png -------------------------------------------------------------------------------- /OSHStudio/Images/ON_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/ON_2.png -------------------------------------------------------------------------------- /OSHStudio/Images/ON_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/ON_small.png -------------------------------------------------------------------------------- /OSHStudio/Images/ON_small_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/ON_small_t.png -------------------------------------------------------------------------------- /OSHStudio/Images/boardTypeII.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/boardTypeII.jpg -------------------------------------------------------------------------------- /OSHStudio/Images/cropped-OK-big-green-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/cropped-OK-big-green-button.png -------------------------------------------------------------------------------- /OSHStudio/Images/down-pointing-small-red-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/down-pointing-small-red-triangle.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_cb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_cb.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_cbl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_cbl.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_cl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_cl.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_clt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_clt.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_cr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_cr.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_crb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_crb.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_ct.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_ct.png -------------------------------------------------------------------------------- /OSHStudio/Images/dpad_ctr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/dpad_ctr.png -------------------------------------------------------------------------------- /OSHStudio/Images/openhardware.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/OSHStudio/Images/openhardware.ico -------------------------------------------------------------------------------- /OSHStudio/OSHStudio.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-08-22T19:33:37 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 10 | 11 | TARGET = OSHStudio 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cpp\ 16 | oshstudio.cpp \ 17 | hid.c \ 18 | file_ops.cpp \ 19 | board_types.cpp \ 20 | oshaxiswca.cpp \ 21 | get_put_config.cpp \ 22 | oshpincombobox.cpp \ 23 | worker.cpp \ 24 | oshsingenc.cpp \ 25 | osha2bw.cpp \ 26 | oshbuttonw.cpp \ 27 | draw_helps.cpp \ 28 | oshshapesw.cpp 29 | 30 | HEADERS += oshstudio.h \ 31 | hidapi.h \ 32 | oshaxiswca.h \ 33 | oshpincombobox.h \ 34 | hidapi.h \ 35 | oshaxiswca.h \ 36 | oshpincombobox.h \ 37 | oshstudio.h \ 38 | ../common_types/common_structs.h \ 39 | worker.h \ 40 | ../common_types/common_defines.h \ 41 | oshsingenc.h \ 42 | osha2bw.h \ 43 | oshbuttonw.h \ 44 | oshshapesw.h \ 45 | ../common_types/common_functions.h 46 | 47 | FORMS += oshstudio.ui \ 48 | oshaxiswca.ui \ 49 | oshpincombobox.ui \ 50 | oshsingenc.ui \ 51 | osha2bw.ui \ 52 | oshbuttonw.ui \ 53 | oshshapesw.ui 54 | 55 | RESOURCES += \ 56 | oshstudio.qrc 57 | 58 | win32 { 59 | 60 | LIBS += -lhid -lsetupapi 61 | 62 | } 63 | 64 | DISTFILES += 65 | 66 | CONFIG += static 67 | -------------------------------------------------------------------------------- /OSHStudio/board_types.cpp: -------------------------------------------------------------------------------- 1 | #include "oshstudio.h" 2 | #include "ui_oshstudio.h" 3 | 4 | void OSHStudio::showBoardType(int boardtype) { 5 | 6 | const struct pin_comp_geometry pin_components[3][32] = { 7 | { 8 | {"label_A0",20,110,"comboBoxA0",60,110}, 9 | {"label_A1",20,130,"comboBoxA1",60,130}, 10 | {"label_A2",20,150,"comboBoxA2",60,150}, 11 | {"label_A3",20,170,"comboBoxA3",60,170}, 12 | {"label_A4",20,190,"comboBoxA4",60,190}, 13 | {"label_A5",20,210,"comboBoxA5",60,210}, 14 | {"label_A6",20,230,"comboBoxA6",60,230}, 15 | {"label_A7",20,250,"comboBoxA7",60,250}, 16 | {"label_A8",550,320,"comboBoxA8",400,320}, 17 | {"label_A9",550,300,"comboBoxA9",400,300}, 18 | {"label_A10",550,280,"comboBoxA10",400,280}, 19 | {"label_A11",550,260,"comboBoxA11",400,260}, 20 | {"label_A12",550,240,"comboBoxA12",400,240}, 21 | {"label_A15",550,220,"comboBoxA15",400,220}, 22 | {"label_B0",20,270,"comboBoxB0",60,270}, 23 | {"label_B1",20,290,"comboBoxB1",60,290}, 24 | {"label_B3",550,200,"comboBoxB3",400,200}, 25 | {"label_B4",550,180,"comboBoxB4",400,180}, 26 | {"label_B5",550,160,"comboBoxB5",400,160}, 27 | {"label_B6",550,140,"comboBoxB6",400,140}, 28 | {"label_B7",550,120,"comboBoxB7",400,120}, 29 | {"label_B8",550,100,"comboBoxB8",400,100}, 30 | {"label_B9",550,80,"comboBoxB9",400,80}, 31 | {"label_B10",20,310,"comboBoxB10",60,310}, 32 | {"label_B11",20,330,"comboBoxB11",60,330}, 33 | {"label_B12",550,400,"comboBoxB12",400,400}, 34 | {"label_B13",550,380,"comboBoxB13",400,380}, 35 | {"label_B14",550,360,"comboBoxB14",400,360}, 36 | {"label_B15",550,340,"comboBoxB15",400,340}, 37 | {"label_C13",20,50,"comboBoxC13",60,50}, 38 | {"label_C14",20,70,"comboBoxC14",60,70}, 39 | {"label_C15",20,90,"comboBoxC15",60,90}, 40 | },{ 41 | {"label_A0",550,290,"comboBoxA0",400,290}, 42 | {"label_A1",550,270,"comboBoxA1",400,270}, 43 | {"label_A2",550,250,"comboBoxA2",400,250}, 44 | {"label_A3",550,230,"comboBoxA3",400,230}, 45 | {"label_A4",550,210,"comboBoxA4",400,210}, 46 | {"label_A5",550,190,"comboBoxA5",400,190}, 47 | {"label_A6",550,170,"comboBoxA6",400,170}, 48 | {"label_A7",550,150,"comboBoxA7",400,150}, 49 | {"label_A8",20,140,"comboBoxA8",60,140}, 50 | {"label_A9",20,160,"comboBoxA9",60,160}, 51 | {"label_A10",20,180,"comboBoxA10",60,180}, 52 | {"label_A11",20,200,"comboBoxA11",60,200}, 53 | {"label_A12",20,220,"comboBoxA12",60,220}, 54 | {"label_A15",20,240,"comboBoxA15",60,240}, 55 | {"label_B0",550,130,"comboBoxB0",400,130}, 56 | {"label_B1",550,110,"comboBoxB1",400,110}, 57 | {"label_B3",20,260,"comboBoxB3",60,260}, 58 | {"label_B4",20,280,"comboBoxB4",60,280}, 59 | {"label_B5",20,300,"comboBoxB5",60,300}, 60 | {"label_B6",20,320,"comboBoxB6",60,320}, 61 | {"label_B7",20,340,"comboBoxB7",60,340}, 62 | {"label_B8",560,350,"comboBoxB8",400,350}, 63 | {"label_B9",560,330,"comboBoxB9",400,330}, 64 | {"label_B10",550,90,"comboBoxB10",400,90}, 65 | {"label_B11",550,70,"comboBoxB11",400,70}, 66 | {"label_B12",20,60,"comboBoxB12",60,60}, 67 | {"label_B13",20,80,"comboBoxB13",60,80}, 68 | {"label_B14",20,100,"comboBoxB14",60,100}, 69 | {"label_B15",20,120,"comboBoxB15",60,120}, 70 | {"label_C13",550,310,"comboBoxC13",400,310}, 71 | {"label_C14",20,420,"comboBoxC14",60,420}, 72 | {"label_C15",20,400,"comboBoxC15",60,400}, 73 | }, 74 | }; 75 | 76 | QString name_template("widget_PB%1"); 77 | 78 | for (uint8_t i=0; i<32; i++){ 79 | oshpincombobox *comboBox_ptr = ui->tabWidget->findChild(name_template.arg(i)); 80 | comboBox_ptr->setVisible(false); 81 | QLabel *label_ptr = ui->tabWidget->findChild(pin_components[0][i].Label_name); 82 | label_ptr->setVisible(false); 83 | 84 | comboBox_ptr->move(pin_components[boardtype][i].ComboBox_X,pin_components[boardtype][i].ComboBox_Y); 85 | comboBox_ptr->setVisible(true); 86 | label_ptr->move(pin_components[boardtype][i].Label_X,pin_components[boardtype][i].Label_Y); 87 | label_ptr->setVisible(true); 88 | } 89 | /* 90 | for (uint8_t i=0; i<32; i++){ 91 | QComboBox *comboBox_ptr = ui->tabWidget->findChild(pin_components[boardtype][i].ComboBox_name); 92 | comboBox_ptr->move(pin_components[boardtype][i].ComboBox_X,pin_components[boardtype][i].ComboBox_Y); 93 | comboBox_ptr->setVisible(true); 94 | QLabel *label_ptr = ui->tabWidget->findChild(pin_components[boardtype][i].Label_name); 95 | label_ptr->move(pin_components[boardtype][i].Label_X,pin_components[boardtype][i].Label_Y); 96 | label_ptr->setVisible(true); 97 | } 98 | */ 99 | switch (boardtype) { 100 | case 0: ui->label->setPixmap(QPixmap(":/Images/MDB_pic.jpg")); 101 | break; 102 | case 1: ui->label_C14->setVisible(false); 103 | ui->label_C15->setVisible(false); 104 | //ui->comboBoxC14->setVisible(false); 105 | //ui->comboBoxC15->setVisible(false); 106 | ui->widget_PB30->setVisible(false); 107 | ui->widget_PB31->setVisible(false); 108 | ui->label->setPixmap(QPixmap(":/Images/boardTypeII.jpg")); 109 | break; 110 | } 111 | 112 | } 113 | 114 | -------------------------------------------------------------------------------- /OSHStudio/file_ops.cpp: -------------------------------------------------------------------------------- 1 | #include "oshstudio.h" 2 | #include "ui_oshstudio.h" 3 | #include 4 | #include 5 | 6 | void OSHStudio::loadFromFile() 7 | { 8 | uint8_t stored_version = 0; 9 | 10 | QString fileName = QFileDialog::getOpenFileName(this, 11 | tr("Open Config File"), "", 12 | tr("OSH Config Files (*.osh);;All Files (*)")); 13 | 14 | if (fileName.isEmpty()) 15 | return; 16 | else { 17 | QFile file(fileName); 18 | if (!file.open(QIODevice::ReadOnly)) { 19 | QMessageBox::information(this, tr("Unable to open file"), 20 | file.errorString()); 21 | return; 22 | } 23 | file.seek(offsetof(total_config_, config_version)); 24 | file.read(reinterpret_cast(&stored_version), 1); 25 | if (stored_version == FIRMWARERELEASE) { 26 | file.seek(0); 27 | file.read(reinterpret_cast(&config.packet_id1), sizeof(total_config_)); 28 | file.close(); 29 | setConfig_Slot(); 30 | } else { 31 | QMessageBox::warning(this, tr("Nope!"), 32 | tr("It seems the file has wrong FW version")); 33 | } 34 | } 35 | } 36 | 37 | void OSHStudio::saveToFile() 38 | { 39 | QString fileName = QFileDialog::getSaveFileName(this, 40 | tr("Save Config File"), "", 41 | tr("OSH Config Files (*.osh);;All Files (*)")); 42 | 43 | if (fileName.isEmpty()) 44 | return; 45 | else { 46 | QFile file(fileName); 47 | if (!file.open(QIODevice::WriteOnly)) { 48 | QMessageBox::information(this, tr("Unable to open file"), 49 | file.errorString()); 50 | return; 51 | } 52 | gatherConfig_Slot(); 53 | file.write(reinterpret_cast(&config.packet_id1), sizeof(total_config_)); 54 | file.close(); 55 | } 56 | } 57 | 58 | void OSHStudio::on_startLog_Button_toggled(bool checked) 59 | { 60 | if (checked) { 61 | QString fileName = QFileDialog::getSaveFileName(this, 62 | tr("Packets logging file"), "", 63 | tr("All Files (*)")); 64 | 65 | if (fileName.isEmpty()){ 66 | ui->startLog_Button->setChecked(false); 67 | return; 68 | } else { 69 | logfile.setFileName(fileName); 70 | if (!logfile.open(QIODevice::WriteOnly)) { 71 | QMessageBox::information(this, tr("Unable to open file"),logfile.errorString()); 72 | ui->startLog_Button->setChecked(false); 73 | return; 74 | } 75 | } 76 | file_logging = true; 77 | logstream.setDevice(&logfile); 78 | ui->startLog_Button->setText("Stop Logging to File"); 79 | } else { 80 | file_logging = false; 81 | logstream.flush(); 82 | logfile.close(); 83 | ui->startLog_Button->setText("Start Logging to File"); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /OSHStudio/main.cpp: -------------------------------------------------------------------------------- 1 | #include "oshstudio.h" 2 | #include 3 | #include 4 | 5 | void ParseState(void); 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QString executable = argv[0]; 10 | QString executablePath = executable.mid(0,executable.lastIndexOf("\\")); 11 | QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); 12 | QCoreApplication::removeLibraryPath(installPathPlugins); 13 | QCoreApplication::addLibraryPath(installPathPlugins); 14 | QCoreApplication::addLibraryPath(executablePath); 15 | 16 | QApplication a(argc, argv); 17 | a.setWindowIcon(QIcon("Hardware.ico")); 18 | OSHStudio w; 19 | w.show(); 20 | 21 | return a.exec(); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /OSHStudio/osh.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "Hardware.ico" 2 | -------------------------------------------------------------------------------- /OSHStudio/osha2bw.cpp: -------------------------------------------------------------------------------- 1 | #include "osha2bw.h" 2 | #include "ui_osha2bw.h" 3 | #include 4 | #include 5 | #include 6 | 7 | 8 | 9 | osha2bw::osha2bw(QWidget *parent) : 10 | QWidget(parent), 11 | ui(new Ui::osha2bw) 12 | { 13 | ui->setupUi(this); 14 | buttonsCount=1; 15 | 16 | sliders[0].IntLabel = ui->label_1; 17 | sliders[1].IntLabel = ui->label_2; 18 | sliders[2].IntLabel = ui->label_3; 19 | sliders[3].IntLabel = ui->label_4; 20 | sliders[4].IntLabel = ui->label_5; 21 | sliders[5].IntLabel = ui->label_6; 22 | sliders[6].IntLabel = ui->label_7; 23 | sliders[7].IntLabel = ui->label_8; 24 | sliders[8].IntLabel = ui->label_9; 25 | sliders[9].IntLabel = ui->label_10; 26 | 27 | for (uint8_t i=0;isetVisible(false); 33 | } 34 | 35 | draw_default_sliders(buttonsCount); 36 | } 37 | 38 | osha2bw::~osha2bw() 39 | { 40 | delete ui; 41 | } 42 | 43 | void osha2bw::paintEvent(QPaintEvent *event) 44 | { 45 | QPainter painter; 46 | int width,tmp; 47 | 48 | 49 | width = ui->AxisValue->width(); 50 | tmp = width/20; 51 | 52 | painter.begin(this); 53 | painter.setPen(Qt::lightGray); 54 | painter.drawRect(QRect(offset,7,width,2)); 55 | for (uint8_t i=0; i<21; i++){ 56 | painter.drawLine((i*tmp)+offset,15,(i*tmp)+offset,18); 57 | } 58 | for (uint8_t i=0; ipos(),Qt::WindingFill)) { 70 | sliders[i].PinColor = Qt::black; 71 | } else sliders[i].PinColor = QColor(1,119,215); 72 | 73 | if (event->buttons() & Qt::LeftButton) 74 | drawPin(event->pos(), i); 75 | 76 | if (sliders[i].PinDrag) { 77 | sliders[i].PinColor=Qt::lightGray; 78 | } 79 | } 80 | update(); 81 | } 82 | 83 | void osha2bw::drawPin(QPoint pinpos, uint8_t slider) { 84 | uint16_t pinvalue=0; 85 | 86 | if ((pinpos.x()ui->AxisValue->width()+offset) { 87 | return; 88 | } 89 | 90 | if ((sliders[slider].PinDrag) && pinpos.x()<(ui->AxisValue->width()+offset)) { 91 | pinvalue = checkPinValue(pinpos.x(), slider); 92 | fillPolygonArray(pinvalue, slider); 93 | sliders[slider].PinPosX = pinvalue; 94 | setLableValue(slider); 95 | return; 96 | } 97 | } 98 | 99 | void osha2bw::mousePressEvent(QMouseEvent *event) { 100 | for (uint8_t i=0;ipos(),Qt::WindingFill)) { 102 | sliders[i].PinDrag = true; 103 | } 104 | } 105 | } 106 | 107 | void osha2bw::mouseReleaseEvent(QMouseEvent *event) { 108 | for (uint8_t i=0;imove(sliders[whichSlider].PinPosX-13,16); 128 | sliders[whichSlider].IntLabel->setText(QString::number((sliders[whichSlider].PinPosX - offset)*MAX_RESOLUTION/(ui->AxisValue->width()))); 129 | sliders[whichSlider].IntLabel->setVisible(true); 130 | } 131 | 132 | uint16_t osha2bw::checkPinValue(uint16_t pinvalue, uint8_t slider_number) { 133 | if (pinvalue >= (ui->AxisValue->width()+offset)) pinvalue=ui->AxisValue->width()+offset; 134 | if (pinvalue < offset) pinvalue=offset; 135 | if (slider_number > 0){ 136 | if (pinvalue < (sliders[slider_number-1].PinPosX+7)) pinvalue = sliders[slider_number-1].PinPosX+7; 137 | } 138 | if (slider_number < buttonsCount-1){ 139 | if (pinvalue > (sliders[slider_number+1].PinPosX-7)) pinvalue = sliders[slider_number+1].PinPosX-7; 140 | } 141 | return pinvalue; 142 | } 143 | 144 | void osha2bw::on_spinBox_valueChanged(int arg1){ 145 | buttonsCount = arg1; 146 | draw_default_sliders(buttonsCount); 147 | emit buttons_number_changed(); 148 | } 149 | 150 | void osha2bw::draw_default_sliders(uint8_t sliders_number){ 151 | for (uint8_t i=0;isetVisible(false); 153 | } 154 | for (uint8_t i=0; iAxisValue->width()*(i+1)/(sliders_number+1)) + offset; 156 | fillPolygonArray(sliders[i].PinPosX, i); 157 | sliders[i].PinColor = QColor(1,119,215); 158 | sliders[i].PinDrag = false; 159 | setLableValue(i); 160 | } 161 | update(); 162 | } 163 | 164 | uint8_t osha2bw::getButtonsCount(void){ 165 | return buttonsCount; 166 | } 167 | 168 | void osha2bw::setButtonsCount(uint8_t number){ 169 | // buttonsCount = number; 170 | // draw_default_sliders(number); 171 | ui->spinBox->setValue(number); 172 | } 173 | 174 | void osha2bw::getButtonsIntervals(uint8_t buttonsIntervals[]){ 175 | for (uint8_t i=0;iAxisValue->width()); 177 | } 178 | } 179 | 180 | void osha2bw::setButtonsIntervals(uint8_t buttonsIntervals[]){ 181 | for (uint8_t i=0;iAxisValue->width()*buttonsIntervals[i])/MAX_RESOLUTION)+offset+1; 183 | fillPolygonArray(sliders[i].PinPosX, i); 184 | setLableValue(i); 185 | } 186 | update(); 187 | } 188 | 189 | void osha2bw::setPinName(QString pin){ 190 | ui->label_pinName->setText(pin); 191 | } 192 | -------------------------------------------------------------------------------- /OSHStudio/osha2bw.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHA2BW_H 2 | #define OSHA2BW_H 3 | 4 | #include 5 | #include 6 | #include "../common_types/common_defines.h" 7 | 8 | #define MAX_RESOLUTION 255 9 | 10 | namespace Ui { 11 | class osha2bw; 12 | } 13 | 14 | 15 | class osha2bw : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit osha2bw(QWidget *parent = 0); 21 | ~osha2bw(); 22 | uint8_t getButtonsCount(void); 23 | void setButtonsCount(uint8_t number); 24 | void getButtonsIntervals(uint8_t * buttonsIntervals); 25 | void setButtonsIntervals(uint8_t * buttonsIntervals); 26 | void setPinName(QString pin); 27 | 28 | protected: 29 | void mouseMoveEvent(QMouseEvent *event) override; 30 | void mousePressEvent(QMouseEvent *event) override; 31 | void mouseReleaseEvent(QMouseEvent *event) override; 32 | void paintEvent(QPaintEvent *event) override; 33 | 34 | private slots: 35 | void on_spinBox_valueChanged(int arg1); 36 | 37 | private: 38 | Ui::osha2bw *ui; 39 | void fillPolygonArray(uint16_t value, uint8_t whichSlider); 40 | void drawPin(QPoint pinpos, uint8_t slider); 41 | uint16_t checkPinValue(uint16_t pinvalue, uint8_t slider_number); 42 | void draw_default_sliders(uint8_t sliders_number); 43 | void setLableValue(uint8_t whichSlider); 44 | 45 | QPoint points[5]={ 46 | QPoint(5,2), 47 | QPoint(5,9), 48 | QPoint(8,15), 49 | QPoint(12,9), 50 | QPoint(12,2), 51 | }; 52 | const uint16_t MaxScaleValue=4095; 53 | const uint16_t offset=60; 54 | uint8_t buttonsCount; 55 | struct A2B_params { 56 | uint16_t PinPosX; 57 | QPolygon PinPoly; 58 | QColor PinColor; 59 | bool PinDrag; 60 | QLabel * IntLabel; 61 | } sliders[MAX_A2B_BUTTONS]; 62 | 63 | signals: 64 | void buttons_number_changed(void); 65 | }; 66 | 67 | #endif // OSHA2BW_H 68 | -------------------------------------------------------------------------------- /OSHStudio/oshaxiswca.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHAXISWCA_H 2 | #define OSHAXISWCA_H 3 | 4 | #include 5 | 6 | #define BARXSTART 60 7 | #define SENSORBARYSTART 19 8 | #define BARXEND 491 9 | #define SENSORBARHEIGHT 4 10 | #define AXISBARYSTART 23 11 | #define AXISBARHEIGHT 10 12 | #define SENSORACTIVECOLOR Qt::red 13 | #define AXISACTIVECOLOR QColor(0,133,00) 14 | #define SENSORCALIBOUTCOLOR Qt::lightGray 15 | //#define SENSORCALIBOUTCOLOR QColor(1,119,215) 16 | 17 | namespace Ui { 18 | class OSHaxiswca; 19 | } 20 | 21 | class OSHaxiswca : public QWidget 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit OSHaxiswca(QWidget *parent = 0); 27 | ~OSHaxiswca(); 28 | uint16_t LeftPinValue(void); 29 | uint16_t RightPinValue(void); 30 | bool isAutoCalibEnabled(void); 31 | void setMinCalibValue(uint16_t value); 32 | void setMaxCalibValue(uint16_t value); 33 | void setPinsEnabled(bool); 34 | void setAxisValue(uint16_t value); 35 | void setSensorValue(uint16_t sensor_value, uint16_t min_calib, uint16_t max_calib); 36 | void setAutoCalib(uint8_t state); 37 | 38 | 39 | private slots: 40 | void MaxCalibCanged(QString text); 41 | void MinCalibCanged(QString text); 42 | void AutoCalibToggled(bool state); 43 | int32_t map(int32_t x, int32_t in_min, int32_t in_max, int32_t out_min, int32_t out_max); 44 | 45 | protected: 46 | void mouseMoveEvent(QMouseEvent *event) override; 47 | void mousePressEvent(QMouseEvent *event) override; 48 | void mouseReleaseEvent(QMouseEvent *event) override; 49 | void paintEvent(QPaintEvent *event) override; 50 | 51 | private: 52 | void drawPin(QPoint pinpos); 53 | void fillPolygonArray(uint16_t value, char WhichPin); 54 | uint16_t checkPinValue(uint16_t pinvalue, char WhichPin); 55 | uint16_t min_calib_value = 0; 56 | uint16_t max_calib_value = 4095; 57 | uint16_t axis_value = 0; 58 | uint16_t sensor_value = 0; 59 | 60 | Ui::OSHaxiswca *ui; 61 | QPoint Lpoints[4]={ 62 | QPoint(5,2), 63 | QPoint(5,9), 64 | QPoint(12,15), 65 | QPoint(12,2), 66 | }; 67 | QPoint Rpoints[4]={ 68 | QPoint(12,2), 69 | QPoint(12,9), 70 | QPoint(5,15), 71 | QPoint(5,2), 72 | }; 73 | uint16_t LeftPinPosX, RightPinPosX; 74 | QPolygon LeftPinPoly, RightPinPoly; 75 | QColor LeftpinColor, RightpinColor; 76 | bool LeftPinDrag, RightPinDrag; 77 | const uint16_t MaxScaleValue=4095; 78 | bool AutoCalibEnabled; 79 | uint16_t PRbar_offset; 80 | bool ParentWidgetEnabled; 81 | }; 82 | 83 | #endif // OSHAXISWCA_H 84 | -------------------------------------------------------------------------------- /OSHStudio/oshaxiswca.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | OSHaxiswca 4 | 5 | 6 | 7 | 0 8 | 0 9 | 750 10 | 40 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 60 20 | 20 21 | 491 22 | 16 23 | 24 | 25 | 26 | 27 | 6 28 | 29 | 30 | 31 | 32 | 33 | 34 | 0 35 | 36 | 37 | 4095 38 | 39 | 40 | 0 41 | 42 | 43 | Qt::AlignCenter 44 | 45 | 46 | true 47 | 48 | 49 | %v 50 | 51 | 52 | 53 | 54 | 55 | 0 56 | 0 57 | 41 58 | 20 59 | 60 | 61 | 62 | background-color: rgb(255, 255, 255); 63 | 64 | 65 | 9999 66 | 67 | 68 | 69 | 70 | 71 | 570 72 | 0 73 | 41 74 | 20 75 | 76 | 77 | 78 | background-color: rgb(255, 255, 255); 79 | 80 | 81 | 9999 82 | 83 | 84 | 85 | 86 | 87 | 0 88 | 20 89 | 41 90 | 21 91 | 92 | 93 | 94 | Qt::LeftToRight 95 | 96 | 97 | MinCalib 98 | 99 | 100 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 101 | 102 | 103 | true 104 | 105 | 106 | 107 | 108 | 109 | 570 110 | 20 111 | 71 112 | 21 113 | 114 | 115 | 116 | MaxCalib 117 | 118 | 119 | true 120 | 121 | 122 | 123 | 124 | 125 | 640 126 | 0 127 | 111 128 | 17 129 | 130 | 131 | 132 | 133 | 75 134 | true 135 | 136 | 137 | 138 | AutoCalibration 139 | 140 | 141 | 142 | 143 | 144 | 60 145 | 21 146 | 491 147 | 2 148 | 149 | 150 | 151 | QProgressBar::chunk:horizontal {background: qlineargradient(x1: 0, y1: 0.5, x2: 1, y2: 0.5, stop: 0 red, stop: 1 red);} 152 | 153 | 154 | 4095 155 | 156 | 157 | 0 158 | 159 | 160 | Qt::AlignCenter 161 | 162 | 163 | false 164 | 165 | 166 | %v 167 | 168 | 169 | 170 | 171 | 172 | 430 173 | 20 174 | 51 175 | 16 176 | 177 | 178 | 179 | 180 | 7 181 | 182 | 183 | 184 | false 185 | 186 | 187 | background: transparent; 188 | 189 | 190 | Axis Value: 191 | 192 | 193 | 194 | 195 | 196 | 480 197 | 20 198 | 41 199 | 16 200 | 201 | 202 | 203 | 204 | 7 205 | 206 | 207 | 208 | false 209 | 210 | 211 | background: transparent; 212 | 213 | 214 | 0 215 | 216 | 217 | 218 | 219 | 220 | 70 221 | 20 222 | 61 223 | 16 224 | 225 | 226 | 227 | 228 | 7 229 | 230 | 231 | 232 | background: transparent; 233 | 234 | 235 | Sensor Value: 236 | 237 | 238 | 239 | 240 | 241 | 130 242 | 20 243 | 41 244 | 16 245 | 246 | 247 | 248 | 249 | 7 250 | 251 | 252 | 253 | background: transparent; 254 | 255 | 256 | 0 257 | 258 | 259 | AxisValue 260 | sensorValue 261 | lineEdit_MinCalib 262 | lineEdit_MaxCalib 263 | label_MinCalib 264 | label_MaxCalib 265 | checkBox_AutoCalib 266 | label_axis 267 | label_axisValue 268 | label_sensor 269 | label_sensorValue 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /OSHStudio/oshbuttonw.cpp: -------------------------------------------------------------------------------- 1 | #include "oshbuttonw.h" 2 | #include "ui_oshbuttonw.h" 3 | #include 4 | #include 5 | 6 | oshbuttonw::oshbuttonw(QWidget *parent) : 7 | QWidget(parent), 8 | ui(new Ui::oshbuttonw) 9 | { 10 | ui->setupUi(this); 11 | 12 | QMenu *xmenu = new QMenu(); 13 | QMenu* submenuJ = xmenu->addMenu( "Joystick" ); 14 | QMenu* submenuP = xmenu->addMenu( "POV" ); 15 | QMenu* submenuM = xmenu->addMenu( "Mouse" ); 16 | QMenu* submenuV = xmenu->addMenu( "Volume" ); 17 | QMenu* submenuMM = xmenu->addMenu( "Multimedia" ); 18 | QMenu* submenuK = xmenu->addMenu( "Keyboard" ); 19 | QMenu* submenuKM = submenuK->addMenu( "Modifiers" ); 20 | QMenu* submenuKF = submenuK->addMenu( "F's" ); 21 | QMenu* submenuKS = submenuK->addMenu( "Specials" ); 22 | QMenu* submenuKD = submenuK->addMenu( "Digits" ); 23 | QMenu* submenuKL = submenuK->addMenu( "Letters" ); 24 | for (uint8_t i=0; iaddAction(button_namings[i].element_menu); 26 | if (button_namings[i].parent_menu == "POV") submenuP->addAction(button_namings[i].element_menu); 27 | if (button_namings[i].parent_menu == "Mouse") submenuM->addAction(button_namings[i].element_menu); 28 | if (button_namings[i].parent_menu == "Volume") submenuV->addAction(button_namings[i].element_menu); 29 | if (button_namings[i].parent_menu == "Multimedia") submenuMM->addAction(button_namings[i].element_menu); 30 | if (button_namings[i].parent_menu == "Modifiers") submenuKM->addAction(button_namings[i].element_menu); 31 | if (button_namings[i].parent_menu == "F's") submenuKF->addAction(button_namings[i].element_menu); 32 | if (button_namings[i].parent_menu == "Specials") submenuKS->addAction(button_namings[i].element_menu); 33 | if (button_namings[i].parent_menu == "Digits") submenuKD->addAction(button_namings[i].element_menu); 34 | if (button_namings[i].parent_menu == "Letters") submenuKL->addAction(button_namings[i].element_menu); 35 | } 36 | ui->pushButton->setMenu(xmenu); 37 | set_button_state(false); 38 | set_button_type(joystick_button); 39 | connect(xmenu, SIGNAL(triggered(QAction*)), SLOT(slotActivated(QAction*))); 40 | } 41 | 42 | oshbuttonw::~oshbuttonw() 43 | { 44 | delete ui; 45 | } 46 | 47 | void oshbuttonw::set_button_state(bool state) 48 | { 49 | if (state) { 50 | ui->pushButton->setStyleSheet("QPushButton::menu-indicator{ image: none; width: 0px; }" 51 | "QPushButton {background-image: url(:/Images/ON_small_t.png); color: yellow; padding-bottom: 8px;}"); 52 | } else { 53 | ui->pushButton->setStyleSheet("QPushButton::menu-indicator{ image: none; width: 0px; }" 54 | "QPushButton {background-image: url(:/Images/OFF_small_t.png); color: yellow; padding-bottom: 8px;}"); 55 | } 56 | } 57 | 58 | void oshbuttonw::set_button_text(QString text){ 59 | ui->pushButton->setText(text); 60 | } 61 | 62 | button_mode oshbuttonw::get_button_type(void){ 63 | return current_button_type; 64 | } 65 | 66 | void oshbuttonw::set_button_type(button_mode type){ 67 | for (uint8_t i=0; ipushButton->setText(button_namings[i].short_abbr); 70 | ui->pushButton->setToolTip(button_namings[i].element_menu); 71 | } 72 | } 73 | current_button_type = type; 74 | // emit button_type_changed(); 75 | } 76 | 77 | void oshbuttonw::slotActivated(QAction* pAction) 78 | { 79 | QString text_selected = pAction->text().remove("&"); 80 | for (uint8_t i=0; i 5 | #include "../common_types/common_structs.h" 6 | 7 | #define MENUELEM 103 8 | 9 | struct button_namings_ { 10 | QString parent_menu; 11 | QString element_menu; 12 | QString short_abbr; 13 | button_mode button_type; 14 | }; 15 | 16 | 17 | namespace Ui { 18 | class oshbuttonw; 19 | } 20 | 21 | class oshbuttonw : public QWidget 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit oshbuttonw(QWidget *parent = nullptr); 27 | ~oshbuttonw(); 28 | 29 | private slots: 30 | void set_button_text(QString text); 31 | void slotActivated(QAction* pAction); 32 | 33 | private: 34 | Ui::oshbuttonw *ui; 35 | button_mode current_button_type; 36 | button_namings_ const button_namings[MENUELEM] = { 37 | {"Joystick", "Joystick button", "Joy", joystick_button,}, 38 | // {"Joystick", "Shift1 Joystick button", "JoySh1",joysticksh1_button,}, 39 | // {"Joystick", "Shift2 Joystick button", "JoySh2",joysticksh2_button}, 40 | {"POV", "POV1 Up", "POV1U", pov1up_button}, 41 | {"POV", "POV1 Right", "POV1R", pov1right_button}, 42 | {"POV", "POV1 Down", "POV1D", pov1down_button}, 43 | {"POV", "POV1 Left", "POV1L", pov1left_button}, 44 | {"POV", "POV2 Up", "POV2U", pov2up_button}, 45 | {"POV", "POV2 Right", "POV2R", pov2right_button}, 46 | {"POV", "POV2 Down", "POV2D", pov2down_button}, 47 | {"POV", "POV2 Left", "POV1L", pov2left_button}, 48 | {"POV", "POV3 Up", "POV3U", pov3up_button}, 49 | {"POV", "POV3 Right", "POV3R", pov3right_button}, 50 | {"POV", "POV3 Down", "POV3D", pov3down_button}, 51 | {"POV", "POV3 Left", "POV3L", pov3left_button}, 52 | {"POV", "POV4 Up", "POV4U", pov4up_button}, 53 | {"POV", "POV4 Right", "POV4R", pov4right_button}, 54 | {"POV", "POV4 Down", "POV4D", pov4down_button}, 55 | {"POV", "POV4 Left", "POV4L", pov4left_button}, 56 | {"Mouse", "Left Mouse Button", "MouseL", mouseleft_button}, 57 | {"Mouse", "Middle Mouse Button", "MouseM", mousemiddle_button}, 58 | {"Mouse", "Right Mouse Button", "MouseR", mouseright_button}, 59 | {"Volume", "Volume Up", "VolU", volumeup_button}, 60 | {"Volume", "Volume Down", "VolD", volumedown_button}, 61 | {"Volume", "Volume Mute/UnMute", "VolM", volumemute_button}, 62 | {"Modifiers", "Left Control", "LCntl", leftcontrol_button}, 63 | {"Modifiers", "Left Shift", "LShft", leftshift_button}, 64 | {"Modifiers", "Left Alt", "LAlt", leftalt_button}, 65 | {"Modifiers", "Left GUI", "LGUI", leftgui_button}, 66 | {"Modifiers", "Right Control", "RCntl", rightcontrol_button}, 67 | {"Modifiers", "Right Shift", "RShft", rightshift_button}, 68 | {"Modifiers", "Right Alt", "RAlt", rightalt_button}, 69 | {"Modifiers", "Right GUI", "RGUI", rightgui_button}, 70 | {"F's", "F1", "F1", f1_button}, 71 | {"F's", "F2", "F2", f2_button}, 72 | {"F's", "F3", "F3", f3_button}, 73 | {"F's", "F4", "F4", f4_button}, 74 | {"F's", "F5", "F5", f5_button}, 75 | {"F's", "F6", "F6", f6_button}, 76 | {"F's", "F7", "F7", f7_button}, 77 | {"F's", "F8", "F8", f8_button}, 78 | {"F's", "F9", "F9", f9_button}, 79 | {"F's", "F10", "F10", f10_button}, 80 | {"F's", "F11", "F11", f11_button}, 81 | {"F's", "F12", "F12", f12_button}, 82 | {"Specials", "Enter", "Enter", enter_button}, 83 | {"Specials", "Escape", "Esc", escape_button}, 84 | {"Specials", "Backspace", "Bkspace", backspace_button}, 85 | {"Specials", "Tab", "Tab", tab_button}, 86 | {"Specials", "Space", "Space", space_button}, 87 | {"Specials", "Insert", "Insert", insert_button}, 88 | {"Specials", "Delete", "Delete", delete_button}, 89 | {"Specials", "Home", "Home", home_button}, 90 | {"Specials", "End", "End", end_button}, 91 | {"Specials", "Page Up", "PgUp", pgup_button}, 92 | {"Specials", "Page Down", "PgDn", pgdown_button}, 93 | {"Specials", "Right Arrow", "RArrow", rightarrow_button}, 94 | {"Specials", "Left Arrow", "LArrow", leftarrow_button}, 95 | {"Specials", "Down Arrow", "DArrow", downarrow_button}, 96 | {"Specials", "Up Arrow", "UArrow", uparrow_button}, 97 | // {"Multimedia", "Audio Player", "Player", player_button}, 98 | {"Multimedia", "Play", "Play", play_button}, 99 | {"Multimedia", "Stop", "Stop", stop_button}, 100 | // {"Multimedia", "Eject", "Eject", eject_button}, 101 | {"Multimedia", "Scan Next", "Next", next_button}, 102 | {"Multimedia", "Scan Previous", "Prev", prev_button}, 103 | {"Multimedia", "Calculator", "Calc", calc_button}, 104 | // {"Multimedia", "Control Panel", "CPanel", cpanel_button}, 105 | // {"Multimedia", "Task Manager", "TaskMan", taskman_button}, 106 | {"Multimedia", "Explorer", "Explorer", explorer_button}, 107 | // {"Multimedia", "Browser", "Browser", browser_button}, 108 | {"Multimedia", "Browser Home", "BrowsHom", browserhome_button}, 109 | {"Multimedia", "Browser Back", "BrowsBak", browserback_button}, 110 | {"Multimedia", "Browser Forward", "BrowsFrw", browserforward_button}, 111 | {"Digits", "0", "0", d0_button}, 112 | {"Digits", "1", "1", d1_button}, 113 | {"Digits", "2", "2", d2_button}, 114 | {"Digits", "3", "3", d3_button}, 115 | {"Digits", "4", "4", d4_button}, 116 | {"Digits", "5", "5", d5_button}, 117 | {"Digits", "6", "6", d6_button}, 118 | {"Digits", "7", "7", d7_button}, 119 | {"Digits", "8", "8", d8_button}, 120 | {"Digits", "9", "9", d9_button}, 121 | {"Letters", "a", "a", a_button}, 122 | {"Letters", "b", "b", b_button}, 123 | {"Letters", "c", "c", c_button}, 124 | {"Letters", "d", "d", d_button}, 125 | {"Letters", "e", "e", e_button}, 126 | {"Letters", "f", "f", f_button}, 127 | {"Letters", "g", "g", g_button}, 128 | {"Letters", "h", "h", h_button}, 129 | {"Letters", "i", "i", i_button}, 130 | {"Letters", "j", "j", j_button}, 131 | {"Letters", "k", "k", k_button}, 132 | {"Letters", "l", "l", l_button}, 133 | {"Letters", "m", "m", m_button}, 134 | {"Letters", "n", "n", n_button}, 135 | {"Letters", "o", "o", o_button}, 136 | {"Letters", "p", "p", p_button}, 137 | {"Letters", "q", "q", q_button}, 138 | {"Letters", "r", "r", r_button}, 139 | {"Letters", "s", "s", s_button}, 140 | {"Letters", "t", "t", t_button}, 141 | {"Letters", "u", "u", u_button}, 142 | {"Letters", "v", "v", v_button}, 143 | {"Letters", "w", "w", w_button}, 144 | {"Letters", "x", "x", x_button}, 145 | {"Letters", "y", "y", y_button}, 146 | {"Letters", "z", "z", z_button}, 147 | }; 148 | 149 | 150 | public slots: 151 | void set_button_state(bool state); 152 | button_mode get_button_type(void); 153 | void set_button_type(button_mode); 154 | 155 | signals: 156 | void button_type_changed(); 157 | }; 158 | 159 | #endif // OSHBUTTONW_H 160 | -------------------------------------------------------------------------------- /OSHStudio/oshbuttonw.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | oshbuttonw 4 | 5 | 6 | 7 | 0 8 | 0 9 | 51 10 | 51 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 0 20 | 0 21 | 51 22 | 51 23 | 24 | 25 | 26 | false 27 | 28 | 29 | image: url(:/Images/OFF_small_t.png); 30 | 31 | 32 | 33 | 34 | 35 | true 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /OSHStudio/oshpincombobox.cpp: -------------------------------------------------------------------------------- 1 | #include "oshpincombobox.h" 2 | #include "ui_oshpincombobox.h" 3 | 4 | oshpincombobox::oshpincombobox(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::oshpincombobox) 7 | { 8 | ui->setupUi(this); 9 | 10 | QStringList list=(QStringList()<<"Not Used"<<"Analog No Smoothing"<<"Analog Low Smoothing" 11 | <<"Analog Medium Smooth"<<"Analog High Smooting"<<"Analog to Button" 12 | <<"Analog to Mouse X" << "Analog to Mouse Y" << "Analog to Mouse Wheel" 13 | <<"Chd Rot Enc PINA"<<"Chd Rot Enc PINB" 14 | <<"Chd Rot Enc 1/1"<<"Chd Rot Enc 1/2" 15 | <<"Sng Rot Enc PINA 1/1"<<"Sng Rot Enc PINB 1/1" 16 | <<"Sng Rot Enc PINA 1/2"<<"Sng Rot Enc PINB 1/2" 17 | <<"Sng Rot Enc PINA 1/4"<<"Sng Rot Enc PINB 1/4" 18 | <<"Button Matrix ROW"<<"Button Matrix COLUMN" 19 | <<"Single Button +3.3V"<<"Single Button GND" 20 | <<"Rotary Switch Pole" 21 | <<"Rotary Switch Wire"); 22 | ui->comboBox->addItems(list); 23 | } 24 | 25 | oshpincombobox::~oshpincombobox() 26 | { 27 | delete ui; 28 | } 29 | 30 | void oshpincombobox::on_comboBox_currentIndexChanged(int index) 31 | { 32 | QString color_scheme; 33 | 34 | switch ((pintype)index) { 35 | case AnalogNoSmooth: color_scheme="QComboBox { color: white; background-color: #003300; }";break; 36 | case AnalogLowSmooth: color_scheme="QComboBox { color: white; background-color: #003300; }";break; 37 | case AnalogMedSmooth: color_scheme="QComboBox { color: white; background-color: #003300; }";break; 38 | case AnalogHighSmooth: color_scheme="QComboBox { color: white; background-color: #003300; }";break; 39 | case Analog2Button: color_scheme="QComboBox { color: white; background-color: #006600; }";break; 40 | case Analog2MouseX: color_scheme="QComboBox { color: white; background-color: #666600; }";break; 41 | case Analog2MouseY: color_scheme="QComboBox { color: white; background-color: #666600; }";break; 42 | case Analog2MouseWheel: color_scheme="QComboBox { color: white; background-color: #666600; }";break; 43 | case Chain_Rotary_PINA: color_scheme="QComboBox { color: white; background-color: #669900; }";break; 44 | case Chain_Rotary_PINB: color_scheme="QComboBox { color: white; background-color: #669900; }";break; 45 | case Chain_Rotary_Enc_1:color_scheme="QComboBox { color: black; background-color: #669900; }";break; 46 | case Chain_Rotary_Enc_2:color_scheme="QComboBox { color: black; background-color: #669900; }";break; 47 | case Single_Rotary_PINA_1:color_scheme="QComboBox { color: black; background-color: #66cc00; }";break; 48 | case Single_Rotary_PINB_1:color_scheme="QComboBox { color: black; background-color: #66cc00; }";break; 49 | case Single_Rotary_PINA_2:color_scheme="QComboBox { color: black; background-color: #66cc33; }";break; 50 | case Single_Rotary_PINB_2:color_scheme="QComboBox { color: black; background-color: #66cc33; }";break; 51 | case Single_Rotary_PINA_4:color_scheme="QComboBox { color: black; background-color: #66cc66; }";break; 52 | case Single_Rotary_PINB_4:color_scheme="QComboBox { color: black; background-color: #66cc66; }";break; 53 | case Button_ROW: color_scheme="QComboBox { color: white; background-color: #009900; }";break; 54 | case Button_COLUMN: color_scheme="QComboBox { color: white; background-color: #00cc00; }";break; 55 | case Button: color_scheme="QComboBox { color: black; background-color: #00ff00; }";break; 56 | case Button_GND: color_scheme="QComboBox { color: black; background-color: #00ff00; }";break; 57 | case RotSwPole: color_scheme="QComboBox { color: white; background-color: #669900; }";break; 58 | case RotSwWire: color_scheme="QComboBox { color: white; background-color: #669900; }";break; 59 | case Not_Used: color_scheme="QComboBox { color: black; background-color: light gray; }";break; 60 | default: break; 61 | } 62 | 63 | ui->comboBox->setStyleSheet(color_scheme); 64 | ui->comboBox->clearFocus(); 65 | emit item_changed(); 66 | } 67 | 68 | void oshpincombobox::set_pin_number(uint8_t pin_number) 69 | { 70 | // disable chained 1/4 enc config 71 | //ui->comboBox->setItemData(10, 0, Qt::UserRole - 1); 72 | 73 | if ((pin_number > 8) && (pin_number !=14) && (pin_number != 15)){ 74 | ui->comboBox->setItemData(1, 0, Qt::UserRole - 1); 75 | ui->comboBox->setItemData(2, 0, Qt::UserRole - 1); 76 | ui->comboBox->setItemData(3, 0, Qt::UserRole - 1); 77 | ui->comboBox->setItemData(4, 0, Qt::UserRole - 1); 78 | ui->comboBox->setItemData(5, 0, Qt::UserRole - 1); 79 | ui->comboBox->setItemData(6, 0, Qt::UserRole - 1); 80 | ui->comboBox->setItemData(7, 0, Qt::UserRole - 1); 81 | ui->comboBox->setItemData(8, 0, Qt::UserRole - 1); 82 | } 83 | if (pin_number == 29) { 84 | ui->comboBox->setItemData(9, 0, Qt::UserRole - 1); 85 | ui->comboBox->setItemData(10, 0, Qt::UserRole - 1); 86 | ui->comboBox->setItemData(13, 0, Qt::UserRole - 1); 87 | ui->comboBox->setItemData(14, 0, Qt::UserRole - 1); 88 | ui->comboBox->setItemData(15, 0, Qt::UserRole - 1); 89 | ui->comboBox->setItemData(16, 0, Qt::UserRole - 1); 90 | ui->comboBox->setItemData(17, 0, Qt::UserRole - 1); 91 | ui->comboBox->setItemData(18, 0, Qt::UserRole - 1); 92 | ui->comboBox->setItemData(19, 0, Qt::UserRole - 1); 93 | ui->comboBox->setItemData(21, 0, Qt::UserRole - 1); 94 | ui->comboBox->setItemData(22, 0, Qt::UserRole - 1); 95 | ui->comboBox->setItemData(24, 0, Qt::UserRole - 1); 96 | } 97 | } 98 | 99 | uint8_t oshpincombobox::get_current_index(void) 100 | { 101 | return ui->comboBox->currentIndex(); 102 | } 103 | 104 | void oshpincombobox::set_current_index(uint8_t pin) 105 | { 106 | ui->comboBox->setCurrentIndex(pin); 107 | } 108 | -------------------------------------------------------------------------------- /OSHStudio/oshpincombobox.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHPINCOMBOBOX_H 2 | #define OSHPINCOMBOBOX_H 3 | 4 | #include 5 | #include "../common_types/common_structs.h" 6 | 7 | namespace Ui { 8 | class oshpincombobox; 9 | } 10 | 11 | class oshpincombobox : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit oshpincombobox(QWidget *parent = 0); 17 | ~oshpincombobox(); 18 | 19 | signals: 20 | void item_changed(); 21 | 22 | public slots: 23 | void set_pin_number(uint8_t); 24 | uint8_t get_current_index(void); 25 | void set_current_index(uint8_t); 26 | 27 | 28 | private slots: 29 | void on_comboBox_currentIndexChanged(int index); 30 | 31 | private: 32 | Ui::oshpincombobox *ui; 33 | 34 | }; 35 | 36 | #endif // OSHPINCOMBOBOX_H 37 | -------------------------------------------------------------------------------- /OSHStudio/oshpincombobox.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | oshpincombobox 4 | 5 | 6 | 7 | 0 8 | 0 9 | 170 10 | 21 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 0 20 | 0 21 | 171 22 | 21 23 | 24 | 25 | 26 | 30 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /OSHStudio/oshshapesw.cpp: -------------------------------------------------------------------------------- 1 | #include "oshshapesw.h" 2 | #include "ui_oshshapesw.h" 3 | #include 4 | #include 5 | 6 | 7 | oshshapesw::oshshapesw(QWidget *parent) : 8 | QWidget(parent), 9 | ui(new Ui::oshshapesw) 10 | { 11 | ui->setupUi(this); 12 | for (int i=0; ipos())) { 85 | shape_values[i].knob_color = knob_active_color; 86 | } else { 87 | shape_values[i].knob_color = knob_inactive_color; 88 | } 89 | 90 | if ((event->buttons() & Qt::LeftButton) && 91 | (event->pos().y() > slider_radius) && 92 | (event->pos().y() < widget_height + slider_radius) && 93 | (shape_values[i].drag_state)) { 94 | shape_values[i].knob_color = knob_move_color; 95 | shape_values[i].knob_area.moveTop(event->pos().y() - slider_radius/2); 96 | shape_values[i].Y_value = event->pos().y() - slider_radius/2; 97 | shape_values[i].orig_value = ((MAX_ADC_RES-1) * (widget_height - shape_values[i].Y_value + slider_radius/2)) / widget_height; 98 | emit knob_moved(); 99 | } 100 | } 101 | 102 | update(); 103 | } 104 | } 105 | 106 | void oshshapesw::mousePressEvent(QMouseEvent *event) { 107 | for (int i = 0; i < SHAPEVALUES; ++i) { 108 | if (shape_values[i].knob_area.contains(event->pos())) { 109 | shape_values[i].drag_state = true; 110 | } 111 | } 112 | } 113 | 114 | void oshshapesw::mouseReleaseEvent(QMouseEvent *event) { 115 | for (int i = 0; i < SHAPEVALUES; ++i) { 116 | shape_values[i].drag_state = false; 117 | } 118 | } 119 | 120 | int oshshapesw::getSplinePoint(int p1, int p2, int distance){ 121 | return (p1 + ((p2 - p1)*distance)/(MAX_ADC_RES/SHAPEVALUES)); 122 | } 123 | 124 | void oshshapesw::getAllPoints(uint16_t * array, uint8_t num_elements){ 125 | if (num_elements > SHAPEVALUES) num_elements = SHAPEVALUES; 126 | 127 | for (int i = 0; i < num_elements; ++i) { 128 | array[i] = shape_values[i].orig_value; 129 | } 130 | } 131 | 132 | void oshshapesw::setAllPoints(uint16_t * array, uint8_t num_elements){ 133 | if (num_elements > SHAPEVALUES) num_elements = SHAPEVALUES; 134 | 135 | for (int i = 0; i < num_elements; ++i) { 136 | shape_values[i].orig_value = array[i]; 137 | shape_values[i].Y_value = ((((MAX_ADC_RES-1) - shape_values[i].orig_value) * widget_height) / (MAX_ADC_RES-1)) + slider_radius/2; 138 | if (shape_values[i].Y_value > (widget_height + slider_radius/2)) shape_values[i].Y_value = widget_height + slider_radius/2; 139 | if (shape_values[i].Y_value < 0) shape_values[i].Y_value = 0; 140 | shape_values[i].knob_area.moveTop(shape_values[i].Y_value); 141 | } 142 | update(); 143 | } 144 | 145 | void oshshapesw::resizeEvent(QResizeEvent *event){ 146 | repaintit(); 147 | 148 | } 149 | 150 | void oshshapesw::repaintit() { 151 | slider_radius = (this->width() < 200) ? 1 : 16; 152 | widget_width = this->width() - (slider_radius + slider_radius); 153 | widget_height = this->height() - (slider_radius + slider_radius); 154 | 155 | for (uint8_t i=0; i (widget_height + slider_radius/2)) shape_values[i].Y_value = widget_height + slider_radius/2; 159 | if (shape_values[i].Y_value < 0) shape_values[i].Y_value = 0; 160 | shape_values[i].knob_area.setRect(shape_values[i].X_value, shape_values[i].Y_value, 161 | slider_radius,slider_radius); 162 | shape_values[i].knob_color = knob_inactive_color; 163 | shape_values[i].drag_state = false; 164 | } 165 | 166 | } 167 | 168 | void oshshapesw::setReadOnlyMode(bool mode){ 169 | if (mode) { 170 | rw_mode = false; 171 | curve_color = Qt::black; 172 | net_odd_color = Qt::lightGray; 173 | } else { 174 | rw_mode = true; 175 | curve_color = QColor(1,119,215); 176 | net_odd_color = Qt::black; 177 | } 178 | update(); 179 | } 180 | -------------------------------------------------------------------------------- /OSHStudio/oshshapesw.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHSHAPESW_H 2 | #define OSHSHAPESW_H 3 | 4 | #include 5 | #include 6 | #include "../common_types/common_defines.h" 7 | 8 | #define NETXCOLUMNS 7 9 | #define NETYROWS 9 10 | 11 | //#define SLIDERRADIUS 16 12 | //#define OUTERKNOBRADIUS 8 13 | //#define XOFFSET (SLIDERRADIUS/2) 14 | //#define YOFFSET (SLIDERRADIUS/2) 15 | 16 | 17 | namespace Ui { 18 | class oshshapesw; 19 | } 20 | 21 | class oshshapesw : public QWidget 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit oshshapesw(QWidget *parent = nullptr); 27 | ~oshshapesw(); 28 | void getAllPoints(uint16_t * array, uint8_t num_elements=SHAPEVALUES); 29 | void setAllPoints(uint16_t * array, uint8_t num_elements=SHAPEVALUES); 30 | void setReadOnlyMode(bool mode); 31 | 32 | private: 33 | Ui::oshshapesw *ui; 34 | int widget_width; 35 | int widget_height; 36 | struct { 37 | int X_value; 38 | int Y_value; 39 | uint16_t orig_value; 40 | bool drag_state; 41 | QRect knob_area; 42 | QColor knob_color; 43 | } shape_values[SHAPEVALUES]; 44 | QColor const knob_inactive_color = QColor(1,119,215); 45 | QColor const knob_active_color = Qt::black; 46 | QColor const knob_move_color = Qt::lightGray; 47 | QColor curve_color = QColor(1,119,215); 48 | QColor net_odd_color = Qt::black; 49 | uint8_t slider_radius = 16; 50 | bool rw_mode = true; 51 | 52 | private slots: 53 | // void drawSpline(void); 54 | int getSplinePoint(int p1, int p2, int distance); 55 | void repaintit(); 56 | 57 | protected: 58 | void mouseMoveEvent(QMouseEvent *event) override; 59 | void mousePressEvent(QMouseEvent *event) override; 60 | void mouseReleaseEvent(QMouseEvent *event) override; 61 | void paintEvent(QPaintEvent *event) override; 62 | void resizeEvent(QResizeEvent *event) override; 63 | 64 | signals: 65 | void knob_moved(void); 66 | }; 67 | 68 | #endif // OSHSHAPESW_H 69 | -------------------------------------------------------------------------------- /OSHStudio/oshshapesw.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | oshshapesw 4 | 5 | 6 | 7 | 0 8 | 0 9 | 221 10 | 206 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | false 21 | 22 | 23 | Form 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /OSHStudio/oshsingenc.cpp: -------------------------------------------------------------------------------- 1 | #include "oshsingenc.h" 2 | #include "ui_oshsingenc.h" 3 | 4 | oshsingenc::oshsingenc(QWidget *parent) : 5 | QWidget(parent), 6 | ui(new Ui::oshsingenc) 7 | { 8 | ui->setupUi(this); 9 | } 10 | 11 | oshsingenc::~oshsingenc() 12 | { 13 | delete ui; 14 | } 15 | 16 | void oshsingenc::showCurrentPair(uint8_t pin_index){ 17 | ui->comboBox_SEA->setCurrentIndex(pin_index); 18 | ui->comboBox_SEB->setCurrentIndex(pin_index); 19 | } 20 | 21 | 22 | void oshsingenc::setPinsPair(uint8_t pin_index) { 23 | pinA = all_enc_pins[pin_index].pinA; 24 | pinB = all_enc_pins[pin_index].pinB; 25 | showCurrentPair(pin_index); 26 | } 27 | 28 | void oshsingenc::clearPinsLists(void){ 29 | ui->comboBox_SEA->clear(); 30 | ui->comboBox_SEB->clear(); 31 | pins_pairs_total = 0; 32 | } 33 | 34 | void oshsingenc::addPins2Lists(uint8_t pinA, uint8_t pinB, uint8_t type){ 35 | QString ptype = ""; 36 | all_enc_pins[pins_pairs_total].pinA = pinA; 37 | all_enc_pins[pins_pairs_total].pinB = pinB; 38 | all_enc_pins[pins_pairs_total++].type = type; 39 | if ((type == Single_Rotary_PINA_1) || (type == Single_Rotary_PINB_1)) ptype = "1/1"; 40 | if ((type == Single_Rotary_PINA_2) || (type == Single_Rotary_PINB_2)) ptype = "1/2"; 41 | if ((type == Single_Rotary_PINA_4) || (type == Single_Rotary_PINB_4)) ptype = "1/4"; 42 | ui->comboBox_SEA->addItem(ptype + " step - " + pin_names[pinA]); 43 | ui->comboBox_SEB->addItem(ptype + " step - " + pin_names[pinB]); 44 | } 45 | 46 | uint8_t oshsingenc::getPinA(void){ 47 | return pinA; 48 | } 49 | 50 | uint8_t oshsingenc::getPinB(void){ 51 | return pinB; 52 | } 53 | 54 | void oshsingenc::setAlarmPinA(bool alarm){ 55 | if (alarm) { 56 | ui->comboBox_SEA->setStyleSheet("QComboBox { color: white; background-color: red; }"); 57 | } else { 58 | ui->comboBox_SEA->setStyleSheet("QComboBox { color: black; background-color: light gray; }"); 59 | } 60 | } 61 | 62 | void oshsingenc::setAlarmPinB(bool alarm){ 63 | if (alarm) { 64 | ui->comboBox_SEB->setStyleSheet("QComboBox { color: white; background-color: red; }"); 65 | } else { 66 | ui->comboBox_SEB->setStyleSheet("QComboBox { color: black; background-color: light gray; }"); 67 | } 68 | } 69 | 70 | void oshsingenc::on_comboBox_SEA_highlighted(int index){ 71 | pinA = all_enc_pins[index].pinA; 72 | emit item_changed(); 73 | } 74 | 75 | void oshsingenc::on_comboBox_SEB_highlighted(int index){ 76 | pinB = all_enc_pins[index].pinB; 77 | emit item_changed(); 78 | } 79 | -------------------------------------------------------------------------------- /OSHStudio/oshsingenc.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHSINGENC_H 2 | #define OSHSINGENC_H 3 | 4 | #include 5 | #include <..\common_types\common_structs.h> 6 | 7 | namespace Ui { 8 | class oshsingenc; 9 | } 10 | 11 | struct sing_enc_store { 12 | uint8_t pinA; 13 | uint8_t pinB; 14 | uint8_t type; 15 | }; 16 | 17 | const QString pin_names[] = { 18 | {"A0"}, 19 | {"A1"}, 20 | {"A2"}, 21 | {"A3"}, 22 | {"A4"}, 23 | {"A5"}, 24 | {"A6"}, 25 | {"A7"}, 26 | {"A8"}, 27 | {"A9"}, 28 | {"A10"}, 29 | {"A11"}, 30 | {"A12"}, 31 | {"A15"}, 32 | {"B0"}, 33 | {"B1"}, 34 | {"B3"}, 35 | {"B4"}, 36 | {"B5"}, 37 | {"B6"}, 38 | {"B7"}, 39 | {"B8"}, 40 | {"B9"}, 41 | {"B10"}, 42 | {"B11"}, 43 | {"B12"}, 44 | {"B13"}, 45 | {"B14"}, 46 | {"B15"}, 47 | {"C13"}, 48 | {"C14"}, 49 | {"C15"}, 50 | }; 51 | 52 | 53 | class oshsingenc : public QWidget 54 | { 55 | Q_OBJECT 56 | 57 | public: 58 | explicit oshsingenc(QWidget *parent = 0); 59 | ~oshsingenc(); 60 | void setPinsPair(uint8_t pin_index); 61 | void clearPinsLists(void); 62 | void addPins2Lists(uint8_t pinA, uint8_t pinB, uint8_t type); 63 | uint8_t getPinA(void); 64 | uint8_t getPinB(void); 65 | void setAlarmPinA(bool alarm); 66 | void setAlarmPinB(bool alarm); 67 | 68 | private: 69 | void showCurrentPair(uint8_t pin_index); 70 | Ui::oshsingenc *ui; 71 | uint8_t pinA; 72 | uint8_t pinB; 73 | uint8_t type; 74 | sing_enc_store all_enc_pins[USEDPINS]; 75 | uint8_t pins_pairs_total; 76 | QStringList PinsA; 77 | QStringList PinsB; 78 | 79 | signals: 80 | void item_changed(); 81 | private slots: 82 | void on_comboBox_SEA_highlighted(int index); 83 | void on_comboBox_SEB_highlighted(int index); 84 | }; 85 | 86 | #endif // OSHSINGENC_H 87 | -------------------------------------------------------------------------------- /OSHStudio/oshsingenc.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | oshsingenc 4 | 5 | 6 | 7 | 0 8 | 0 9 | 199 10 | 72 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 19 | 98 20 | 50 21 | 101 22 | 22 23 | 24 | 25 | 26 | 27 | 28 | 29 | 98 30 | 0 31 | 101 32 | 22 33 | 34 | 35 | 36 | 37 | 38 | 39 | -2 40 | 0 41 | 91 42 | 71 43 | 44 | 45 | 46 | 47 | 48 | 49 | :/Images/1053081_zps20151924.jpg 50 | 51 | 52 | true 53 | 54 | 55 | 56 | 57 | 58 | 100 59 | 30 60 | 47 61 | 13 62 | 63 | 64 | 65 | +3.3V 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /OSHStudio/oshstudio.h: -------------------------------------------------------------------------------- 1 | #ifndef OSHSTUDIO_H 2 | #define OSHSTUDIO_H 3 | 4 | #include 5 | #include "hidapi.h" 6 | #include 7 | #include 8 | #include 9 | #include "osha2bw.h" 10 | #include "..\common_types\common_structs.h" 11 | #include "oshbuttonw.h" 12 | 13 | namespace Ui { 14 | class OSHStudio; 15 | //class WorkerThread; 16 | } 17 | 18 | struct single_encoders_pins { 19 | uint8_t pinA; 20 | uint8_t pinB; 21 | }; 22 | 23 | struct A2B_params { 24 | osha2bw * widget_ptr; 25 | uint8_t number_buttons; 26 | uint8_t pin_number; 27 | }; 28 | 29 | struct SB_params { 30 | oshbuttonw * SB_wid_prt; 31 | button_mode button_type; 32 | }; 33 | 34 | struct pin_comp_geometry { 35 | QString Label_name; 36 | uint16_t Label_X; 37 | uint16_t Label_Y; 38 | QString ComboBox_name; 39 | uint16_t ComboBox_X; 40 | uint16_t ComboBox_Y; 41 | }; 42 | 43 | 44 | class OSHStudio : public QMainWindow 45 | { 46 | Q_OBJECT 47 | 48 | public: 49 | explicit OSHStudio(QWidget *parent = 0); 50 | ~OSHStudio(); 51 | 52 | private: 53 | Ui::OSHStudio *ui; 54 | // hid_device *handle_device; 55 | struct total_config_ config; 56 | struct single_encoders_pins single_encoders_1_store[MAX_SINGLE_ENCODERS]; 57 | struct single_encoders_pins single_encoders_2_store[MAX_SINGLE_ENCODERS]; 58 | struct single_encoders_pins single_encoders_4_store[MAX_SINGLE_ENCODERS]; 59 | struct A2B_params A2Bstore[MAX_A2B_INPUTS]; 60 | struct SB_params SBstore[MAX_BUTTONS]; 61 | uint8_t single_encoders_1; 62 | uint8_t single_encoders_2; 63 | uint8_t single_encoders_4; 64 | QStringList PINAlist, PINBlist; 65 | uint8_t NumberAnalogInputs; 66 | uint8_t Chain_PinA; 67 | uint8_t Chain_PinB; 68 | uint8_t Chain_Rotaries_1; 69 | uint8_t Chain_Rotaries_2; 70 | uint8_t Chain_Rotaries_4; 71 | uint8_t Single_Rotaries_PINA_1; 72 | uint8_t Single_Rotaries_PINB_1; 73 | uint8_t Single_Rotaries_PINA_2; 74 | uint8_t Single_Rotaries_PINB_2; 75 | uint8_t Single_Rotaries_PINA_4; 76 | uint8_t Single_Rotaries_PINB_4; 77 | uint8_t ButtonsRows; 78 | uint8_t ButtonsColumns; 79 | uint8_t Buttons; 80 | uint8_t A2BButtons = 0; 81 | uint16_t TotalButtons; 82 | uint8_t RotSwitchPoles; 83 | uint8_t RotSwitchWires; 84 | uint8_t Analog2Buttons_inputs; 85 | uint8_t pov1; 86 | uint8_t pov2; 87 | uint8_t pov3; 88 | uint8_t pov4; 89 | uint16_t axes_shapes[MAX_AXES][SHAPEVALUES]; 90 | bool config_mode; 91 | bool file_logging; 92 | QFile logfile; 93 | QTextStream logstream; 94 | 95 | private slots: 96 | void drawHelpSB(void); 97 | void setShapesW(void); 98 | void get_all_A2B_buttons(void); 99 | void get_all_SB_buttons(void); 100 | void populateDefSB(void); 101 | void getConfig_Slot(); 102 | void gatherConfig_Slot(); 103 | void getACKpacket(uint8_t *); 104 | void getConfigPacket(uint8_t *); 105 | void writeConfig_Slot(); 106 | void resetConfig_Slot(); 107 | void setConfig_Slot(); 108 | void restoreConfig_Slot(); 109 | void resetConfigValues(void); 110 | void show_USB_ident_uniq(QString ident); 111 | void show_USB_exch_rate(int interval); 112 | void showBoardType(int boardtype); 113 | uint8_t convertPinnameToIndex (QString pname); 114 | void drawHelpSE(); 115 | void profile_name_changed(QString); 116 | void getGamepadPacket(uint8_t *); 117 | void showConnectDeviceInfo(); 118 | void hideConnectDeviceInfo(); 119 | void showPercentAxisComb(int i); 120 | void showPin1AxisComb(QString pinname); 121 | void showPin2AxisComb(QString pinname); 122 | void showAxisCombSection(bool checked); 123 | void showAxisCombSlider(bool state); 124 | void loadFromFile(); 125 | void saveToFile(); 126 | void drawHelp(); 127 | void gatherPinsConf(); 128 | void pinConfChanged(); 129 | void populateDefSE(); 130 | void populateDefA2B(); 131 | void showA2Btab(); 132 | void resetAllA2B(); 133 | void showSingleEncodersTab(void); 134 | void current_profile_changed(int current_profile); 135 | void update_ro_shapes(void); 136 | void setSensorsValue(uint8_t *buffer); 137 | void on_startLog_Button_toggled(bool checked); 138 | }; 139 | 140 | #endif // OSHSTUDIO_H 141 | -------------------------------------------------------------------------------- /OSHStudio/oshstudio.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | Images/MDB_pic.jpg 4 | Images/cropped-OK-big-green-button.png 5 | Images/openhardware.ico 6 | Images/OFF.png 7 | Images/ON_2.png 8 | Images/dpad.png 9 | Images/dpad_cb.png 10 | Images/dpad_cbl.png 11 | Images/dpad_cl.png 12 | Images/dpad_clt.png 13 | Images/dpad_cr.png 14 | Images/dpad_crb.png 15 | Images/dpad_ct.png 16 | Images/dpad_ctr.png 17 | Images/1053081_zps20151924.jpg 18 | Images/boardTypeII.jpg 19 | Images/OFF_small.png 20 | Images/OFF_small_t.png 21 | Images/ON_small_t.png 22 | 23 | 24 | -------------------------------------------------------------------------------- /OSHStudio/worker.cpp: -------------------------------------------------------------------------------- 1 | #include "worker.h" 2 | #include 3 | #include "hidapi.h" 4 | #include "../common_types/common_structs.h" 5 | 6 | extern hid_device *handle_read; 7 | //TODO make it non-global 8 | 9 | void Worker::processData(void) { 10 | uint8_t buf[BUFFSIZE]={0}; 11 | int res=0; 12 | struct gamepad_report_ empty_gamepad_report; 13 | struct sensor_report_ empty_sensor_report; 14 | uint8_t empty_buf_gamepad[sizeof(struct gamepad_report_)]; 15 | uint8_t empty_buf_sensor[sizeof(struct sensor_report_)]; 16 | uint8_t i = 0; 17 | const uint8_t hb_packet[BUFFSIZE] = {2,254,0}; 18 | 19 | empty_gamepad_report.packet_id = 1; 20 | empty_gamepad_report.buttons = 0; 21 | for (uint8_t i=0;i 5 | #include 6 | #include "..\common_types\common_defines.h" 7 | 8 | class Worker : public QObject { 9 | Q_OBJECT 10 | 11 | public slots: 12 | void processData(void); 13 | 14 | 15 | signals: 16 | void putDisconnectedDeviceInfo(void); 17 | void putConnectedDeviceInfo(void); 18 | void putConfigPacket(uint8_t *); 19 | void putACKpacket(uint8_t *); 20 | void putGamepadPacket(uint8_t *); 21 | void putSensorPacket(uint8_t *); 22 | void putHBPacket(void); 23 | 24 | private: 25 | uint16_t adc_value=0; 26 | uint8_t channel=0; 27 | QTime current_time; 28 | }; 29 | 30 | 31 | #endif // WORKER_H 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenSimHardware Pedals & Buttons Controller 2 | 3 | STM32F103C8T6-based Pedals & Buttons Controller (Joystick/GamePad interface) for DIY pedals, button boxes, shifters, hand brakes, etc 4 | 5 | Capabilities: 6 | - 6x 12-bit (4096 steps) axises 7 | - support rotary encoders 8 | - support buttons in matrix 9 | - support single buttons 10 | - support rotary switches 11 | - support POV Hat Switches 12 | - up to 1kHz exchange rate with PC 13 | 14 | 15 |
16 | Default Pinout:
17 | 		 STM32F103C8T6
18 | 		  -----------------
19 | 		- |3VB		 +3.3V| -
20 |   		- |C13		   GND| -
21 |   COL1	- |C14		   +5V| - 
22 |   COL2	- |C15		    B9| - ROW6
23 |   ADC0 	- |A0		    B8| - ROW5
24 |   ADC1 	- |A1		    B7| - ROW4
25 |   ADC2	- |A2		    B6| - ROW3
26 |   ADC3	- |A3		    B5| - ROW2
27 |   ADC4	- |A4		    B4| - ROW1
28 |   ADC5	- |A5		    B3| - COL4
29 |   ROT10	- |A6		   A15| - ROT9
30 |   COL6	- |A7		   A12| - 
31 |   ROT1	- |B0		   A11| - 
32 |   ROT2	- |B1		   A10| - ROT8
33 |   ROTA	- |B10		    A9| - ROT7
34 |   ROTB	- |B11		    A8| - ROT6
35 | 		- |R		   B15| - ROT5
36 | 		- |+3.3V	   B14| - ROT4
37 | 		- |GND		   B13| - ROT3
38 | 		- |GND		   B12| - COL3
39 | 		  ----------------
40 | 		  
41 | 
42 | 43 | 44 | Project URL - https://opensimhardware.wordpress.com/pedal-button-controller/ -------------------------------------------------------------------------------- /STM32F103C6_FLASH.ld: -------------------------------------------------------------------------------- 1 | /* 2 | ***************************************************************************** 3 | ** 4 | 5 | ** File : stm32_flash.ld 6 | ** 7 | ** Abstract : Linker script for STM32F103C6 Device with 8 | ** 32KByte FLASH, 10KByte RAM 9 | ** 10 | ** Set heap size, stack size and stack location according 11 | ** to application requirements. 12 | ** 13 | ** Set memory bank area and size if external memory is used. 14 | ** 15 | ** Target : STMicroelectronics STM32 16 | ** 17 | ** Environment : Atollic TrueSTUDIO(R) 18 | ** 19 | ** Distribution: The file is distributed as is, without any warranty 20 | ** of any kind. 21 | ** 22 | ** (c)Copyright Atollic AB. 23 | ** You may use this file as-is or modify it according to the needs of your 24 | ** project. This file may only be built (assembled or compiled and linked) 25 | ** using the Atollic TrueSTUDIO(R) product. The use of this file together 26 | ** with other tools than Atollic TrueSTUDIO(R) is not permitted. 27 | ** 28 | ***************************************************************************** 29 | */ 30 | 31 | /* Entry Point */ 32 | ENTRY(Reset_Handler) 33 | 34 | /* Highest address of the user mode stack */ 35 | _estack = 0x20002800; /* end of RAM */ 36 | /* Generate a link error if heap and stack don't fit into RAM */ 37 | _Min_Heap_Size = 0x200; /* required amount of heap */ 38 | _Min_Stack_Size = 0x400; /* required amount of stack */ 39 | 40 | /* Specify the memory areas */ 41 | MEMORY 42 | { 43 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K 44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 10K 45 | } 46 | 47 | /* Define output sections */ 48 | SECTIONS 49 | { 50 | /* The startup code goes first into FLASH */ 51 | .isr_vector : 52 | { 53 | . = ALIGN(4); 54 | KEEP(*(.isr_vector)) /* Startup code */ 55 | . = ALIGN(4); 56 | } >FLASH 57 | 58 | /* The program code and other data goes into FLASH */ 59 | .text : 60 | { 61 | . = ALIGN(4); 62 | *(.text) /* .text sections (code) */ 63 | *(.text*) /* .text* sections (code) */ 64 | *(.glue_7) /* glue arm to thumb code */ 65 | *(.glue_7t) /* glue thumb to arm code */ 66 | *(.eh_frame) 67 | 68 | KEEP (*(.init)) 69 | KEEP (*(.fini)) 70 | 71 | . = ALIGN(4); 72 | _etext = .; /* define a global symbols at end of code */ 73 | } >FLASH 74 | 75 | /* Constant data goes into FLASH */ 76 | .rodata : 77 | { 78 | . = ALIGN(4); 79 | *(.rodata) /* .rodata sections (constants, strings, etc.) */ 80 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 81 | . = ALIGN(4); 82 | } >FLASH 83 | 84 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH 85 | .ARM : { 86 | __exidx_start = .; 87 | *(.ARM.exidx*) 88 | __exidx_end = .; 89 | } >FLASH 90 | 91 | .preinit_array : 92 | { 93 | PROVIDE_HIDDEN (__preinit_array_start = .); 94 | KEEP (*(.preinit_array*)) 95 | PROVIDE_HIDDEN (__preinit_array_end = .); 96 | } >FLASH 97 | .init_array : 98 | { 99 | PROVIDE_HIDDEN (__init_array_start = .); 100 | KEEP (*(SORT(.init_array.*))) 101 | KEEP (*(.init_array*)) 102 | PROVIDE_HIDDEN (__init_array_end = .); 103 | } >FLASH 104 | .fini_array : 105 | { 106 | PROVIDE_HIDDEN (__fini_array_start = .); 107 | KEEP (*(SORT(.fini_array.*))) 108 | KEEP (*(.fini_array*)) 109 | PROVIDE_HIDDEN (__fini_array_end = .); 110 | } >FLASH 111 | 112 | /* used by the startup to initialize data */ 113 | _sidata = LOADADDR(.data); 114 | 115 | /* Initialized data sections goes into RAM, load LMA copy after code */ 116 | .data : 117 | { 118 | . = ALIGN(4); 119 | _sdata = .; /* create a global symbol at data start */ 120 | *(.data) /* .data sections */ 121 | *(.data*) /* .data* sections */ 122 | 123 | . = ALIGN(4); 124 | _edata = .; /* define a global symbol at data end */ 125 | } >RAM AT> FLASH 126 | 127 | 128 | /* Uninitialized data section */ 129 | . = ALIGN(4); 130 | .bss : 131 | { 132 | /* This is used by the startup in order to initialize the .bss secion */ 133 | _sbss = .; /* define a global symbol at bss start */ 134 | __bss_start__ = _sbss; 135 | *(.bss) 136 | *(.bss*) 137 | *(COMMON) 138 | 139 | . = ALIGN(4); 140 | _ebss = .; /* define a global symbol at bss end */ 141 | __bss_end__ = _ebss; 142 | } >RAM 143 | 144 | /* User_heap_stack section, used to check that there is enough RAM left */ 145 | ._user_heap_stack : 146 | { 147 | . = ALIGN(4); 148 | PROVIDE ( end = . ); 149 | PROVIDE ( _end = . ); 150 | . = . + _Min_Heap_Size; 151 | . = . + _Min_Stack_Size; 152 | . = ALIGN(4); 153 | } >RAM 154 | 155 | 156 | 157 | /* Remove information from the standard libraries */ 158 | /DISCARD/ : 159 | { 160 | libc.a ( * ) 161 | libm.a ( * ) 162 | libgcc.a ( * ) 163 | } 164 | 165 | .ARM.attributes 0 : { *(.ARM.attributes) } 166 | } 167 | 168 | 169 | -------------------------------------------------------------------------------- /STM32Mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/STM32Mini.png -------------------------------------------------------------------------------- /Src/flash_store.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : flash_store.c 4 | * @brief : Flash reading/writing library 5 | * 6 | * ---------------------------------------------------------------------------------- 7 | * Copyright (c) 2016 Dmitry Skulkin * 8 | * * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 10 | * of this software and associated documentation files (the "Software"), to deal * 11 | * in the Software without restriction, including without limitation the rights * 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 13 | * copies of the Software, and to permit persons to whom the Software is * 14 | * furnished to do so, subject to the following conditions: * 15 | * * 16 | * The above copyright notice and this permission notice shall be included in all * 17 | * copies or substantial portions of the Software. * 18 | * * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 25 | * SOFTWARE. * 26 | * ---------------------------------------------------------------------------------- 27 | * */ 28 | 29 | #include 30 | #include <..\common_types\common_structs.h> 31 | #include 32 | 33 | 34 | volatile extern struct total_config_ config; 35 | 36 | 37 | uint16_t * get_lastpage_addr(uint16_t * flash_size_reg_addr) { 38 | uint16_t flash_size; 39 | 40 | flash_size = *flash_size_reg_addr; 41 | 42 | return (uint16_t *)(FLASH_BASE + (flash_size-1)*1024); 43 | 44 | } 45 | 46 | 47 | void get_config(void) { 48 | uint16_t * curradr; 49 | 50 | curradr = get_lastpage_addr((uint16_t *)FLASHSIZEREG); 51 | 52 | for (uint8_t i=0; iKEYR = FLASH_KEY1; 61 | // FLASH->KEYR = FLASH_KEY2; 62 | 63 | /* Clear 2 page */ 64 | // FLASH->CR |= FLASH_CR_PER; /* Page erase */ 65 | // FLASH->AR = (uint32_t)get_lastpage_addr((uint16_t *)FLASHSIZEREG); 66 | // FLASH->CR|= FLASH_CR_STRT; /* Start erase */ 67 | // while ((FLASH->SR & FLASH_SR_BSY) != 0 ) /* Wait end of erase */ 68 | // ; 69 | // FLASH->CR &= ~FLASH_CR_PER; /* Page erase end */ 70 | // FLASH->CR |= FLASH_CR_LOCK; /* Lock the flash back */ 71 | 72 | //} 73 | 74 | void write_flash(void) { 75 | uint16_t * currflashaddr; 76 | uint16_t * currstructaddr; 77 | 78 | /* Authorize the FPEC Access */ 79 | FLASH->KEYR = FLASH_KEY1; 80 | FLASH->KEYR = FLASH_KEY2; 81 | 82 | /* Clear last page */ 83 | FLASH->CR |= FLASH_CR_PER; /* Page erase */ 84 | FLASH->AR = (uint32_t)get_lastpage_addr((uint16_t *)FLASHSIZEREG); 85 | FLASH->CR|= FLASH_CR_STRT; /* Start erase */ 86 | while ((FLASH->SR & FLASH_SR_BSY) != 0 ) /* Wait end of erase */ 87 | ; 88 | FLASH->CR &= ~FLASH_CR_PER; /* Page erase end */ 89 | 90 | 91 | while ((FLASH->SR & FLASH_SR_BSY) != 0 ); 92 | 93 | FLASH->CR &= ~FLASH_CR_PER; 94 | 95 | currflashaddr = get_lastpage_addr((uint16_t *)FLASHSIZEREG); 96 | currstructaddr = (uint16_t *)&(config.packet_id1); 97 | 98 | FLASH->CR |= FLASH_CR_PG; /* Programm the flash */ 99 | 100 | 101 | for (uint16_t i=0; iSR & FLASH_SR_BSY) != 0 ); 103 | *currflashaddr++ = *currstructaddr++; 104 | } 105 | 106 | FLASH->CR &= ~FLASH_CR_PG; /* Reset the flag back !!!! */ 107 | FLASH->CR |= FLASH_CR_LOCK; /* Lock the flash back */ 108 | } 109 | -------------------------------------------------------------------------------- /Src/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : main.c 4 | * @brief : Main program body 5 | * 6 | * ---------------------------------------------------------------------------------- 7 | * Copyright (c) 2017 Dmitry Skulkin * 8 | * * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 10 | * of this software and associated documentation files (the "Software"), to deal * 11 | * in the Software without restriction, including without limitation the rights * 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 13 | * copies of the Software, and to permit persons to whom the Software is * 14 | * furnished to do so, subject to the following conditions: * 15 | * * 16 | * The above copyright notice and this permission notice shall be included in all * 17 | * copies or substantial portions of the Software. * 18 | * * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 25 | * SOFTWARE. * 26 | * ---------------------------------------------------------------------------------- 27 | * */ 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "periph_init.h" 30 | #include "rotary.h" 31 | #include "keypad.h" 32 | #include "usbd_customhid.h" 33 | #include "usb_device.h" 34 | #include "..\common_types\common_structs.h" 35 | 36 | DMA_HandleTypeDef hdma_adc1; 37 | //volatile uint8_t USBSendBuffer[USEDPINS+1]={1,0}; //1 report id, 8 bytes buttons, 12 bytes for 6 axes 38 | //volatile extern uint16_t Rot_Press_Time; 39 | 40 | int main(void) 41 | 42 | { 43 | /* Configure the system clock, Initializes the Flash interface and the Systick */ 44 | sysclock_init(); 45 | 46 | /* Initialize all configured peripherals */ 47 | gpio_init(); 48 | // adc_init(); 49 | MX_USB_DEVICE_Init(); 50 | 51 | 52 | while (1) 53 | { 54 | CheckRotaries(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Src/rotary.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ---------------------------------------------------------------------------------- 3 | * @file : rotary.c 4 | * @brief : Rotary Encoders support library 5 | * 6 | * ---------------------------------------------------------------------------------- 7 | * Copyright (c) 2016 Dmitry Skulkin * 8 | * * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy * 10 | * of this software and associated documentation files (the "Software"), to deal * 11 | * in the Software without restriction, including without limitation the rights * 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * 13 | * copies of the Software, and to permit persons to whom the Software is * 14 | * furnished to do so, subject to the following conditions: * 15 | * * 16 | * The above copyright notice and this permission notice shall be included in all * 17 | * copies or substantial portions of the Software. * 18 | * * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * 25 | * SOFTWARE. * 26 | * ---------------------------------------------------------------------------------- 27 | * 28 | * Based on Ben Buxton code with different state table 29 | * http://www.buxtronix.net/2011/10/rotary-encoders-done-properly.html 30 | * 31 | * */ 32 | 33 | 34 | #include "rotary.h" 35 | #include "..\common_types\common_structs.h" 36 | #include "keypad.h" 37 | 38 | 39 | 40 | const uint8_t fulltable[7][4] = { 41 | {0x0, 0x5, 0x2, 0x0}, 42 | {DIR_CW, 0x1, 0x1, 0x1}, 43 | {0x0, 0x2, 0x2, 0x3}, 44 | {0x0, 0x1, 0x3, 0x3}, 45 | {0x0, 0x4, 0x6, 0x4}, 46 | {0x0, 0x5, 0x5, 0x4}, 47 | {DIR_CCW, 0x6, 0x6, 0x6}, 48 | }; 49 | 50 | const uint8_t halftable[6][4] = { 51 | {0x0, 0x4, 0x2, 0x3}, 52 | {DIR_CW, 0x1, 0x1, 0x1 }, 53 | {0x2, 0x2, 0x2, 0x3 | DIR_CW}, 54 | {0x0, 0x1, 0x5, 0x3}, 55 | {0x4, 0x4, 0x4, 0x3 | DIR_CCW}, 56 | {DIR_CCW, 0x5, 0x5, 0x5 }, 57 | }; 58 | 59 | const uint8_t quarttable[4][4] = { 60 | {0x0, 0x1 | DIR_CCW, 0x2 | DIR_CW, 0x3}, 61 | {DIR_CW, 0x1, 0x1, 0x3 | DIR_CCW}, 62 | {DIR_CCW, 0x2, 0x2, 0x3 | DIR_CW}, 63 | {0x0, 0x1 | DIR_CW, 0x2 | DIR_CCW, 0x3}, 64 | }; 65 | 66 | 67 | 68 | 69 | volatile struct rots RotaryStore[USEDPINS]; 70 | extern struct pin_conf pins[USEDPINS]; 71 | //volatile extern uint16_t Rot_Debounce_Time; 72 | volatile extern uint64_t millis; 73 | volatile extern struct total_config_ config; 74 | 75 | volatile uint8_t pinstate, rowstateA, rowstateB; 76 | 77 | /* Read input pins and process for events. Call this either from a 78 | * loop or an interrupt (eg pin change or timer). 79 | * 80 | * Returns 0 on no event, otherwise 0x80 or 0x40 depending on the direction. 81 | */ 82 | uint8_t rotary_process(uint8_t i, pintype type, uint32_t *PINA_Addr, uint32_t *PINB_Addr, uint16_t PINA, uint16_t PINB) { 83 | // uint8_t pinstate, rowstateA, rowstateB; 84 | 85 | 86 | if (((*PINA_Addr) & PINA) != 0) { 87 | rowstateA = 1; 88 | } else { 89 | rowstateA = 0; 90 | } 91 | 92 | if (((*PINB_Addr) & PINB) != 0) { 93 | rowstateB = 1; 94 | } else { 95 | rowstateB = 0; 96 | } 97 | 98 | pinstate = (uint8_t)(rowstateA << 1) | rowstateB; 99 | 100 | if ((type == Chain_Rotary_Enc_1) || (type == Single_Rotary_PINA_1)) 101 | RotaryStore[i].state = fulltable[RotaryStore[i].state & 0xf][pinstate]; 102 | if ((type == Chain_Rotary_Enc_2) || (type == Single_Rotary_PINA_2)) 103 | RotaryStore[i].state = halftable[RotaryStore[i].state & 0xf][pinstate]; 104 | if (type == Single_Rotary_PINA_4) 105 | RotaryStore[i].state = quarttable[RotaryStore[i].state & 0xf][pinstate]; 106 | return (RotaryStore[i].state & 0x30); 107 | } 108 | 109 | //volatile uint32_t tmp; 110 | //volatile uint8_t tmpi; 111 | 112 | void CheckRotaries(void){ 113 | uint8_t res,j=0; 114 | extern uint32_t * Rot_PINA_IDR, * Rot_PINB_IDR; 115 | extern uint16_t Rot_PINA_pin, Rot_PINB_pin; 116 | extern uint8_t Number_Rotaries;//, Number_Single_Rotaries; 117 | extern struct rot_conf Single_rotaries[USEDPINS]; 118 | extern uint8_t encoders_offset; 119 | extern struct keypad buttons[MAX_BUTTONS]; 120 | 121 | 122 | for (uint8_t i=0;iconfig.rotary_debounce_time) {RotaryStore[j].pressed = res; RotaryStore[j].time_pressed=millis;} 127 | *(pins[i].bsrr_reg_addr) = 0x1<<(pins[i].pin_number+16); 128 | j++; 129 | } 130 | } 131 | 132 | j=Number_Rotaries; 133 | for (uint8_t i=0; i < config.total_single_encoders; i++){ 134 | res = rotary_process(j, Single_rotaries[i].PINA_Type, Single_rotaries[i].PINA_IDR, Single_rotaries[i].PINB_IDR, Single_rotaries[i].PINAmask, Single_rotaries[i].PINBmask); 135 | if ((res) && (millis-RotaryStore[j].time_pressed)>config.rotary_debounce_time) {RotaryStore[j].pressed = res; RotaryStore[j].time_pressed=millis;} 136 | j++; 137 | } 138 | 139 | for (uint8_t i=0;i config.rotary_press_time) { 142 | // USBSendBuffer[(i/4)+encoders_offset] &= ~ButtonsCodes[(i%4)*2]; 143 | // USBSendBuffer[(i/4)+encoders_offset] &= ~ButtonsCodes[(i%4)*2+1]; 144 | buttons[(i*2)+encoders_offset].pressed = 0; 145 | buttons[(i*2)+1+encoders_offset].pressed = 0; 146 | RotaryStore[i].pressed = 0; 147 | RotaryStore[i].previous_state = 0; 148 | } else { 149 | if (!RotaryStore[i].previous_state){ 150 | if (RotaryStore[i].pressed == DIR_CW) { 151 | //USBSendBuffer[(i/4)+encoders_offset] |= ButtonsCodes[(i%4)*2]; 152 | buttons[(i*2)+encoders_offset].pressed = 1; 153 | } 154 | if (RotaryStore[i].pressed == DIR_CCW) { 155 | //USBSendBuffer[(i/4)+encoders_offset] |= ButtonsCodes[(i%4)*2+1]; 156 | buttons[(i*2)+1+encoders_offset].pressed = 1; 157 | } 158 | RotaryStore[i].previous_state = RotaryStore[i].pressed; 159 | } 160 | } 161 | } 162 | 163 | } 164 | -------------------------------------------------------------------------------- /Src/usb_device.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file : USB_DEVICE 4 | * @version : v1.0_Cube 5 | * @brief : This file implements the USB Device 6 | ****************************************************************************** 7 | * 8 | * COPYRIGHT(c) 2016 STMicroelectronics 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | ****************************************************************************** 33 | */ 34 | 35 | /* Includes ------------------------------------------------------------------*/ 36 | 37 | #include "usb_device.h" 38 | #include "usbd_core.h" 39 | #include "usbd_desc.h" 40 | #include "usbd_customhid.h" 41 | #include "usbd_custom_hid_if.h" 42 | 43 | /* USB Device Core handle declaration */ 44 | USBD_HandleTypeDef hUsbDeviceFS; 45 | 46 | /* init function */ 47 | void MX_USB_DEVICE_Init(void) 48 | { 49 | /* Init Device Library,Add Supported Class and Start the library*/ 50 | USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS); 51 | 52 | USBD_RegisterClass(&hUsbDeviceFS, &USBD_CUSTOM_HID); 53 | 54 | USBD_CUSTOM_HID_RegisterInterface(&hUsbDeviceFS, &USBD_CustomHID_fops_FS); 55 | 56 | USBD_Start(&hUsbDeviceFS); 57 | 58 | } 59 | /** 60 | * @} 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 68 | -------------------------------------------------------------------------------- /Wiring_Scheme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimHardware/PedalButtonController/cf28b5ca3ac601808d2e77f97c44fee625e4c8c2/Wiring_Scheme.jpg -------------------------------------------------------------------------------- /common_types/common_defines.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_DEFINES_H 2 | #define COMMON_DEFINES_H 3 | 4 | 5 | #define OSHSTUDIOVERSION 16 6 | #define FIRMWARERELEASE 16 7 | 8 | #define BUFFSIZE 64 9 | #define USEDPINS 32 10 | #define MAX_AXES 6 11 | #define MAX_SINGLE_ENCODERS 14 12 | #define MAX_A2B_INPUTS 10 13 | #define MAX_A2B_BUTTONS 10 14 | #define MAX_BUTTONS 64 15 | #define MAX_POVS 4 16 | #define MAX_ADC_RES 4096 17 | #define SHAPEVALUES 10 18 | #define HBTIME 10 19 | 20 | #define LOBYTE(x) ((uint8_t)(x & 0x00FF)) 21 | #define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8)) 22 | 23 | 24 | 25 | #endif // COMMON_DEFINES_H 26 | -------------------------------------------------------------------------------- /common_types/common_functions.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_FUNCTIONS_H 2 | #define COMMON_FUNCTIONS_H 3 | 4 | 5 | 6 | #endif // COMMON_FUNCTIONS_H 7 | --------------------------------------------------------------------------------