summaryrefslogtreecommitdiffstats
path: root/app/main.c
blob: 00dbc85718c1253e16aed428b14d6a3644e470e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "project.h"

extern uint32_t dfu_flag;



int
main (void)
{
  /*set up pll */
  //rcc_clock_setup_in_hse_8mhz_out_24mhz ();
  //rcc_clock_setup_in_hse_8mhz_out_72mhz ();
  //rcc_clock_setup_in_hsi_out_48mhz();

  rcc_clock_setup_in_hse_8mhz_out_48mhz ();

  /*turn on clocks to peripherals */
  rcc_periph_clock_enable (RCC_GPIOA);
  rcc_periph_clock_enable (RCC_GPIOB);
  rcc_periph_clock_enable (RCC_GPIOC);
  rcc_periph_clock_enable (RCC_AFIO);
rcc_periph_clock_enable(RCC_TIM1);

  nvic_set_priority (NVIC_USART1_IRQ, 0x40);
  nvic_set_priority (NVIC_USART2_IRQ, 0x40);
  nvic_set_priority (NVIC_SYSTICK_IRQ, 0xff);


  ticker_init ();
  led_init ();
  usart_init();

  gpio_init();
  buzzer_init();

  modem_init();



#if 0
  i2c_bb_init ();
  lcd_init ();
#endif

  //usb_init ();

  /*Reset the GSM module*/
  gpio_clear(GPIOA,GPIO1);
  delay_ms(100);
  gpio_set(GPIOA,GPIO1);


  //usb_run ();

  for (;;) {
	serial_poll();
	}

  return 0;
}