summaryrefslogtreecommitdiffstats
path: root/radiator-plc/stm32/app/led.c
blob: 390ed2e073665aec99ecf3d90ecadf900689ac62 (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
#include "project.h"

#define LED0 GPIO3
#define LED0_PORT GPIOC

#define LED1 GPIO2
#define LED1_PORT GPIOC

static int led = 0;

void
led_init (void)
{
  MAP_OUTPUT_PP (LED0);
  MAP_OUTPUT_PP (LED1);

  SET (LED0);
  SET (LED1);
}

void led1_set (void)
{
  CLEAR (LED1);
}

void led1_clear (void)
{
  SET (LED1);
}



void
led_tick (void)
{
  static unsigned i;

  i++;

  if (i < 1000) return;

  i = 0;

  led ^= 1;

  if (!led)
    CLEAR (LED0);

  if (led)
    SET (LED0);

}