diff options
author | root <root@lamia.panaceas.james.local> | 2015-07-16 08:35:16 +0100 |
---|---|---|
committer | root <root@lamia.panaceas.james.local> | 2015-07-16 08:35:16 +0100 |
commit | b3df20a08974584076e802d5f7061a8a8cb96930 (patch) | |
tree | b380025284e65f42b57134abe988a0a04db93ec8 /app/main.c | |
download | stm32_ade-b3df20a08974584076e802d5f7061a8a8cb96930.tar.gz stm32_ade-b3df20a08974584076e802d5f7061a8a8cb96930.tar.bz2 stm32_ade-b3df20a08974584076e802d5f7061a8a8cb96930.zip |
initial commit
Diffstat (limited to 'app/main.c')
-rw-r--r-- | app/main.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/app/main.c b/app/main.c new file mode 100644 index 0000000..84edc6f --- /dev/null +++ b/app/main.c @@ -0,0 +1,58 @@ +#include "project.h" + + +static void +kbd_dispatch (void) +{ + uint8_t c; + + if (ring_read_byte (&rx1_ring, &c)) + return; + + printf("KEY> %c\r\n",c); + +} + +int +main (void) +{ +// rcc_clock_setup_in_hsi_out_48mhz (); + //nvic_set_priority_grouping(NVIC_PriorityGroup_4); + + /*set up pll */ + rcc_clock_setup_in_hse_8mhz_out_72mhz (); + + /*turn on clocks which aren't done elsewhere */ + rcc_periph_clock_enable (RCC_GPIOA); + rcc_periph_clock_enable (RCC_GPIOB); + rcc_periph_clock_enable (RCC_GPIOC); + rcc_periph_clock_enable (RCC_AFIO); + + + /*Adjust interrupt priorities so that uarts trump timer */ + nvic_set_priority (NVIC_USART1_IRQ, 0x40); + nvic_set_priority (NVIC_USART2_IRQ, 0x40); + nvic_set_priority (NVIC_USART3_IRQ, 0x40); + nvic_set_priority (NVIC_SYSTICK_IRQ, 0xff); + + + ticker_init (); + + led_init (); + usart_init (); + i2cp_init (); + + lcd_init (); + + + lcd_write ("Hello world", 0, 0); + + for (;;) + { + if (!ring_empty (&rx1_ring)) + kbd_dispatch (); + + } + + return 0; +} |