Simple mbed library with macros
Dependents: SimpleTimer SimpleUART SimpleTimer Stoppuhr1
leds.h@8:f8b47457fdcf, 2010-11-13 (annotated)
- Committer:
- Alkorin
- Date:
- Sat Nov 13 22:15:12 2010 +0000
- Revision:
- 8:f8b47457fdcf
- Parent:
- 6:9e1310782abf
- Child:
- 14:23c6d41cb377
Added License
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Alkorin | 8:f8b47457fdcf | 1 | /* |
Alkorin | 8:f8b47457fdcf | 2 | * Copyright or © or Copr. 2010, Thomas SOETE |
Alkorin | 8:f8b47457fdcf | 3 | * |
Alkorin | 8:f8b47457fdcf | 4 | * Author e-mail: thomas@soete.org |
Alkorin | 8:f8b47457fdcf | 5 | * |
Alkorin | 8:f8b47457fdcf | 6 | * This software is governed by the CeCILL license under French law and |
Alkorin | 8:f8b47457fdcf | 7 | * abiding by the rules of distribution of free software. You can use, |
Alkorin | 8:f8b47457fdcf | 8 | * modify and/ or redistribute the software under the terms of the CeCILL |
Alkorin | 8:f8b47457fdcf | 9 | * license as circulated by CEA, CNRS and INRIA at the following URL |
Alkorin | 8:f8b47457fdcf | 10 | * "http://www.cecill.info". |
Alkorin | 8:f8b47457fdcf | 11 | * |
Alkorin | 8:f8b47457fdcf | 12 | * As a counterpart to the access to the source code and rights to copy, |
Alkorin | 8:f8b47457fdcf | 13 | * modify and redistribute granted by the license, users are provided only |
Alkorin | 8:f8b47457fdcf | 14 | * with a limited warranty and the software's author, the holder of the |
Alkorin | 8:f8b47457fdcf | 15 | * economic rights, and the successive licensors have only limited |
Alkorin | 8:f8b47457fdcf | 16 | * liability. |
Alkorin | 8:f8b47457fdcf | 17 | * |
Alkorin | 8:f8b47457fdcf | 18 | * In this respect, the user's attention is drawn to the risks associated |
Alkorin | 8:f8b47457fdcf | 19 | * with loading, using, modifying and/or developing or reproducing the |
Alkorin | 8:f8b47457fdcf | 20 | * software by the user in light of its specific status of free software, |
Alkorin | 8:f8b47457fdcf | 21 | * that may mean that it is complicated to manipulate, and that also |
Alkorin | 8:f8b47457fdcf | 22 | * therefore means that it is reserved for developers and experienced |
Alkorin | 8:f8b47457fdcf | 23 | * professionals having in-depth computer knowledge. Users are therefore |
Alkorin | 8:f8b47457fdcf | 24 | * encouraged to load and test the software's suitability as regards their |
Alkorin | 8:f8b47457fdcf | 25 | * requirements in conditions enabling the security of their systems and/or |
Alkorin | 8:f8b47457fdcf | 26 | * data to be ensured and, more generally, to use and operate it in the |
Alkorin | 8:f8b47457fdcf | 27 | * same conditions as regards security. |
Alkorin | 8:f8b47457fdcf | 28 | * |
Alkorin | 8:f8b47457fdcf | 29 | * The fact that you are presently reading this means that you have had |
Alkorin | 8:f8b47457fdcf | 30 | * knowledge of the CeCILL license and that you accept its terms. |
Alkorin | 8:f8b47457fdcf | 31 | */ |
Alkorin | 8:f8b47457fdcf | 32 | |
Alkorin | 4:afddc4848b6c | 33 | #ifndef __LEDS_H__ |
Alkorin | 4:afddc4848b6c | 34 | #define __LEDS_H__ |
Alkorin | 4:afddc4848b6c | 35 | |
Alkorin | 4:afddc4848b6c | 36 | #include "mbed_globals.h" |
Alkorin | 4:afddc4848b6c | 37 | |
Alkorin | 4:afddc4848b6c | 38 | /** Bits **/ |
Alkorin | 4:afddc4848b6c | 39 | #define LED1 (1 << 18) |
Alkorin | 4:afddc4848b6c | 40 | #define LED2 (1 << 20) |
Alkorin | 4:afddc4848b6c | 41 | #define LED3 (1 << 21) |
Alkorin | 4:afddc4848b6c | 42 | #define LED4 (1 << 23) |
Alkorin | 4:afddc4848b6c | 43 | #define LEDS_MASK (LED1 | LED2 | LED3 | LED4) |
Alkorin | 4:afddc4848b6c | 44 | |
Alkorin | 4:afddc4848b6c | 45 | /** Macros **/ |
Alkorin | 4:afddc4848b6c | 46 | #define LEDS_INIT() LPC_GPIO1->FIODIR |= LEDS_MASK; |
Alkorin | 4:afddc4848b6c | 47 | |
Alkorin | 6:9e1310782abf | 48 | #define LEDS_SET(value) { \ |
Alkorin | 6:9e1310782abf | 49 | LPC_GPIO1->FIOMASK = ~LEDS_MASK; \ |
Alkorin | 6:9e1310782abf | 50 | LPC_GPIO1->FIOPIN = (value); \ |
Alkorin | 6:9e1310782abf | 51 | } |
Alkorin | 4:afddc4848b6c | 52 | |
Alkorin | 0:aa3c3d1a5918 | 53 | #endif |