Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
trigger_ext.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (C) 2010 Martin Mueller
5  *
6  * This file is part of paparazzi.
7  *
8  * paparazzi is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * paparazzi is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with paparazzi; see the file COPYING. If not, write to
20  * the Free Software Foundation, 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  *
23  */
24 
33 #include "trigger_ext.h"
35 #include "subsystems/gps.h"
36 #include "mcu_periph/sys_time.h"
37 #include "mcu_periph/uart.h"
38 #include "messages.h"
40 
41 
42 void trigger_ext_init ( void ) {
43  trig_ext_init();
44 }
45 
46 void trigger_ext_periodic( void ) {
47  if (trig_ext_valid == TRUE) {
48  uint8_t ac_id = 0;
49  uint8_t turb_id = TURBINE_ID;
50  uint32_t sync_itow, cycle_time;
51 
52  sync_itow = gps_tow_from_ticks(trigger_t0);
53  cycle_time = MSEC_OF_CPU_TICKS(delta_t0);
54 
55  DOWNLINK_SEND_WINDTURBINE_STATUS_(DefaultChannel, DefaultDevice,
56  &ac_id,
57  &turb_id,
58  &sync_itow,
59  &cycle_time );
61  }
62 }
63 
uint32_t trigger_t0
Definition: trigger_ext.c:34
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
volatile bool_t trig_ext_valid
Definition: trig_ext_hw.c:10
#define FALSE
Definition: imu_chimu.h:141
uint32_t delta_t0
Definition: trig_ext_hw.c:9
Architecture independent timing functions.
Device independent GPS code (interface)
unsigned long uint32_t
Definition: types.h:18
void trigger_ext_init(void)
Definition: trigger_ext.c:42
#define TRUE
Definition: imu_chimu.h:144
unsigned char uint8_t
Definition: types.h:14
void trig_ext_init(void)
Definition: trig_ext_hw.c:25
void trigger_ext_periodic(void)
Definition: trigger_ext.c:46
uint8_t ac_id
Definition: jsbsim_hw.c:28
#define MSEC_OF_CPU_TICKS(t)
Definition: sys_time_arch.h:65