mirror of https://github.com/ArduPilot/ardupilot
APM_RC enable_out and disable_out added to APM1 and APM2
* Outputs still enabled by default
This commit is contained in:
parent
acf43341da
commit
47204921e9
|
@ -41,6 +41,9 @@ class APM_RC_Class
|
|||
virtual void clearOverride(void) = 0;
|
||||
virtual void Force_Out() = 0;
|
||||
virtual void SetFastOutputChannels( uint32_t channelmask ) = 0;
|
||||
virtual void enable_out(uint8_t) = 0;
|
||||
virtual void disable_out(uint8_t) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -153,6 +153,40 @@ void APM_RC_APM1::OutputCh(uint8_t ch, uint16_t pwm)
|
|||
}
|
||||
}
|
||||
|
||||
void APM_RC_APM1::enable_out(uint8_t ch)
|
||||
{
|
||||
switch(ch){
|
||||
case 0: TCCR5A |= (1<<COM5B1); break; // CH_1 : OC5B
|
||||
case 1: TCCR5A |= (1<<COM5C1); break; // CH_2 : OC5C
|
||||
case 2: TCCR1A |= (1<<COM1B1); break; // CH_3 : OC1B
|
||||
case 3: TCCR1A |= (1<<COM1C1); break; // CH_4 : OC1C
|
||||
case 4: TCCR4A |= (1<<COM4C1); break; // CH_5 : OC4C
|
||||
case 5: TCCR4A |= (1<<COM4B1); break; // CH_6 : OC4B
|
||||
case 6: TCCR3A |= (1<<COM3C1); break; // CH_7 : OC3C
|
||||
case 7: TCCR3A |= (1<<COM3B1); break; // CH_8 : OC3B
|
||||
case 8: TCCR5A |= (1<<COM5A1); break; // CH_9 : OC5A
|
||||
case 9: TCCR1A |= (1<<COM1A1); break; // CH_10: OC1A
|
||||
case 10: TCCR3A |= (1<<COM3A1); break; // CH_11: OC3A
|
||||
}
|
||||
}
|
||||
|
||||
void APM_RC_APM1::disable_out(uint8_t ch)
|
||||
{
|
||||
switch(ch){
|
||||
case 0: TCCR5A &= ~(1<<COM5B1); break; // CH_1 : OC5B
|
||||
case 1: TCCR5A &= ~(1<<COM5C1); break; // CH_2 : OC5C
|
||||
case 2: TCCR1A &= ~(1<<COM1B1); break; // CH_3 : OC1B
|
||||
case 3: TCCR1A &= ~(1<<COM1C1); break; // CH_4 : OC1C
|
||||
case 4: TCCR4A &= ~(1<<COM4C1); break; // CH_5 : OC4C
|
||||
case 5: TCCR4A &= ~(1<<COM4B1); break; // CH_6 : OC4B
|
||||
case 6: TCCR3A &= ~(1<<COM3C1); break; // CH_7 : OC3C
|
||||
case 7: TCCR3A &= ~(1<<COM3B1); break; // CH_8 : OC3B
|
||||
case 8: TCCR5A &= ~(1<<COM5A1); break; // CH_9 : OC5A
|
||||
case 9: TCCR1A &= ~(1<<COM1A1); break; // CH_10: OC1A
|
||||
case 10: TCCR3A &= ~(1<<COM3A1); break; // CH_11: OC3A
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t APM_RC_APM1::InputCh(uint8_t ch)
|
||||
{
|
||||
uint16_t result;
|
||||
|
|
|
@ -20,6 +20,9 @@ class APM_RC_APM1 : public APM_RC_Class
|
|||
void Force_Out(void);
|
||||
void SetFastOutputChannels(uint32_t chmask);
|
||||
|
||||
void enable_out(uint8_t);
|
||||
void disable_out(uint8_t);
|
||||
|
||||
void Force_Out0_Out1(void);
|
||||
void Force_Out2_Out3(void);
|
||||
void Force_Out6_Out7(void);
|
||||
|
|
|
@ -155,6 +155,34 @@ void APM_RC_APM2::OutputCh(unsigned char ch, uint16_t pwm)
|
|||
}
|
||||
}
|
||||
|
||||
void APM_RC_APM2::enable_out(uint8_t ch)
|
||||
{
|
||||
switch(ch) {
|
||||
case 0: TCCR1A |= (1<<COM1B1); break; // CH_1 : OC1B
|
||||
case 1: TCCR1A |= (1<<COM1A1); break; // CH_2 : OC1A
|
||||
case 2: TCCR4A |= (1<<COM4C1); break; // CH_3 : OC4C
|
||||
case 3: TCCR4A |= (1<<COM4B1); break; // CH_4 : OC4B
|
||||
case 4: TCCR4A |= (1<<COM4A1); break; // CH_5 : OC4A
|
||||
case 5: TCCR3A |= (1<<COM3C1); break; // CH_6 : OC3C
|
||||
case 6: TCCR3A |= (1<<COM3B1); break; // CH_7 : OC3B
|
||||
case 7: TCCR3A |= (1<<COM3A1); break; // CH_8 : OC3A
|
||||
}
|
||||
}
|
||||
|
||||
void APM_RC_APM2::disable_out(uint8_t ch)
|
||||
{
|
||||
switch(ch) {
|
||||
case 0: TCCR1A &= ~(1<<COM1B1); break; // CH_1 : OC1B
|
||||
case 1: TCCR1A &= ~(1<<COM1A1); break; // CH_2 : OC1A
|
||||
case 2: TCCR4A &= ~(1<<COM4C1); break; // CH_3 : OC4C
|
||||
case 3: TCCR4A &= ~(1<<COM4B1); break; // CH_4 : OC4B
|
||||
case 4: TCCR4A &= ~(1<<COM4A1); break; // CH_5 : OC4A
|
||||
case 5: TCCR3A &= ~(1<<COM3C1); break; // CH_6 : OC3C
|
||||
case 6: TCCR3A &= ~(1<<COM3B1); break; // CH_7 : OC3B
|
||||
case 7: TCCR3A &= ~(1<<COM3A1); break; // CH_8 : OC3A
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t APM_RC_APM2::InputCh(unsigned char ch)
|
||||
{
|
||||
uint16_t result;
|
||||
|
|
|
@ -22,6 +22,9 @@ class APM_RC_APM2 : public APM_RC_Class
|
|||
void Force_Out(void);
|
||||
void SetFastOutputChannels(uint32_t chmask);
|
||||
|
||||
void enable_out(uint8_t);
|
||||
void disable_out(uint8_t);
|
||||
|
||||
void Force_Out0_Out1(void);
|
||||
void Force_Out2_Out3(void);
|
||||
void Force_Out6_Out7(void);
|
||||
|
|
Loading…
Reference in New Issue