summaryrefslogtreecommitdiffstats
path: root/boiler-monster/stm32/app/pic.c
blob: b47876651930782b0a1d77471c396637662445b4 (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
#include "project.h"

#define PIC_RESET        GPIO1
#define PIC_RESET_PORT   GPIOB


static void pic_reset (void)
{
  SET (PIC_RESET);
  delay_ms (1);
  CLEAR (PIC_RESET);
}


void pic_passthru (void)
{
  uint8_t c;

  printf ("\r\nPIC MODE\r\n");
  usart1_drain();
  block_stdio = 1;

  while (!ring_read_byte (&rx3_ring, &c));

  pic_reset();


  for (;;) {
    if (!ring_read_byte (&rx1_ring, &c))
      usart3_queue (c);

    if (!ring_read_byte (&rx3_ring, &c))
      usart1_queue (c);

  }
}







void pic_init (void)
{
  MAP_OUTPUT_PP (PIC_RESET);

  pic_reset();

}