Contiki 2.5
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
cpu
stm32w108
hal
micro
cortexm3
led.c
Go to the documentation of this file.
1
/** @file hal/micro/cortexm3/led.c
2
* @brief LED manipulation routines; stack and example APIs
3
*
4
* <!--(C) COPYRIGHT 2010 STMicroelectronics. All rights reserved. -->
5
*/
6
7
#include PLATFORM_HEADER
8
#include BOARD_HEADER
9
#include "
hal/micro/led.h
"
10
#include "hal/micro/micro-common.h"
11
#include "
hal/micro/cortexm3/micro-common.h
"
12
13
void
halInitLed
(
void
)
14
{
15
/* Set GPIO pins for Led D1 and Led D3 */
16
halGpioConfig
(LED_D1, GPIOCFG_OUT);
17
halGpioConfig
(LED_D3, GPIOCFG_OUT);
18
/* Switch off Led D1,D3 */
19
halClearLed
(LED_D1);
20
halClearLed
(LED_D3);
21
}
22
23
void
halSetLed
(
HalBoardLed
led)
24
{
25
halGpioSet
(led, 0);
26
}
27
28
void
halClearLed
(
HalBoardLed
led)
29
{
30
halGpioSet
(led, 1);
31
}
32
33
void
halToggleLed
(
HalBoardLed
led)
34
{
35
//to avoid contention with other code using the other pins for other
36
//purposes, we disable interrupts since this is a read-modify-write
37
ATOMIC
(
38
if
(led/8 < 3) {
39
*((
volatile
int32u *)(GPIO_PxOUT_BASE+(GPIO_Px_OFFSET*(led/8)))) ^=
BIT
(led&7);
40
}
41
)
42
}
Generated on Fri Aug 30 2013 12:34:09 for Contiki 2.5 by
1.8.3.1