diff options
author | root <root@ka-ata-killa.ourano.james.local> | 2021-03-03 15:24:13 +0000 |
---|---|---|
committer | root <root@ka-ata-killa.ourano.james.local> | 2021-03-03 16:03:28 +0000 |
commit | 49148e76706e5e24c2ba7f6ccc1d7ec4736ab2f3 (patch) | |
tree | f65cb7440711ea1708c25fe78819e9986b2d8566 /app/main.c | |
parent | 129a103238d69bd90b4fe9a44bbed943b9488fc2 (diff) | |
download | serial_over_dp-49148e76706e5e24c2ba7f6ccc1d7ec4736ab2f3.tar.gz serial_over_dp-49148e76706e5e24c2ba7f6ccc1d7ec4736ab2f3.tar.bz2 serial_over_dp-49148e76706e5e24c2ba7f6ccc1d7ec4736ab2f3.zip |
support cheap chinese blue pill boards, make usb dfu compatible with dfuse
Diffstat (limited to 'app/main.c')
-rw-r--r-- | app/main.c | 34 |
1 files changed, 11 insertions, 23 deletions
@@ -15,39 +15,27 @@ int main (void) rcc_periph_clock_enable (RCC_USART1); rcc_periph_clock_enable (RCC_AFIO); rcc_periph_clock_enable (RCC_I2C1); -#if 0 - nvic_set_priority (NVIC_I2C1_EV_IRQ, 0x38); - nvic_set_priority (NVIC_I2C1_ER_IRQ, 0x39); - nvic_set_priority (NVIC_USART1_IRQ, 0x44); - nvic_set_priority (NVIC_SYSTICK_IRQ, 0xff); -#else nvic_set_priority (NVIC_I2C1_EV_IRQ, 0xff); nvic_set_priority (NVIC_I2C1_ER_IRQ, 0xff); nvic_set_priority (NVIC_SYSTICK_IRQ, 0x80); nvic_set_priority (NVIC_USART1_IRQ, 0x40); -#endif + nvic_set_priority (NVIC_USB_HP_CAN_TX_IRQ, 0x40); + nvic_set_priority (NVIC_USB_LP_CAN_RX0_IRQ, 0x40); + gpio_set_mode (LED1_BANK, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, LED1_GPIO); gpio_set_mode (LED2_BANK, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_OPENDRAIN, LED2_GPIO); usart_init(); ticker_init(); - printf ("Morning chaps!\r\n"); -#ifdef USB + cdcacm_rings_init(); usb_init(); -#endif -#ifdef I2C_BIT_BANG - i2c_bb_init(); -#else + + printf ("Morning chaps!\r\n"); + i2c_hw_init(); -#endif - - for (;;) { -#ifdef USB - usbd_poll (usbd_dev); -#endif -#ifdef I2C_BIT_BANG - i2c_bb_poll(); -#endif - } + + printf ("Ready\n"); + + for (;;); return 0; } |