summaryrefslogtreecommitdiffstats
path: root/app/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/main.c')
-rw-r--r--app/main.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/app/main.c b/app/main.c
index c40b571..ee0dd40 100644
--- a/app/main.c
+++ b/app/main.c
@@ -1,5 +1,7 @@
#include "project.h"
+#define WIGGLE GPIO4
+#define WIGGLE_PORT GPIOB
int
main (void)
@@ -18,12 +20,16 @@ main (void)
rcc_periph_clock_enable (RCC_AFIO);
- /*Adjust interrupt priorities so that uarts trump timer */
+ /*Adjust interrupt priorities so that taco trumps uarts trumps timer trumps dma */
+ nvic_set_priority (TACHO_IRQ,0x20);
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);
+ nvic_set_priority (NVIC_SYSTICK_IRQ, 0x60);
+ nvic_set_priority (NVIC_DMA1_CHANNEL6_IRQ, 0x80);
+ /* Claw some pins pack*/
+ gpio_primary_remap (AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, 0);
+
+ dwt_enable_cycle_counter();
ticker_init ();
@@ -31,32 +37,36 @@ main (void)
led_init ();
usart_init ();
i2cp_init ();
- //i2cb_init();
-#if 0
- //lcd_init ();
- //
-#endif
printf ("Hello world\n");
led_set ();
- //i2cb_scan();
-
oled_init ();
+ tacho_init();
font8x8_put_str ("ABC fish soup!", 0, 0);
+ MAP_OUTPUT_PP(WIGGLE);
+
+
for (;;)
{
char buf[20];
- sprintf(buf,"%8d",cnt++);
+ sprintf(buf,"%6u rpm",(unsigned) raw_tacho);
font8x16_put_str (buf, 30, 8);
+ sprintf(buf,"%8d",cnt++);
font8x8_put_str (buf, 0, 24);
+
+ if (cnt&1)
+ SET(WIGGLE);
+ else
+ CLEAR(WIGGLE);
+
}
return 0;