summaryrefslogtreecommitdiff
path: root/digital/beacon/src/Bitcloud_stack/Components/BSP/MESHBEAN/src/leds.c
blob: d03e7154eeb56f434c3dfe049381d87b3aac60d7 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/***************************************************************************//**
\file  leds.c

\brief The module to access to the leds.

\author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008-2011, Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

\internal
  History:
    29/05/07 E. Ivanov - Created
*******************************************************************************/
#if APP_DISABLE_BSP != 1

/******************************************************************************
                   Includes section
******************************************************************************/
#include <bspLeds.h>
#include <sensors.h>
#include <pwrCtrl.h>

/******************************************************************************
                   Implementations section
******************************************************************************/
/**************************************************************************//**
\brief Inits�LEDs�control�module.
******************************************************************************/
static void initLeds(void)
{
  halInitRedLed();
  halInitYellowLed();
  halInitGreenLed();
}

/**************************************************************************//**
\brief Opens leds module to use.

\return
    operation state
******************************************************************************/
result_t BSP_OpenLeds(void)
{
  initLeds();
#if BSP_MNZB_EVB_SUPPORT == 1
  bspOnPeriphery(SENSOR_LED);
#endif /* BSP_MNZB_EVB_SUPPORT */
  return BC_SUCCESS;
}

/**************************************************************************//**
\brief Closes leds module.

\return
    operation state
******************************************************************************/
result_t BSP_CloseLeds(void)
{
#if BSP_MNZB_EVB_SUPPORT == 1
  bspOffPeriphery(SENSOR_LED);
#endif /* BSP_MNZB_EVB_SUPPORT */
  halUnInitRedLed();
  halUnInitYellowLed();
  halUnInitGreenLed();
  return BC_SUCCESS;
}

/**************************************************************************//**
\brief Turns�on the�LED.

\param[in]
    id - number of led
******************************************************************************/
void BSP_OnLed(uint8_t id)
{
  switch (id)
  {
    case LED_RED:
      halOnRedLed();
      break;
    case LED_GREEN:
      halOnGreenLed();
      break;
    case LED_YELLOW:
      halOnYellowLed();
      break;
  }
}

/**************************************************************************//**
\brief Turns�off the�LED.

\param[in]
      id - number of led
******************************************************************************/
void BSP_OffLed(uint8_t id)
{
  switch (id)
  {
    case LED_RED:
      halOffRedLed();
      break;
    case LED_GREEN:
      halOffGreenLed();
      break;
    case LED_YELLOW:
      halOffYellowLed();
      break;
  }
}

/**************************************************************************//**
\brief Changes the�LED state to opposite.

\param[in]
      id - number of led
******************************************************************************/
void BSP_ToggleLed(uint8_t id)
{
  switch (id)
  {
    case LED_RED:
      halToggleRedLed();
      break;
    case LED_GREEN:
      halToggleGreenLed();
      break;
    case LED_YELLOW:
      halToggleYellowLed();
      break;
  }
}

#endif // APP_DISABLE_BSP != 1

// eof leds.c