Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
leds.h@0:aa3c3d1a5918, 2010-11-07 (annotated)
- Committer:
- Alkorin
- Date:
- Sun Nov 07 11:28:38 2010 +0000
- Revision:
- 0:aa3c3d1a5918
- Child:
- 2:e6b2d22fbf75
1st publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alkorin | 0:aa3c3d1a5918 | 1 | #ifndef __LEDS_H__ |
Alkorin | 0:aa3c3d1a5918 | 2 | #define __LEDS_H__ |
Alkorin | 0:aa3c3d1a5918 | 3 | |
Alkorin | 0:aa3c3d1a5918 | 4 | /* LEDS GPIO Registers */ |
Alkorin | 0:aa3c3d1a5918 | 5 | // GPIO1 Mask register, FIOMASK page 122 |
Alkorin | 0:aa3c3d1a5918 | 6 | #define LEDS_GPIO_MASK *(uint32_t *)(0x2009C030) |
Alkorin | 0:aa3c3d1a5918 | 7 | // GPIO1 Pin register, FIOPIN page 122 |
Alkorin | 0:aa3c3d1a5918 | 8 | #define LEDS_GPIO_PIN *(uint32_t *)(0x2009C034) |
Alkorin | 0:aa3c3d1a5918 | 9 | // GPIO1 Direction, FIO1DIR page 122 |
Alkorin | 0:aa3c3d1a5918 | 10 | #define LEDS_GPIO_DIR *(uint32_t *)(0x2009C020) |
Alkorin | 0:aa3c3d1a5918 | 11 | |
Alkorin | 0:aa3c3d1a5918 | 12 | /* LEDS GPIO Pins */ |
Alkorin | 0:aa3c3d1a5918 | 13 | #define LED1 (1 << 18) |
Alkorin | 0:aa3c3d1a5918 | 14 | #define LED2 (1 << 20) |
Alkorin | 0:aa3c3d1a5918 | 15 | #define LED3 (1 << 21) |
Alkorin | 0:aa3c3d1a5918 | 16 | #define LED4 (1 << 23) |
Alkorin | 0:aa3c3d1a5918 | 17 | #define LEDS_MASK (LED1 | LED2 | LED3 | LED4) |
Alkorin | 0:aa3c3d1a5918 | 18 | |
Alkorin | 0:aa3c3d1a5918 | 19 | #define LEDS_SET(value) LEDS_GPIO_MASK = ~LEDS_MASK; \ |
Alkorin | 0:aa3c3d1a5918 | 20 | LEDS_GPIO_PIN = value; |
Alkorin | 0:aa3c3d1a5918 | 21 | |
Alkorin | 0:aa3c3d1a5918 | 22 | #define LEDS_INIT() LEDS_GPIO_DIR |= LEDS_MASK; |
Alkorin | 0:aa3c3d1a5918 | 23 | |
Alkorin | 0:aa3c3d1a5918 | 24 | |
Alkorin | 0:aa3c3d1a5918 | 25 | #endif |