示例#1
0
文件: gTIMER.c 项目: MarkDing/sim3sdk
/*
 * idx indicate Timer0L, Timer0H, Timer1L,Timer1H
 * Timer affect circular in buffer.
 */
void stop_timer(uint8_t idx)
{
    uint8_t ep = (idx + 1) | 0x80;
    circular_buffer_pools_t * cb_in = circular_buffer_pointer(ep);
    uint16_t timer_reload = circular_buffer_timer_reload(cb_in);
    switch(idx)
    {
        case 0:
            SI32_TIMER_A_stop_low_timer (SI32_TIMER_0);
            SI32_TIMER_A_clear_low_overflow_interrupt (SI32_TIMER_0);
            SI32_TIMER_A_set_low_count (SI32_TIMER_0, timer_reload);
            break;
        case 1:
            SI32_TIMER_A_stop_high_timer (SI32_TIMER_0);
            SI32_TIMER_A_clear_high_overflow_interrupt (SI32_TIMER_0);
            SI32_TIMER_A_set_high_count (SI32_TIMER_0, timer_reload);
            break;
        case 2:
            SI32_TIMER_A_stop_low_timer (SI32_TIMER_1);
            SI32_TIMER_A_clear_low_overflow_interrupt (SI32_TIMER_1);
            SI32_TIMER_A_set_low_count (SI32_TIMER_1, timer_reload);
            break;
        case 3:
            SI32_TIMER_A_stop_high_timer (SI32_TIMER_1);
            SI32_TIMER_A_clear_high_overflow_interrupt (SI32_TIMER_1);
            SI32_TIMER_A_set_high_count (SI32_TIMER_1, timer_reload);
            break;
    }
    circular_buffer_put_read_ready(cb_in,1);
}
示例#2
0
void wave_4k_stop(void)
{
	SI32_TIMER_A_stop_low_timer(SI32_TIMER_1);
}