Paparazzi UAS  v5.0.5_stable-7-g4b8bbb7
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
lisa_tunnel.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com>
3  *
4  * This file is part of paparazzi.
5  *
6  * paparazzi is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * paparazzi is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with paparazzi; see the file COPYING. If not, write to
18  * the Free Software Foundation, 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #include <inttypes.h>
23 
24 #include "std.h"
25 #include "mcu.h"
26 #include "mcu_periph/uart.h"
27 #include "mcu_periph/sys_time.h"
28 #include "led.h"
29 
30 static inline void main_init( void );
31 static inline void main_periodic_task( void );
32 static inline void main_event_task( void );
33 
34 int main( void ) {
35  main_init();
36  while(1) {
40  }
41  return 0;
42 }
43 
44 static inline void main_init( void ) {
45  mcu_init();
47 }
48 
49 static inline void main_periodic_task( void ) {
50  RunOnceEvery(100, {
51  LED_TOGGLE(4);
52  LED_PERIODIC();
53  });
54 
55 }
56 
57 static inline void main_event_task( void ) {
58 
59  if (uart_char_available(&uart2))
60  uart_transmit(&uart1, uart_getch(&uart2));
61 
62  if (uart_char_available(&uart1))
63  uart_transmit(&uart2, uart_getch(&uart1));
64 
65 }
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
void mcu_init(void)
Microcontroller peripherals initialization.
Definition: mcu.c:61
uint8_t uart_getch(struct uart_periph *p)
Definition: uart.c:71
static bool_t uart_char_available(struct uart_periph *p)
Definition: uart.h:83
void uart_transmit(struct uart_periph *p, uint8_t data)
Definition: uart_arch.c:71
Architecture independent timing functions.
static void main_periodic_task(void)
Definition: lisa_tunnel.c:49
int sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
Definition: sys_time.c:37
#define LED_TOGGLE(i)
Definition: led_hw.h:30
static bool_t sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
Definition: sys_time.h:111
#define LED_PERIODIC()
Definition: led_hw.h:8
Arch independent mcu ( Micro Controller Unit ) utilities.
#define PERIODIC_FREQUENCY
Definition: imu_aspirin2.c:54
arch independent LED (Light Emitting Diodes) API
static void main_event_task(void)
Definition: lisa_tunnel.c:57
int main(void)
Definition: lisa_tunnel.c:34
static void main_init(void)
Definition: lisa_tunnel.c:44