Correct the F3 examples hardfaults in rare cases, correct style
This commit is contained in:
committed by
Piotr Esden-Tempski
parent
3efd9f8675
commit
72c1a29779
@@ -233,16 +233,16 @@ static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue)
|
||||
}
|
||||
|
||||
|
||||
void usb_setup(void) {
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_usb_prescale_1();
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
|
||||
gpio_set_af(GPIOA, GPIO_AF14, GPIO11| GPIO12);
|
||||
static void usb_setup(void)
|
||||
{
|
||||
/* Enable clocks for GPIO port A (for GPIO_USART2_TX) and USART2. */
|
||||
rcc_usb_prescale_1();
|
||||
rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN);
|
||||
rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_IOPAEN);
|
||||
|
||||
/* Setup GPIO pin GPIO_USART2_TX/GPIO9 on GPIO port A for transmit. */
|
||||
gpio_mode_setup(GPIOA, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO11 | GPIO12);
|
||||
gpio_set_af(GPIOA, GPIO_AF14, GPIO11| GPIO12);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
@@ -254,7 +254,8 @@ int main(void)
|
||||
rcc_clock_setup_hsi(&hsi_8mhz[CLOCK_48MHZ]);
|
||||
usb_setup();
|
||||
|
||||
usbd_dev = usbd_init(&stm32f103_usb_driver, &dev, &config, usb_strings, 3, usbd_control_buffer, sizeof(usbd_control_buffer));
|
||||
usbd_dev = usbd_init(&stm32f103_usb_driver, &dev, &config, usb_strings,
|
||||
3, usbd_control_buffer, sizeof(usbd_control_buffer));
|
||||
usbd_register_set_config_callback(usbd_dev, cdcacm_set_config);
|
||||
|
||||
for (i = 0; i < 0x800000; i++)
|
||||
|
||||
Reference in New Issue
Block a user