diff --git a/openrtx/include/interfaces/keyboard.h b/openrtx/include/interfaces/keyboard.h index fade32c1..4534eb4d 100644 --- a/openrtx/include/interfaces/keyboard.h +++ b/openrtx/include/interfaces/keyboard.h @@ -59,8 +59,7 @@ enum keys KEY_F9 = (1 << 27), /* Function button (device specific) */ KEY_F10 = (1 << 28), /* Function button (device specific) */ KEY_F11 = (1 << 29), /* Function button (device specific) */ - KEY_F12 = (1 << 30), /* Function button (device specific) */ - KEY_F13 = (1 << 31) /* Function button (device specific) */ + KEY_F12 = (1 << 30) /* Function button (device specific) */ }; /** diff --git a/platform/mcu/STM32F4xx/drivers/usb/usb_core.c b/platform/mcu/STM32F4xx/drivers/usb/usb_core.c index 12a207d8..2521449e 100644 --- a/platform/mcu/STM32F4xx/drivers/usb/usb_core.c +++ b/platform/mcu/STM32F4xx/drivers/usb/usb_core.c @@ -29,6 +29,15 @@ #include "usb_core.h" #include "usb_bsp.h" +/* Workaround to suppress -Wattributes warning */ +struct __attribute__((packed, aligned(1))) T_UINT32_WRITE { uint32_t v; }; +#define __UNALIGNED_UINT32_WRITE(addr, val) \ + (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + +struct __attribute__((packed, aligned(1))) T_UINT32_READ { uint32_t v; }; +#define __UNALIGNED_UINT32_READ(addr) \ + (((const struct T_UINT32_READ *)(const void *)(addr))->v) + /** @addtogroup USB_OTG_DRIVER * @{ @@ -180,7 +189,7 @@ USB_OTG_STS USB_OTG_WritePacket(USB_OTG_CORE_HANDLE *pdev, fifo = pdev->regs.DFIFO[ch_ep_num]; for (i = 0; i < count32b; i++, src+=4) { - USB_OTG_WRITE_REG32( fifo, *((__packed uint32_t *)src) ); + USB_OTG_WRITE_REG32( fifo, __UNALIGNED_UINT32_READ(src) ); } } return status; @@ -205,7 +214,7 @@ void *USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, for ( i = 0; i < count32b; i++, dest += 4 ) { - *(__packed uint32_t *)dest = USB_OTG_READ_REG32(fifo); + __UNALIGNED_UINT32_WRITE(dest, USB_OTG_READ_REG32(fifo)); } return ((void *)dest); diff --git a/platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.h b/platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.h index 69e525a2..c50b7eee 100644 --- a/platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.h +++ b/platform/mcu/STM32F4xx/drivers/usb/usb_dcd_int.h @@ -59,10 +59,10 @@ typedef struct _USBD_DCD_INT uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); - +#ifdef VBUS_SENSING_ENABLED uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); - +#endif }USBD_DCD_INT_cb_TypeDef; extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; diff --git a/platform/mcu/STM32F4xx/drivers/usb/usbd_req.c b/platform/mcu/STM32F4xx/drivers/usb/usbd_req.c index 39c6570a..0174a6cb 100644 --- a/platform/mcu/STM32F4xx/drivers/usb/usbd_req.c +++ b/platform/mcu/STM32F4xx/drivers/usb/usbd_req.c @@ -826,7 +826,7 @@ void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len) unicode[idx++] = *len; unicode[idx++] = USB_DESC_TYPE_STRING; - while (*desc != NULL) + while (*desc != 0) { unicode[idx++] = *desc++; unicode[idx++] = 0x00; @@ -844,7 +844,7 @@ static uint8_t USBD_GetLen(uint8_t *buf) { uint8_t len = 0; - while (*buf != NULL) + while (*buf != 0) { len++; buf++;