SimpleLib_03272011

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers leds.h Source File

leds.h

00001 /*
00002 * Copyright or � or Copr. 2010, Thomas SOETE
00003 * 
00004 * Author e-mail: thomas@soete.org
00005 * Library website : http://mbed.org/users/Alkorin/libraries/SimpleLib/
00006 * 
00007 * This software is governed by the CeCILL license under French law and
00008 * abiding by the rules of distribution of free software.  You can  use, 
00009 * modify and/ or redistribute the software under the terms of the CeCILL
00010 * license as circulated by CEA, CNRS and INRIA at the following URL
00011 * "http://www.cecill.info". 
00012 * 
00013 * As a counterpart to the access to the source code and  rights to copy,
00014 * modify and redistribute granted by the license, users are provided only
00015 * with a limited warranty  and the software's author,  the holder of the
00016 * economic rights,  and the successive licensors  have only  limited
00017 * liability. 
00018 * 
00019 * In this respect, the user's attention is drawn to the risks associated
00020 * with loading,  using,  modifying and/or developing or reproducing the
00021 * software by the user in light of its specific status of free software,
00022 * that may mean  that it is complicated to manipulate,  and  that  also
00023 * therefore means  that it is reserved for developers  and  experienced
00024 * professionals having in-depth computer knowledge. Users are therefore
00025 * encouraged to load and test the software's suitability as regards their
00026 * requirements in conditions enabling the security of their systems and/or 
00027 * data to be ensured and,  more generally, to use and operate it in the 
00028 * same conditions as regards security. 
00029 * 
00030 * The fact that you are presently reading this means that you have had
00031 * knowledge of the CeCILL license and that you accept its terms.
00032 */
00033 
00034 #ifndef __SIMPLELIB_LEDS_H__
00035 #define __SIMPLELIB_LEDS_H__
00036 
00037 #include "mbed_globals.h"
00038 
00039 /** Bits **/
00040 #define LEDS_OFF 0
00041 #define LED1 (1 << 18)
00042 #define LED2 (1 << 20)
00043 #define LED3 (1 << 21)
00044 #define LED4 (1 << 23)
00045 #define LEDS_MASK (LED1 | LED2 | LED3 | LED4)
00046 
00047 /** Macros **/
00048 #define LEDS_INIT()     LPC_GPIO1->FIODIR |= LEDS_MASK;
00049 
00050 #define LEDS_SET(value) do {                                 \
00051                             LPC_GPIO1->FIOMASK = ~LEDS_MASK; \
00052                             LPC_GPIO1->FIOPIN = (value);     \
00053                         } while(0)
00054 
00055 #endif