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
deploy_sonar_buoy.c
Go to the documentation of this file.
1 /*
2  * $Id: $
3  *
4  * Copyright (C) 2010 Eric Parsonage
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 #include <stm32/gpio.h>
24 #include <stm32/rcc.h>
25 #include "deploy_sonar_buoy.h"
26 #include "generated/airframe.h"
27 
28 /* simple module to toggle two gpio pins on Lisa.
29  * The application in this was written for drops
30  * two sonar buoys. TODO extend to a generalised
31  * GPIO module
32  */
33 
34 bool_t buoy_1;
35 bool_t buoy_2;
36 
37 /* initialises GPIO pins */
39  /* initialise peripheral clock for port C */
40  RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOC, ENABLE);
41  GPIO_InitTypeDef GPIO_InitStructure;
42  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;
43  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
44  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
45  GPIO_Init(GPIOC, &GPIO_InitStructure);
46  /* set port C pin 5 to be low */
47  GPIO_WriteBit(GPIOC, GPIO_Pin_5 , Bit_RESET );
48 
49  /* initialise peripheral clock for port B */
50  RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE);
51  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
52  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
53  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
54  GPIO_Init(GPIOB, &GPIO_InitStructure);
55  /* set port B pin 0 to be low */
56  GPIO_WriteBit(GPIOB, GPIO_Pin_0 , Bit_RESET );
57 
58  /* set the variables of interest to be FALSE */
59  buoy_1 = FALSE;
60  buoy_2 = FALSE;
62 }
63 
64 /* sets GPIO pins */
66  GPIO_WriteBit(GPIOC, GPIO_Pin_5 , buoy_1 ? Bit_SET : Bit_RESET );
67  GPIO_WriteBit(GPIOB, GPIO_Pin_0 , buoy_2 ? Bit_SET : Bit_RESET );
68 }
bool_t buoy_1
#define FALSE
Definition: imu_chimu.h:141
void deploy_sonar_buoy_init(void)
void deploy_sonar_buoy_periodic(void)
bool_t buoy_2