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