Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
leds.h
- Committer:
- Alkorin
- Date:
- 2010-11-08
- Revision:
- 2:e6b2d22fbf75
- Parent:
- 0:aa3c3d1a5918
- Child:
- 4:afddc4848b6c
File content as of revision 2:e6b2d22fbf75:
#ifndef __LEDS_H__ #define __LEDS_H__ #include "mbed_globals.h" /** Registers **/ // GPIO1 Mask register, FIOMASK page 122 #define LEDS_GPIO_MASK (LPC_GPIO1_BASE + 0x10) // GPIO1 Pin register, FIOPIN page 122 #define LEDS_GPIO_PIN (LPC_GPIO1_BASE + 0x14) // GPIO1 Direction, FIO1DIR page 122 #define LEDS_GPIO_DIR (LPC_GPIO1_BASE + 0x00) /** Bits **/ #define LED1 (1 << 18) #define LED2 (1 << 20) #define LED3 (1 << 21) #define LED4 (1 << 23) #define LEDS_MASK (LED1 | LED2 | LED3 | LED4) /** Macros **/ #define LEDS_INIT() GET_REGISTER32(LEDS_GPIO_DIR) |= LEDS_MASK; #define LEDS_SET(value) SET_REGISTER32(LEDS_GPIO_MASK, (~LEDS_MASK)); \ SET_REGISTER32(LEDS_GPIO_PIN, (value)); #endif