mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
OP-291 PIOS/Servo: Make the remapping of timers a part of the driver structure
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2569 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
da96ce15b9
commit
99fcd089d4
@ -57,7 +57,7 @@ FLASH_TOOL = OPENOCD
|
||||
USE_THUMB_MODE = YES
|
||||
|
||||
# List of modules to include
|
||||
MODULES = Telemetry CCAttitude
|
||||
MODULES = Telemetry ManualControl Actuator CCAttitude #Stabilization
|
||||
#Actuator Telemetry ManualControl Stabilization FirmwareIAP
|
||||
|
||||
#MODULES = Telemetry Example
|
||||
@ -362,7 +362,7 @@ LINKERSCRIPTPATH = $(PIOSSTM32F10X)
|
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
|
||||
|
||||
ifeq ($(DEBUG),YES)
|
||||
OPT = 0
|
||||
OPT = 1
|
||||
else
|
||||
OPT = s
|
||||
endif
|
||||
@ -427,11 +427,16 @@ CFLAGS += -mcpu=$(MCU) -mthumb
|
||||
CFLAGS += $(CDEFS)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
|
||||
|
||||
#CFLAGS += -fno-cprop-registers -fno-defer-pop -fno-guess-branch-probability -fno-section-anchors
|
||||
#CFLAGS += -fno-if-conversion -fno-if-conversion2 -fno-ipa-pure-const -fno-ipa-reference -fno-merge-constants
|
||||
#CFLAGS += -fno-split-wide-types -fno-tree-ccp -fno-tree-ch -fno-tree-copy-prop -fno-tree-copyrename
|
||||
#CFLAGS += -fno-tree-dce -fno-tree-dominator-opts -fno-tree-dse -fno-tree-fre -fno-tree-sink -fno-tree-sra
|
||||
#CFLAGS += -fno-tree-ter
|
||||
#CFLAGS += -g$(DEBUGF) -DDEBUG
|
||||
|
||||
CFLAGS += -mapcs-frame
|
||||
CFLAGS += -fomit-frame-pointer
|
||||
ifeq ($(CODE_SOURCERY), YES)
|
||||
CFLAGS += -fpromote-loop-indices
|
||||
endif
|
||||
|
||||
CFLAGS += -Wall
|
||||
CFLAGS += -Werror
|
||||
|
@ -29,8 +29,8 @@
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 72000000 )
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 64 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 15 * 1024 ) )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 13 * 1024 ) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
|
@ -54,7 +54,7 @@
|
||||
#define PIOS_INCLUDE_FREERTOS
|
||||
#define PIOS_INCLUDE_GPIO
|
||||
#define PIOS_INCLUDE_EXTI
|
||||
//#define PIOS_INCLUDE_WDG
|
||||
#define PIOS_INCLUDE_WDG
|
||||
#define PIOS_INCLUDE_I2C_ESC
|
||||
|
||||
#define PIOS_INCLUDE_ADXL345
|
||||
|
@ -68,7 +68,6 @@ void PIOS_Board_Init(void) {
|
||||
|
||||
/* Remap AFIO pin */
|
||||
GPIO_PinRemapConfig( GPIO_Remap_SWJ_NoJTRST, ENABLE);
|
||||
GPIO_PinRemapConfig( GPIO_PartialRemap_TIM3, ENABLE);
|
||||
PIOS_Servo_Init();
|
||||
|
||||
PIOS_ADC_Init();
|
||||
@ -78,14 +77,14 @@ void PIOS_Board_Init(void) {
|
||||
PIOS_PWM_Init();
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_PPM)
|
||||
//PIOS_PPM_Init();
|
||||
PIOS_PPM_Init();
|
||||
#endif
|
||||
#if defined(PIOS_INCLUDE_USB_HID)
|
||||
PIOS_USB_HID_Init(0);
|
||||
//PIOS_USB_HID_Init(0);
|
||||
#endif
|
||||
PIOS_I2C_Init();
|
||||
PIOS_IAP_Init();
|
||||
PIOS_WDG_Init();
|
||||
//PIOS_I2C_Init();
|
||||
//PIOS_IAP_Init();
|
||||
//PIOS_WDG_Init();
|
||||
}
|
||||
|
||||
/* Flash/Accel Interface
|
||||
@ -543,6 +542,7 @@ const struct pios_servo_cfg pios_servo_cfg = {
|
||||
.GPIO_Mode = GPIO_Mode_AF_PP,
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
},
|
||||
.remap = GPIO_PartialRemap_TIM3,
|
||||
.channels = pios_servo_channels,
|
||||
.num_channels = NELEMENTS(pios_servo_channels),
|
||||
};
|
||||
|
@ -44,8 +44,8 @@
|
||||
|
||||
// Private constants
|
||||
#define MAX_QUEUE_SIZE 2
|
||||
#define STACK_SIZE configMINIMAL_STACK_SIZE
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
|
||||
#define STACK_SIZE configMINIMAL_STACK_SIZE+200
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+0)
|
||||
#define FAILSAFE_TIMEOUT_MS 100
|
||||
#define MAX_MIX_ACTUATORS ACTUATORCOMMAND_CHANNEL_NUMELEM
|
||||
|
||||
|
@ -60,10 +60,9 @@
|
||||
|
||||
// Private constants
|
||||
#define STACK_SIZE_BYTES 740
|
||||
#define STACK_SIZE_BYTES 540
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY+0)
|
||||
|
||||
#define UPDATE_RATE 10 /* ms */
|
||||
#define UPDATE_RATE 100 /* ms */
|
||||
#define GYRO_NEUTRAL 1665
|
||||
#define GYRO_SCALE 0.010f
|
||||
|
||||
@ -122,6 +121,7 @@ static void CCAttitudeTask(void *parameters)
|
||||
|
||||
/* Wait for the next update interval */
|
||||
vTaskDelayUntil(&lastSysTime, UPDATE_RATE / portTICK_RATE_MS);
|
||||
//vTaskDelay(UPDATE_RATE / portTICK_RATE_MS);
|
||||
|
||||
}
|
||||
}
|
||||
@ -130,11 +130,11 @@ void updateInput()
|
||||
{
|
||||
ManualControlCommandData manual;
|
||||
ManualControlCommandGet(&manual);
|
||||
manual.Throttle = (PIOS_PWM_Get(0) - 1100) / 900;
|
||||
manual.Roll = (PIOS_PWM_Get(1) - 1500) / 500;
|
||||
manual.Pitch = (PIOS_PWM_Get(2) - 1500) / 500;
|
||||
manual.Yaw = (PIOS_PWM_Get(3) - 1500) / 500;
|
||||
manual.FlightMode = (PIOS_PWM_Get(4) - 1500) / 500;
|
||||
manual.Throttle = (float) (PIOS_PWM_Get(0) - 1100.0f) / 900.0f;
|
||||
manual.Roll = (float) (PIOS_PWM_Get(1) - 1500.0f) / 500.0f;
|
||||
manual.Pitch = (float) (PIOS_PWM_Get(2) - 1500.0f) / 500.0f;
|
||||
manual.Yaw = (float) (PIOS_PWM_Get(3) - 1500.0f) / 500.0f;
|
||||
manual.FlightMode = (float) (PIOS_PWM_Get(4) - 1500) / 500;
|
||||
ManualControlCommandSet(&manual);
|
||||
}
|
||||
|
||||
|
@ -682,6 +682,7 @@ const struct pios_servo_cfg pios_servo_cfg = {
|
||||
.GPIO_Mode = GPIO_Mode_AF_PP,
|
||||
.GPIO_Speed = GPIO_Speed_2MHz,
|
||||
},
|
||||
.remap = 0,
|
||||
.channels = pios_servo_channels,
|
||||
.num_channels = NELEMENTS(pios_servo_channels),
|
||||
};
|
||||
|
@ -113,6 +113,12 @@ void PIOS_Servo_Init(void)
|
||||
TIM_Cmd(channel.timer, ENABLE);
|
||||
|
||||
}
|
||||
|
||||
if(pios_servo_cfg.remap) {
|
||||
/* Warning, I don't think this will work for multiple remaps at once */
|
||||
GPIO_PinRemapConfig(pios_servo_cfg.remap, ENABLE);
|
||||
}
|
||||
|
||||
|
||||
#endif // PIOS_INCLUDE_SERVO
|
||||
#endif // PIOS_ENABLE_DEBUG_PINS
|
||||
|
@ -45,6 +45,7 @@ struct pios_servo_cfg {
|
||||
TIM_TimeBaseInitTypeDef tim_base_init;
|
||||
TIM_OCInitTypeDef tim_oc_init;
|
||||
GPIO_InitTypeDef gpio_init;
|
||||
uint32_t remap;
|
||||
const struct pios_servo_channel *const channels;
|
||||
uint8_t num_channels;
|
||||
};
|
||||
|
@ -149,6 +149,7 @@
|
||||
650D8ECE12DFE17500D05CC9 /* watchdogstatus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = watchdogstatus.c; sourceTree = "<group>"; };
|
||||
650D8ED112DFE17500D05CC9 /* uavtalk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uavtalk.h; sourceTree = "<group>"; };
|
||||
650D8ED212DFE17500D05CC9 /* uavtalk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uavtalk.c; sourceTree = "<group>"; };
|
||||
65173C9F12EBFD1700D6A7CB /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = ../../../Makefile; sourceTree = SOURCE_ROOT; };
|
||||
651913371256C5240039C0A3 /* ahrs_comm_objects.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_comm_objects.c; sourceTree = "<group>"; };
|
||||
651913381256C5240039C0A3 /* ahrs_spi_comm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ahrs_spi_comm.c; sourceTree = "<group>"; };
|
||||
6519133A1256C52B0039C0A3 /* ahrs_comm_objects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ahrs_comm_objects.h; sourceTree = "<group>"; };
|
||||
@ -2961,6 +2962,7 @@
|
||||
08FB7794FE84155DC02AAC07 /* OpenPilotOSX */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
65173C9F12EBFD1700D6A7CB /* Makefile */,
|
||||
657CEEB5121DBC49007A1FBE /* flight */,
|
||||
65B35D7D121C261E003EAD18 /* ground */,
|
||||
);
|
||||
|
@ -70,7 +70,6 @@
|
||||
#include "velocitydesired.h"
|
||||
#include "watchdogstatus.h"
|
||||
|
||||
|
||||
/**
|
||||
* Function used to initialize the first instance of each object.
|
||||
* This file is automatically updated by the UAVObjectGenerator.
|
||||
@ -93,11 +92,11 @@ void UAVObjectsInitializeAll()
|
||||
I2CStatsInitialize();
|
||||
WatchdogStatusInitialize();
|
||||
TelemetrySettingsInitialize();
|
||||
//StabilizationSettingsInitialize();
|
||||
//ActuatorSettingsInitialize();
|
||||
StabilizationSettingsInitialize();
|
||||
ActuatorSettingsInitialize();
|
||||
RateDesiredInitialize();
|
||||
//AHRSSettingsInitialize();
|
||||
//ManualControlSettingsInitialize();
|
||||
//MixerSettingsInitialize();
|
||||
//MixerStatusInitialize();
|
||||
ManualControlSettingsInitialize();
|
||||
MixerSettingsInitialize();
|
||||
MixerStatusInitialize();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user