summaryrefslogtreecommitdiff
path: root/bsp/lpc176x/drivers/led.c
blob: 3880ab26efa936f26f99fa5a6af11728bf25657d (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
#include "LPC17xx.h"
#include "led.h"

void rt_hw_led_init(void)
{
    LPC_GPIO2->FIODIR0 |= 1<<0; /* led0:P2.0 */
    LPC_GPIO2->FIODIR0 |= 1<<1; /* led1:P2.1 */
}

void rt_hw_led_on(rt_uint32_t led)
{
    switch(led)
    {
    case 0: /* P2.0 = 1 */
        LPC_GPIO2->FIOSET0 = 1<<0;
        break;
    case 1: /* P2.1 = 1 */
        LPC_GPIO2->FIOSET0 = 1<<1;
        break;
    default:
        break;
    }
}

void rt_hw_led_off(rt_uint32_t led)
{
    switch(led)
    {
    case 0: /* P2.0 = 0 */
        LPC_GPIO2->FIOCLR0 = 1<<0;
        break;
    case 1: /* P2.1 = 0 */
        LPC_GPIO2->FIOCLR0 = 1<<1;
        break;
    default:
        break;
    }
}