mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-21 11:54:15 +01:00
Small re-factorings.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@230 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
0500fe88c9
commit
a5d56cd537
@ -230,7 +230,7 @@
|
||||
#define RECEIVER8_PIN GPIO_Pin_5 // PB5
|
||||
#define RECEIVER8_TIM_PORT TIM3
|
||||
#define RECEIVER8_CH TIM_Channel_2 // TIM3_CH2
|
||||
#define NUM_RECEIVER_INPUTS 6
|
||||
#define NUM_RECEIVER_INPUTS 8
|
||||
|
||||
//-------------------------
|
||||
// Servo outputs
|
||||
|
@ -122,6 +122,7 @@ void PIOS_Servo_SetHz(uint16_t onetofour, uint16_t fivetoeight)
|
||||
TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1;
|
||||
TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
|
||||
|
||||
#if 0
|
||||
/* Clipping */
|
||||
if(onetofour > 500) {
|
||||
onetofour = 500;
|
||||
@ -129,6 +130,7 @@ void PIOS_Servo_SetHz(uint16_t onetofour, uint16_t fivetoeight)
|
||||
if(fivetoeight > 500) {
|
||||
fivetoeight = 500;
|
||||
}
|
||||
#endif
|
||||
|
||||
TIM_TimeBaseStructure.TIM_Prescaler = (PIOS_MASTER_CLOCK / 1000000) - 1;
|
||||
TIM_TimeBaseStructure.TIM_Period = ((1000000 / onetofour) - 1);
|
||||
@ -141,7 +143,7 @@ void PIOS_Servo_SetHz(uint16_t onetofour, uint16_t fivetoeight)
|
||||
|
||||
/**
|
||||
* Set servo position
|
||||
* \param[in] Servo Servo number (0-7)
|
||||
* \param[in] Servo Servo number (1-8)
|
||||
* \param[in] Position Servo position in milliseconds
|
||||
*/
|
||||
void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
|
||||
@ -162,28 +164,28 @@ void PIOS_Servo_Set(uint8_t Servo, uint16_t Position)
|
||||
|
||||
switch(Servo)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
TIM_SetCompare1(TIM4, Position);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
TIM_SetCompare2(TIM4, Position);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
TIM_SetCompare3(TIM4, Position);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
TIM_SetCompare4(TIM4, Position);
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
TIM_SetCompare1(TIM8, Position);
|
||||
break;
|
||||
case 5:
|
||||
case 6:
|
||||
TIM_SetCompare2(TIM8, Position);
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
TIM_SetCompare3(TIM8, Position);
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
TIM_SetCompare4(TIM8, Position);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user