Projectkk2glider/issue 4479 slow joystick (#4569)

* Missing debug timer

* USB driver cleanup

* Re #4479: Joystick update called from mixer thread every 10ms

* Cosmetics

* Compilation fix

* Cosmetics

* Another compilation fix
This commit is contained in:
Damjan Adamic
2017-03-07 22:59:32 +01:00
committed by Bertrand Songis
parent 15a373c1cd
commit 03b65b06b6
12 changed files with 136 additions and 161 deletions
+2 -45
View File
@@ -81,7 +81,9 @@ void interrupt5ms()
if (++pre_scale >= 2) {
pre_scale = 0 ;
DEBUG_TIMER_START(debugTimerPer10ms);
per10ms();
DEBUG_TIMER_STOP(debugTimerPer10ms);
}
#if defined(ROTARY_ENCODER_NAVIGATION)
@@ -262,51 +264,6 @@ void boardOff()
pwrOff();
}
#if defined(USB_JOYSTICK) && !defined(SIMU)
extern USB_OTG_CORE_HANDLE USB_OTG_dev;
/*
Prepare and send new USB data packet
The format of HID_Buffer is defined by
USB endpoint description can be found in
file usb_hid_joystick.c, variable HID_JOYSTICK_ReportDesc
*/
void usbJoystickUpdate(void)
{
static uint8_t HID_Buffer[HID_IN_PACKET];
//buttons
HID_Buffer[0] = 0;
HID_Buffer[1] = 0;
HID_Buffer[2] = 0;
for (int i = 0; i < 8; ++i) {
if ( channelOutputs[i+8] > 0 ) {
HID_Buffer[0] |= (1 << i);
}
if ( channelOutputs[i+16] > 0 ) {
HID_Buffer[1] |= (1 << i);
}
if ( channelOutputs[i+24] > 0 ) {
HID_Buffer[2] |= (1 << i);
}
}
//analog values
//uint8_t * p = HID_Buffer + 1;
for (int i = 0; i < 8; ++i) {
int16_t value = channelOutputs[i] / 8;
if ( value > 127 ) value = 127;
else if ( value < -127 ) value = -127;
HID_Buffer[i+3] = static_cast<int8_t>(value);
}
USBD_HID_SendReport (&USB_OTG_dev, HID_Buffer, HID_IN_PACKET );
}
#endif // #defined(USB_JOYSTICK) && !defined(SIMU)
uint8_t currentTrainerMode = 0xff;
void checkTrainerSettings()
+8 -8
View File
@@ -454,11 +454,15 @@ uint8_t isBacklightEnabled(void);
#endif
// USB driver
int usbPlugged(void);
void usbInit(void);
void usbStart(void);
void usbStop(void);
int usbPlugged();
void usbInit();
void usbStart();
void usbStop();
uint8_t usbStarted();
void usbSerialPutc(uint8_t c);
#if defined(USB_JOYSTICK) && !defined(SIMU)
void usbJoystickUpdate();
#endif
#define USB_NAME "FrSky Taranis"
#define USB_MANUFACTURER 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ' /* 8 bytes */
#define USB_PRODUCT 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ' /* 8 Bytes */
@@ -612,10 +616,6 @@ void setTopBatteryValue(uint32_t volts);
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
#if defined(USB_JOYSTICK) && !defined(SIMU)
void usbJoystickUpdate(void);
#endif
extern uint8_t currentTrainerMode;
void checkTrainerSettings(void);
@@ -55,7 +55,7 @@ set(BOOTLOADER_SRC
../../common/arm/stm32/delays.cpp
../../common/arm/stm32/usbd_desc.c
../../common/arm/stm32/usb_bsp.c
../../common/arm/stm32/usb_driver.c
../../common/arm/stm32/usb_driver.cpp
../pwr_driver.cpp
init.c
boot.cpp