User/ppm.c
/*
*	- Continuously send 8 PWMs through GPIO_PB1 pin.
*	- each pwm pulse's low level width is 0.5ms
*	  the high level width shouldn't less than
*	  0.5ms, and greater than 1.5ms.
*	- the frequence of PPM output signal is 50Hz,
*	  so the period is 20ms.
*/
Continuously send 8 PWMs through GPIO_PB1 pin.
each pwm pulse's low level width is 0.5ms
the high level width shouldn't less than
0.5ms, and greater than 1.5ms.
the frequence of PPM output signal is 50Hz,
so the period is 20ms.
Continuously send 8 PWMs through GPIO_PB1 pin . each pwm pulse ' s low level width is 0 . 5ms the high level width shouldn ' t less than 0 . 5ms and greater than 1 . 5ms . the frequence of PPM output signal is 50Hz so the period is 20ms .
void ppm_output(void){
    uint32_t ch_val = 0;
    if (CH_DOWN_STATE == state) {
        systick_init(MS05);
        total_value += MS05;
        state = CH_UP_STATE;
        GPIO_ResetBits(GPIOB, GPIO_Pin_1);
    } else {
        if (ch_idx < RC_CH_NUM) {
            if (interval[ch_idx] < (MS05))
                ch_val = MS05;
            else {
                ch_val = (interval[ch_idx] << 1) - MS05;
            }
            systick_init(ch_val);
            total_value += ch_val;
            ch_idx++;
        } else {
            systick_init(MS20 - total_value);
            total_value = 0;
            ch_idx = 0;
        }
        state = CH_DOWN_STATE;
        GPIO_SetBits(GPIOB, GPIO_Pin_1);
    }     
}
void ppm_output ( void ) { uint32_t ch_val = 0 ; if ( CH_DOWN_STATE == state ) { systick_init ( MS05 ) ; total_value += MS05 ; state = CH_UP_STATE ; GPIO_ResetBits ( GPIOB , GPIO_Pin_1 ) ; } else { if ( ch_idx < RC_CH_NUM ) { if ( interval [ ch_idx ] < ( MS05 ) ) ch_val = MS05 ; else { ch_val = ( interval [ ch_idx ] << 1 ) - MS05 ; } systick_init ( ch_val ) ; total_value += ch_val ; ch_idx ++ ; } else { systick_init ( MS20 - total_value ) ; total_value = 0 ; ch_idx = 0 ; } state = CH_DOWN_STATE ; GPIO_SetBits ( GPIOB , GPIO_Pin_1 ) ; } }
Continuously send 8 PWMs through GPIO_PB1 pin.
Continuously send 8 PWMs through GPIO_PB1 pin .
/* for CH1 ~ CH8 and the last one low level interval */ /* next systick interrupt after 0.5ms */ /* for channedl CH1 ~ CH8 high level interval */ /* the last long high level interval */