diff --git a/libopencm3 b/libopencm3 index b0e050d..239b4a4 160000 --- a/libopencm3 +++ b/libopencm3 @@ -1 +1 @@ -Subproject commit b0e050d10d12c42be031c34822117cfd3c5a0ea7 +Subproject commit 239b4a47040079743cd03df370135d9364e15ab7 diff --git a/src/CAN/can.c b/src/CAN/can.c index dfc2070..fa31b2c 100644 --- a/src/CAN/can.c +++ b/src/CAN/can.c @@ -140,8 +140,7 @@ bool can_reconfigure(uint32_t baudrate, CanMode mode) { silent) != 0) { return false; } else { - can_filter_id_mask_32bit_init(CAN1, - 0, /* Filter ID */ + can_filter_id_mask_32bit_init(0, /* Filter ID */ 0, /* CAN ID */ 0, /* CAN ID mask */ 0, /* FIFO assignment (here: FIFO0) */ diff --git a/src/USB/cdc.c b/src/USB/cdc.c index b5a7335..df6a8a7 100644 --- a/src/USB/cdc.c +++ b/src/USB/cdc.c @@ -100,17 +100,18 @@ bool cdc_send_data(const uint8_t* data, size_t len) { return (sent != 0); } -static int cdc_control_class_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +cdc_control_class_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { (void)complete; (void)usbd_dev; if (req->wIndex != INTF_CDC_DATA && req->wIndex != INTF_CDC_COMM) { return USBD_REQ_NEXT_CALLBACK; } - int status = USBD_REQ_NOTSUPP; + enum usbd_request_return_codes status = USBD_REQ_NOTSUPP; switch (req->bRequest) { case USB_CDC_REQ_SET_CONTROL_LINE_STATE: { diff --git a/src/USB/composite_usb_conf.c b/src/USB/composite_usb_conf.c index e7d1868..e8d5c9f 100644 --- a/src/USB/composite_usb_conf.c +++ b/src/USB/composite_usb_conf.c @@ -478,12 +478,13 @@ void cmp_usb_register_control_class_callback(uint16_t interface, } } -static int cmp_usb_dispatch_control_class_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +cmp_usb_dispatch_control_class_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { - int result = USBD_REQ_NEXT_CALLBACK; + enum usbd_request_return_codes result = USBD_REQ_NEXT_CALLBACK; uint8_t i; uint16_t interface = req->wIndex; diff --git a/src/USB/dfu.c b/src/USB/dfu.c index 1b94546..8b6020d 100644 --- a/src/USB/dfu.c +++ b/src/USB/dfu.c @@ -38,10 +38,11 @@ const struct usb_dfu_descriptor dfu_function = { /* User callbacks */ static GenericCallback dfu_detach_request_callback = NULL; -static int dfu_control_class_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +dfu_control_class_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { (void)complete; (void)buf; (void)len; @@ -50,7 +51,7 @@ static int dfu_control_class_request(usbd_device *usbd_dev, return USBD_REQ_NEXT_CALLBACK; } - int status = USBD_REQ_NOTSUPP; + enum usbd_request_return_codes status = USBD_REQ_NOTSUPP; switch (req->bRequest) { case DFU_DETACH: { if (dfu_detach_request_callback != NULL) { diff --git a/src/USB/hid.c b/src/USB/hid.c index 76f1046..49eff00 100644 --- a/src/USB/hid.c +++ b/src/USB/hid.c @@ -65,10 +65,11 @@ static HostInFunction hid_report_in_callback = NULL; static usbd_device* hid_usbd_dev = NULL; -static int hid_control_standard_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +hid_control_standard_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { (void)complete; (void)usbd_dev; @@ -103,10 +104,11 @@ static int hid_control_standard_request(usbd_device *usbd_dev, return status; } -static int hid_control_class_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +hid_control_class_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { (void)complete; (void)usbd_dev; @@ -114,7 +116,7 @@ static int hid_control_class_request(usbd_device *usbd_dev, return USBD_REQ_NEXT_CALLBACK; } - int status = USBD_REQ_NOTSUPP; + enum usbd_request_return_codes status = USBD_REQ_NOTSUPP; switch (req->bRequest) { case USB_HID_REQ_GET_REPORT: { if ((hid_report_in_callback != NULL) && (*buf != NULL)) { diff --git a/src/USB/vcdc.c b/src/USB/vcdc.c index d31f8e4..f56a285 100644 --- a/src/USB/vcdc.c +++ b/src/USB/vcdc.c @@ -142,10 +142,11 @@ size_t vcdc_send_buffer_space(void) { static GenericCallback vcdc_rx_callback = NULL; static GenericCallback vcdc_tx_callback = NULL; -static int vcdc_control_class_request(usbd_device *usbd_dev, - struct usb_setup_data *req, - uint8_t **buf, uint16_t *len, - usbd_control_complete_callback* complete) { +static enum usbd_request_return_codes +vcdc_control_class_request(usbd_device *usbd_dev, + struct usb_setup_data *req, + uint8_t **buf, uint16_t *len, + usbd_control_complete_callback* complete) { (void)complete; (void)usbd_dev; (void)buf; @@ -154,7 +155,7 @@ static int vcdc_control_class_request(usbd_device *usbd_dev, if (req->wIndex != INTF_VCDC_DATA && req->wIndex != INTF_VCDC_COMM) { return USBD_REQ_NEXT_CALLBACK; } - int status = USBD_REQ_NOTSUPP; + enum usbd_request_return_codes status = USBD_REQ_NOTSUPP; switch (req->bRequest) { case USB_CDC_REQ_SET_CONTROL_LINE_STATE: { diff --git a/src/console.c b/src/console.c index 39c3592..c7a7cd7 100644 --- a/src/console.c +++ b/src/console.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "console.h" #include "target.h" @@ -205,7 +206,7 @@ uint8_t console_recv_blocking(void) { } void CONSOLE_USART_IRQ_NAME(void) { - if (usart_get_flag(CONSOLE_USART, USART_SR_TXE)) { + if (usart_get_flag(CONSOLE_USART, USART_FLAG_TXE)) { if (!console_tx_buffer_empty()) { usart_word_t buffered_byte = console_tx_buffer_get(); usart_send(CONSOLE_USART, buffered_byte); diff --git a/src/stm32f042/brain3.3/config.h b/src/stm32f042/brain3.3/config.h index fd20906..eaeeb8f 100644 --- a/src/stm32f042/brain3.3/config.h +++ b/src/stm32f042/brain3.3/config.h @@ -61,24 +61,6 @@ #define SOFT_DFU_GPIO_PIN GPIO4 #define SOFT_DFU_ACTIVE_HIGH 0 -#include -/* Workaround for non-commonalized STM32F0 USART code */ -#ifndef USART_STOPBITS_1 -#define USART_STOPBITS_1 USART_CR2_STOP_1_0BIT -#endif - -#ifndef USART_STOPBITS_2 -#define USART_STOPBITS_2 USART_CR2_STOP_2_0BIT -#endif - -#ifndef USART_SR_RXNE -#define USART_SR_RXNE USART_ISR_RXNE -#endif - -#ifndef USART_SR_TXE -#define USART_SR_TXE USART_ISR_TXE -#endif - /* Word size for usart_recv and usart_send */ typedef uint8_t usart_word_t; diff --git a/src/stm32f042/dap42/config.h b/src/stm32f042/dap42/config.h index 081d519..71be1e8 100644 --- a/src/stm32f042/dap42/config.h +++ b/src/stm32f042/dap42/config.h @@ -54,24 +54,6 @@ #define nBOOT0_GPIO_PORT GPIOB #define nBOOT0_GPIO_PIN GPIO8 -#include -/* Workaround for non-commonalized STM32F0 USART code */ -#ifndef USART_STOPBITS_1 -#define USART_STOPBITS_1 USART_CR2_STOP_1_0BIT -#endif - -#ifndef USART_STOPBITS_2 -#define USART_STOPBITS_2 USART_CR2_STOP_2_0BIT -#endif - -#ifndef USART_SR_RXNE -#define USART_SR_RXNE USART_ISR_RXNE -#endif - -#ifndef USART_SR_TXE -#define USART_SR_TXE USART_ISR_TXE -#endif - /* Word size for usart_recv and usart_send */ typedef uint8_t usart_word_t; diff --git a/src/stm32f042/dap42k6u/config.h b/src/stm32f042/dap42k6u/config.h index 3e48d64..e39f854 100644 --- a/src/stm32f042/dap42k6u/config.h +++ b/src/stm32f042/dap42k6u/config.h @@ -54,24 +54,6 @@ #define nBOOT0_GPIO_PORT GPIOF #define nBOOT0_GPIO_PIN GPIO11 -#include -/* Workaround for non-commonalized STM32F0 USART code */ -#ifndef USART_STOPBITS_1 -#define USART_STOPBITS_1 USART_CR2_STOP_1_0BIT -#endif - -#ifndef USART_STOPBITS_2 -#define USART_STOPBITS_2 USART_CR2_STOP_2_0BIT -#endif - -#ifndef USART_SR_RXNE -#define USART_SR_RXNE USART_ISR_RXNE -#endif - -#ifndef USART_SR_TXE -#define USART_SR_TXE USART_ISR_TXE -#endif - /* Word size for usart_recv and usart_send */ typedef uint8_t usart_word_t; diff --git a/src/stm32f042/kitchen42/config.h b/src/stm32f042/kitchen42/config.h index 308d50b..579b9fc 100644 --- a/src/stm32f042/kitchen42/config.h +++ b/src/stm32f042/kitchen42/config.h @@ -54,24 +54,6 @@ #define nBOOT0_GPIO_PORT GPIOF #define nBOOT0_GPIO_PIN GPIO11 -#include -/* Workaround for non-commonalized STM32F0 USART code */ -#ifndef USART_STOPBITS_1 -#define USART_STOPBITS_1 USART_CR2_STOP_1_0BIT -#endif - -#ifndef USART_STOPBITS_2 -#define USART_STOPBITS_2 USART_CR2_STOP_2_0BIT -#endif - -#ifndef USART_SR_RXNE -#define USART_SR_RXNE USART_ISR_RXNE -#endif - -#ifndef USART_SR_TXE -#define USART_SR_TXE USART_ISR_TXE -#endif - /* Word size for usart_recv and usart_send */ typedef uint8_t usart_word_t;