Landtiger LPC1768 C BigLib 1
A self made, custom C library for the LandTiger board.
 
Loading...
Searching...
No Matches
led.c
Go to the documentation of this file.
1#include "led.h"
2#include <LPC17xx.h>
3
4void LED_Init(void)
5{
6 LPC_PINCON->PINSEL4 &= 0xFFFF0000; // P2.0 to P2.7 set to function 00 (GPIO)
7 LPC_GPIO2->FIODIR |= 0xFF; // P2.0 to P2.7 set as output
8 LED_Off(0xFF); // Turn off all LEDs
9}
10
11void LED_Deinit(void)
12{
13 LPC_GPIO2->FIODIR &= ~0xFF; // i.e. 0xFFFFFF00, top 24 unchanged, bottom 8 = 0
14}
15
16void LED_On(u8 which)
17{
18 LPC_GPIO2->FIOSET = which;
19}
20
21void LED_Off(u8 which)
22{
23 LPC_GPIO2->FIOCLR = which;
24}
25
26void LED_Output(u8 value)
27{
29 LED_On(value);
30}
31
32void LED_Clear(void)
33{
34 LPC_GPIO2->FIOCLR = LED_ALL;
35}
void LED_Deinit(void)
Definition led.c:11
void LED_Clear(void)
Clears the LEDs.
Definition led.c:32
void LED_Init(void)
Definition led.c:4
void LED_Output(u8 value)
Displays the value using LEDs.
Definition led.c:26
void LED_Off(u8 which)
Turns off the specified LEDs.
Definition led.c:21
void LED_On(u8 which)
Turns on the specified LEDs.
Definition led.c:16
@ LED_ALL
Definition led_types.h:15
uint8_t u8
Definition types.h:8