summaryrefslogtreecommitdiffstats
path: root/app/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.c')
-rw-r--r--app/main.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/app/main.c b/app/main.c
new file mode 100644
index 0000000..9d52e1f
--- /dev/null
+++ b/app/main.c
@@ -0,0 +1,64 @@
+#include "project.h"
+
+
+int
+main (void)
+{
+ unsigned cnt=0;
+
+ //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 ();
+ //i2cb_init();
+#if 0
+ //lcd_init ();
+ //
+
+#endif
+ printf ("Hello world\n");
+
+ led_set ();
+
+ //i2cb_scan();
+
+ delay_ms (10);
+ oled_init ();
+
+ delay_ms (4000);
+
+ font8x8_put_str ("ABC fish soup!", 0, 0);
+
+ for (;;)
+ {
+ char buf[20];
+
+ sprintf(buf,"%8d",cnt++);
+ font8x16_put_str (buf, 30, 16);
+
+
+ }
+
+ return 0;
+}