diff options
Diffstat (limited to 'app/main.c')
-rw-r--r-- | app/main.c | 59 |
1 files changed, 32 insertions, 27 deletions
@@ -1,6 +1,6 @@ #include "project.h" -#define WIGGLE GPIO4 +#define WIGGLE GPIO4 #define WIGGLE_PORT GPIOB int @@ -11,7 +11,7 @@ main (void) //nvic_set_priority_grouping(NVIC_PriorityGroup_4); /*set up pll */ - rcc_clock_setup_in_hse_8mhz_out_72mhz (); + rcc_clock_setup_in_hse_8mhz_out_72mhz(); /*turn on clocks which aren't done elsewhere */ rcc_periph_clock_enable (RCC_GPIOA); @@ -29,25 +29,28 @@ main (void) /* Claw some pins pack */ gpio_primary_remap (AFIO_MAPR_SWJ_CFG_JTAG_OFF_SW_ON, 0); - dwt_enable_cycle_counter (); + dwt_enable_cycle_counter(); - ticker_init (); + ticker_init(); - led_init (); - usart_init (); - i2cp_init (); + led_init(); + usart_init(); + i2cp_init(); printf ("Hello world\n"); - led_set (); - tacho_init (); + led_set(); + tacho_init(); - delay_ms(100); + delay_ms (100); + + + oled1_init(); + oled2_init(); + + gauge_init(); - - oled1_init (); - oled2_init (); font8x8_put_str (vram_1, "ABC fish soup!", 0, 0); @@ -55,26 +58,28 @@ main (void) MAP_OUTPUT_PP (WIGGLE); - for (;;) - { - char buf[20]; + for (;;) { + char buf[20]; + + sprintf (buf, "%6u rpm", (unsigned) raw_tacho); + font8x16_put_str (vram_1, buf, 30, 8); + + sprintf (buf, "%8d", cnt++); + font8x8_put_str (vram_1, buf, 0, 24); - sprintf (buf, "%6u rpm", (unsigned) raw_tacho); - font8x16_put_str (vram_1, buf, 30, 8); + sprintf (buf, "%6d", cnt >> 4); + font21x32_put_str (vram_2, buf, 0); - sprintf (buf, "%8d", cnt++); - font8x8_put_str (vram_1, buf, 0, 24); - sprintf (buf, "%6d", cnt >> 4); - font21x32_put_str (vram_2, buf, 0); + if (cnt & 1) + SET (WIGGLE); + else + CLEAR (WIGGLE); - if (cnt & 1) - SET (WIGGLE); - else - CLEAR (WIGGLE); + gauge_test(); - } + } return 0; } |