mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Introduction of PIOS_DEBUG
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@222 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
a189557d7f
commit
ce5f814b63
85
flight/PiOS/STM32F10x/pios_debug.c
Normal file
85
flight/PiOS/STM32F10x/pios_debug.c
Normal file
@ -0,0 +1,85 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file pios_debug.c
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief RC Servo routines
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup PIOS_SERVO RC Servo Functions
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* Project Includes */
|
||||
#include "pios.h"
|
||||
|
||||
|
||||
/* Private Function Prototypes */
|
||||
|
||||
/**
|
||||
* Initialise Debug-features
|
||||
*/
|
||||
void PIOS_DEBUG_Init(void)
|
||||
{
|
||||
// Initialise Servo pins as standard output pins
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_StructInit(&GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_Pin = SERVO1_PIN | SERVO2_PIN | SERVO3_PIN | SERVO4_PIN;
|
||||
GPIO_Init(SERVO1TO4_PORT, &GPIO_InitStructure);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = SERVO5_PIN | SERVO6_PIN | SERVO7_PIN | SERVO8_PIN;
|
||||
GPIO_Init(SERVO5TO8_PORT, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug-pin high
|
||||
* \param pin 0 for S1 output
|
||||
*/
|
||||
void PIOS_DEBUG_PinHigh(uint8_t pin)
|
||||
{
|
||||
if (pin < 4)
|
||||
{
|
||||
SERVO1TO4_PORT->BSRR = (SERVO1_PIN<<pin);
|
||||
}
|
||||
else if (pin <= 7)
|
||||
{
|
||||
SERVO5TO8_PORT->BSRR = (SERVO5_PIN<<(pin-4));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set debug-pin low
|
||||
* \param pin 0 for S1 output
|
||||
*/
|
||||
void PIOS_DEBUG_PinLow(uint8_t pin)
|
||||
{
|
||||
if (pin < 4)
|
||||
{
|
||||
SERVO1TO4_PORT->BRR = (SERVO1_PIN<<pin);
|
||||
}
|
||||
else if (pin <= 7)
|
||||
{
|
||||
SERVO5TO8_PORT->BRR = (SERVO5_PIN<<(pin-4));
|
||||
}
|
||||
}
|
||||
|
||||
|
33
flight/PiOS/inc/pios_debug.h
Normal file
33
flight/PiOS/inc/pios_debug.h
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file pios_i2c.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Debug helper functions header.
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef PIOS_DEBUG_H
|
||||
#define PIOS_DEBUG_H
|
||||
|
||||
void PIOS_DEBUG_Init(void);
|
||||
void PIOS_DEBUG_PinHigh(uint8_t pin);
|
||||
void PIOS_DEBUG_PinLow(uint8_t pin);
|
||||
|
||||
#endif /* PIOS_DEBUG_H */
|
@ -69,6 +69,7 @@
|
||||
#include <pios_pwm.h>
|
||||
#include <pios_usb.h>
|
||||
#include <pios_usb_hid.h>
|
||||
#include <pios_debug.h>
|
||||
|
||||
/* PIOS Hardware Includes (Common) */
|
||||
#include <pios_settings.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user