diff options
author | root <root@ka-ata-killa.panaceas.james.local> | 2021-11-21 17:27:02 +0000 |
---|---|---|
committer | root <root@ka-ata-killa.panaceas.james.local> | 2021-11-21 17:27:02 +0000 |
commit | 64f632692fe2a164830a363f8db158a8a2ae33de (patch) | |
tree | c2106d606b7e355ede93ff2a04848224a480dbc7 /stm32/app/main.c | |
download | metric_clock-64f632692fe2a164830a363f8db158a8a2ae33de.tar.gz metric_clock-64f632692fe2a164830a363f8db158a8a2ae33de.tar.bz2 metric_clock-64f632692fe2a164830a363f8db158a8a2ae33de.zip |
first workingish cut
Diffstat (limited to 'stm32/app/main.c')
-rw-r--r-- | stm32/app/main.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/stm32/app/main.c b/stm32/app/main.c new file mode 100644 index 0000000..4722479 --- /dev/null +++ b/stm32/app/main.c @@ -0,0 +1,50 @@ +#include "project.h" + + + + + +int main (void) +{ + /*set up pll */ + rcc_clock_setup_pll (&rcc_hse_configs[RCC_HSE_CONFIG]); + + /*turn on clocks to periferals */ + rcc_periph_clock_enable (RCC_GPIOA); + rcc_periph_clock_enable (RCC_GPIOB); + rcc_periph_clock_enable (RCC_GPIOC); + rcc_periph_clock_enable (RCC_USART1); + rcc_periph_clock_enable (RCC_AFIO); + rcc_periph_clock_enable (RCC_PWR); + rcc_periph_clock_enable (RCC_BKP); + pwr_disable_backup_domain_write_protect(); + DWT_CTRL |= DWT_CTRL_CYCCNTENA; + + + nvic_set_priority (NVIC_SYSTICK_IRQ, 0x80); + nvic_set_priority (NVIC_USART1_IRQ, 0x40); + nvic_set_priority (NVIC_USB_HP_CAN_TX_IRQ, 0x40); + nvic_set_priority (NVIC_USB_LP_CAN_RX0_IRQ, 0x40); + nvic_set_priority (NVIC_RTC_IRQ, 0x10); + + MAP_OUTPUT_OD (LED1); + MAP_OUTPUT_OD (LED2); + + + usart_init(); + cdcacm_rings_init(); + rtc_init(); + + printf ("Startup:\r\n"); + + motor_init(); + ticker_init(); + usb_init(); + + + for (;;); + + + return 0; +} + |