aerofc: Fixes for init

This commit is contained in:
James Goppert
2016-11-28 09:21:12 +01:00
committed by Lorenz Meier
parent 15c75ebb40
commit 893714dc6a
8 changed files with 103 additions and 16 deletions
@@ -40,6 +40,7 @@ px4_add_module(
aerofc_spi.c
aerofc_usb.c
aerofc_led.c
aerofc_timer_config.c
DEPENDS
platforms__common
)
@@ -0,0 +1,65 @@
/****************************************************************************
*
* Copyright (c) 2012-2016 PX4 Development Team. All rights reserved.
* Author: David Sidrane <david_s5@nscdg.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/*
* @file tap-v1_timer_config.c
*
* Configuration data for the stm32 pwm_servo, input capture and pwm input driver.
*
* Note that these arrays must always be fully-sized.
*/
#include <stdint.h>
#include <stm32.h>
#include <stm32_gpio.h>
#include <stm32_tim.h>
#include <drivers/drv_pwm_output.h>
#include <drivers/stm32/drv_io_timer.h>
#include "board_config.h"
// Invalidate all timers (base == 0): we don't have any
__EXPORT const io_timers_t io_timers[MAX_IO_TIMERS] = { };
// Invalidate all channels (timer_channel == 0): we don't have any
__EXPORT const timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { };
// Invalidate all timers (base == 0): we don't have any
__EXPORT const struct io_timers_t led_pwm_timers[1] = { };
// Invalidate all channels (timer_channel == 0): we don't have any
__EXPORT const struct timer_io_channels_t led_pwm_channels[3] = { };
+4 -15
View File
@@ -107,21 +107,10 @@
#define ADC_BATTERY_VOLTAGE_CHANNEL 0
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
/*
* PWM
*
* Four PWM outputs can be configured on pins
*
*
* Peripheral Port Signal Name CONN
* TIM3_CH1 PA6 LED_R JP2-23,24
* TIM3_CH2 PA7 LED_G JP2-25,26
* TIM3_CH3 PB0 LED_B JP2-27,28
* TIM3_CH4 PB1 nPWM_1 AUX1(Landing Gear) JP1-21,22
*
*/
#define DIRECT_PWM_OUTPUT_CHANNELS 0
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS
#define DIRECT_PWM_OUTPUT_CHANNELS 1
#define BOARD_HAS_PWM 0
#define BOARD_FMU_GPIO_TAB {{0, 0, 0}}
/* USB OTG FS
*
+4
View File
@@ -2255,6 +2255,10 @@ PX4FMU::write(file *filp, const char *buffer, size_t len)
unsigned count = len / 2;
uint16_t values[8];
#if BOARD_HAS_PWM == 0
return 0;
#endif
if (count > BOARD_HAS_PWM) {
// we have at most BOARD_HAS_PWM outputs
count = BOARD_HAS_PWM;
+6
View File
@@ -262,6 +262,9 @@ TAP_ESC::init()
return ret;
}
#ifdef CONFIG_ARCH_BOARD_AEROFC_V1
#else
/* Verify All ESC got the config */
for (uint8_t cid = 0; cid < _channels_count; cid++) {
@@ -304,8 +307,11 @@ TAP_ESC::init()
if (!valid) {
return -EIO;
}
}
#endif
/* To Unlock the ESC from the Power up state we need to issue 10
* ESCBUS_MSG_ID_RUN request with all the values 0;
*/