Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
led_hw.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 AggieAir, A Remote Sensing Unmanned Aerial System for Scientific Applications
3  * Utah State University, http://aggieair.usu.edu/
4  *
5  * Michal Podhradsky (michal.podhradsky@aggiemail.usu.edu)
6  * Calvin Coopmans (c.r.coopmans@ieee.org)
7  *
8  *
9  * This file is part of paparazzi.
10  *
11  * paparazzi is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2, or (at your option)
14  * any later version.
15  *
16  * paparazzi is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with paparazzi; see the file COPYING. If not, write to
23  * the Free Software Foundation, 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  */
30 #ifndef LED_HW_H
31 #define LED_HW_H
32 
33 /*
34  * hal.h is needed for palXXX functions
35  */
36 #include "hal.h"
37 #include "mcu_periph/gpio_def.h"
38 
39 /*
40  * Regular GPIO driven LEDs
41  */
42 #define _LED_GPIO(i) i
43 #define _LED_GPIO_PIN(i) i
44 
45 #define LED_GPIO(i) _LED_GPIO(LED_ ## i ## _GPIO)
46 #define LED_GPIO_PIN(i) _LED_GPIO_PIN(LED_ ## i ## _GPIO_PIN)
47 
48 #define LED_INIT(i) {}
49 #define LED_ON(i) palClearPad(LED_GPIO(i), LED_GPIO_PIN(i))
50 #define LED_OFF(i) palSetPad(LED_GPIO(i), LED_GPIO_PIN(i))
51 #define LED_TOGGLE(i) palTogglePad(LED_GPIO(i), LED_GPIO_PIN(i))
52 #define LED_PERIODIC() {}
53 
54 #endif /* LED_HW_H */
ChibiOS doesn't define pin numbers with format GPIOX let's do it here.