Exemple #1
0
void APM_RC_APM1::SetFastOutputChannels(uint32_t chmask, uint16_t speed_hz)
{
    uint16_t icr = _map_speed(speed_hz);

    if ((chmask & ( _BV(CH_1) | _BV(CH_2) | _BV(CH_9))) != 0) {
        ICR5 = icr;
    }

    if ((chmask & ( _BV(CH_3) | _BV(CH_4) | _BV(CH_10))) != 0) {
        ICR1 = icr;
    }

 #if 0
    if ((chmask & ( _BV(CH_5) | _BV(CH_6))) != 0) {
        /* These channels intentionally left blank:
         * Can't change output speed of ch5 (OCR4B) and ch6 (OCR4C).
         * Timer 4 period controlled by OCR4A, and used for input
         * capture on ICR4.
         * If the period of Timer 4 must be changed, the input capture
         * code will have to be adjusted as well
         */
    }
 #endif

    if ((chmask & ( _BV(CH_7) | _BV(CH_8) | _BV(CH_11))) != 0) {
        ICR3 = icr;
    }

}
void APM_RC_APM2::SetFastOutputChannels(uint32_t chmask, uint16_t speed_hz)
{
	uint16_t icr = _map_speed(speed_hz);

	if ((chmask & ( _BV(CH_1) | _BV(CH_2))) != 0) {
		ICR1 = icr;
	}

	if ((chmask & ( _BV(CH_3) | _BV(CH_4) | _BV(CH_5))) != 0) {
		ICR4 = icr;
	}

	if ((chmask & ( _BV(CH_6) | _BV(CH_7) | _BV(CH_8))) != 0) {
		ICR3 = icr;
	}
}