您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tc_write_rc函数代码示例

51自学网 2021-06-03 08:41:44
  C++
这篇教程C++ tc_write_rc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tc_write_rc函数的典型用法代码示例。如果您正苦于以下问题:C++ tc_write_rc函数的具体用法?C++ tc_write_rc怎么用?C++ tc_write_rc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tc_write_rc函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sam_timer_early_init

void sam_timer_early_init(void){#if 0	pmc_enable_periph_clk(ID_TC0);	uint32_t ul_div;	uint32_t ul_tcclks;	uint32_t ul_sysclk = MCLK; // sysclk_get_cpu_hz();	tc_find_mck_divisor(100, ul_sysclk, &ul_div, &ul_tcclks, ul_sysclk);	tc_init(TC0, 0, TC_CMR_TCCLKS_TIMER_CLOCK1 | TC_CMR_CPCTRG);	tc_write_rc(TC0, 0, (ul_sysclk / ul_div) / 4);	tc_find_mck_divisor(100, ul_sysclk, &ul_div, &ul_tcclks, ul_sysclk);	tc_init(TC0, 0, TC_CMR_TCCLKS_TIMER_CLOCK1 | TC_CMR_CPCTRG);	tc_write_rc(TC0, 0, 0xffff); // slowest we can run	/* Configure and enable interrupt on RC compare */	NVIC_SetPriority(ID_TC0, arm_cm_highest_priority());	NVIC_EnableIRQ((IRQn_Type) ID_TC0);	tc_enable_interrupt(TC0, 0, TC_IER_CPCS);#endif	tc_start(TC0, 0);    arm_cm_systick_init(MCLK);}
开发者ID:M1cha,项目名称:lk,代码行数:28,


示例2: rtimer_arch_schedule

voidrtimer_arch_schedule(rtimer_clock_t t){	#if DEBUG	printf("DEBUG: rtimer_arch_schedule time %llu/r/n", /*((uint32_t*)&t)+1,*/(uint64_t)t);	#endif	next_rtimer_time = t;		rtimer_clock_t now = rtimer_arch_now();		rtimer_clock_t clock_to_wait = t - now;			if(clock_to_wait <= 0x100000000){ // We must set now the Timer Compare Register.			// Set the auxiliary timer (TC0,1) at the write time interrupt		// [clock_to_wait] TODO Check the standard drift and perhaps remove it from the waiting time		tc_write_rc(TC0,1,(uint32_t)(t-rtimer_arch_now())); 		// Set and enable interrupt on RC compare		tc_enable_interrupt(TC0,1,TC_IER_CPCS);		// Start the auxiliary timer		tc_start(TC0,1);				#if DEBUG		now = rtimer_arch_now();		printf("DEBUG: Timer started on time %llu./n",now);		#endif	}// else compare register will be set at overflow interrupt closer to the rtimer event.}
开发者ID:EmuxEvans,项目名称:calipso,代码行数:31,


示例3: vInitialiseTimerForIntQueueTest

void vInitialiseTimerForIntQueueTest( void ){uint32_t ulDivider, ulTCCLKS;	/* Configure PMC for TC0. */	pmc_enable_periph_clk( ID_TC0 );	/* Configure TC0 channel 0 for interrupts at tmrTIMER_0_FREQUENCY. */	tc_find_mck_divisor( tmrTIMER_0_FREQUENCY, configCPU_CLOCK_HZ, &ulDivider, &ulTCCLKS, configCPU_CLOCK_HZ );	tc_init( TC0, 0, ulTCCLKS | TC_CMR_CPCTRG );	ulDivider <<= 1UL;	tc_write_rc( TC0, 0, ( configCPU_CLOCK_HZ / ulDivider ) / tmrTIMER_0_FREQUENCY );	tc_enable_interrupt( TC0, 0, TC_IER_CPCS );	/* Configure and enable interrupts for both TC0 and TC1, as TC1 interrupts	are manually pended from within the TC0 interrupt handler (see the notes at	the top of this file). */	NVIC_ClearPendingIRQ( TC0_IRQn );	NVIC_ClearPendingIRQ( TC1_IRQn );	NVIC_SetPriority( TC0_IRQn, tmrLOWER_PRIORITY );	NVIC_SetPriority( TC1_IRQn, tmrHIGHER_PRIORITY );	NVIC_EnableIRQ( TC0_IRQn );	NVIC_EnableIRQ( TC1_IRQn );	/* Start the timer last of all. */	tc_start( TC0, 0 );}
开发者ID:Eclo,项目名称:FreeRTOS,代码行数:27,


示例4: enable_output

static void enable_output(const channel_def_t* channel, int freq){    if (channel->externally_driven)    {        uint32_t clock = sysclk_get_peripheral_bus_hz(channel->ex.timer) / 32; // clock source is PB / 32        uint32_t rc = clock / freq;                    // check for over/underflow        if (rc > 0xffff) rc = 0xffff;        else if (rc < 8) rc = 8;        // set up RA, RB, and RC.  always use 50% duty cycle (RA = RB = RC/2)        tc_write_ra(channel->ex.timer, channel->ex.channel, (uint16_t)rc / 2);        tc_write_rb(channel->ex.timer, channel->ex.channel, (uint16_t)rc / 2);        tc_write_rc(channel->ex.timer, channel->ex.channel, (uint16_t)rc);        tc_start(channel->ex.timer, channel->ex.channel);    }    else if (channel->in.active_level)    {        gpio_set_pin_high(channel->in.pin1);    }    else    {        gpio_set_pin_low(channel->in.pin1);    }}
开发者ID:ShankarWright,项目名称:TklabsVanet,代码行数:26,


示例5: clock_init

//Initialize the clockvoid clock_init(void){	GlobalInterruptDisable();	INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_TC_IRQ0), AVR32_INTC_INT0, tc_irq);	GlobalInterruptEnable();	// Initialize the timer/counter.	tc_init_waveform(tc, &WAVEFORM_OPT);         // Initialize the timer/counter waveform.	// Set the compare triggers.	// Remember TC counter is 16-bits, so counting second is not possible with fPBA = 12 MHz.	// We configure it to count ms.	// We want: (1/(fPBA/8)) * RC = 0.001 s, hence RC = (fPBA/8) / 1000 = 1500 to get an interrupt every 1 ms.	tc_write_rc(tc, TC_CHANNEL, (F_PBA_SPEED / 8) / 1000); // Set RC value.	//tc_write_ra(tc, TC_CHANNEL, 0);					// Set RA value.	//tc_write_rb(tc, TC_CHANNEL, 1900);				// Set RB value.	//gpio_enable_module_pin(AVR32_TC_A0_0_1_PIN, AVR32_TC_A0_0_1_FUNCTION);	//gpio_enable_module_pin(AVR32_TC_B0_0_1_PIN, AVR32_TC_B0_0_1_FUNCTION);	tc_configure_interrupts(tc, TC_CHANNEL, &TC_INTERRUPT);	// Start the timer/counter.	tc_start(tc, TC_CHANNEL);                    // And start the timer/counter.}
开发者ID:satrian,项目名称:sdr-mk15,代码行数:27,


示例6: configure_tc

// [main_tc_configure]static void configure_tc(void){	uint32_t ul_div;	uint32_t ul_tcclks;	uint32_t ul_sysclk = sysclk_get_cpu_hz();	/* Configure PMC */	pmc_enable_periph_clk(ID_TC0);#if SAMG55	/* Enable PCK output */	pmc_disable_pck(PMC_PCK_3);	pmc_switch_pck_to_sclk(PMC_PCK_3, PMC_PCK_PRES_CLK_1);	pmc_enable_pck(PMC_PCK_3);#endif	/** Configure TC for a 4Hz frequency and trigger on RC compare. */	tc_find_mck_divisor(4, ul_sysclk, &ul_div, &ul_tcclks, ul_sysclk);	tc_init(TC0, 0, ul_tcclks | TC_CMR_CPCTRG);	tc_write_rc(TC0, 0, (ul_sysclk / ul_div) / 4);	/* Configure and enable interrupt on RC compare */	NVIC_EnableIRQ((IRQn_Type) ID_TC0);	tc_enable_interrupt(TC0, 0, TC_IER_CPCS);#ifdef LED1_GPIO	/** Start the counter if LED1 is enabled. */	if (g_b_led1_active) {		tc_start(TC0, 0);	}#else	tc_start(TC0, 0);#endif}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:34,


示例7: HAL_TimerInit

/*************************************************************************//*******************************************************************************/void HAL_TimerInit(void){	halTimerIrqCount					= 0;	// System Tick	sysclk_enable_peripheral_clock(SYSTIMER_TICK_CHANNEL_ID);	tc_init(SYSTIMER, SYSTIMER_TICK_CHANNEL, TC_CMR_TCCLKS_TIMER_CLOCK3 | TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC);	NVIC_DisableIRQ(SYSTIMER_TICK_CHANNEL_IRQn);	NVIC_ClearPendingIRQ(SYSTIMER_TICK_CHANNEL_IRQn);	NVIC_EnableIRQ(SYSTIMER_TICK_CHANNEL_IRQn);	tc_enable_interrupt(SYSTIMER, SYSTIMER_TICK_CHANNEL, TC_IER_CPCS);	tc_write_rc(SYSTIMER, SYSTIMER_TICK_CHANNEL, TIMER_TOP);	tc_start(SYSTIMER, SYSTIMER_TICK_CHANNEL);	sysclk_enable_peripheral_clock(SYSTIMER_DELAY_CHANNEL_ID);	tc_init(SYSTIMER, SYSTIMER_DELAY_CHANNEL, TC_CMR_TCCLKS_TIMER_CLOCK3 | TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_CPCDIS | TC_CMR_CPCSTOP);	NVIC_DisableIRQ(SYSTIMER_DELAY_CHANNEL_IRQn);	NVIC_ClearPendingIRQ(SYSTIMER_DELAY_CHANNEL_IRQn);	NVIC_EnableIRQ(SYSTIMER_DELAY_CHANNEL_IRQn);		tc_enable_interrupt(SYSTIMER, SYSTIMER_DELAY_CHANNEL, TC_IER_CPCS);}
开发者ID:nandojve,项目名称:embedded,代码行数:27,


示例8: audioFrequencySet

// Set the frequency of the generated tone. 0 means off.void audioFrequencySet(uint32_t freq) {	// In order to avoid audio hiccups, don't do anything if setting 	// same frequency. 	if (currFreq == freq) {		return;	}		tc_stop(TC0, 0);	if (freq == 0) {		return;	}		// Find the best divisor for this frequency	uint32_t ul_div, ul_tcclks;	tc_find_mck_divisor(freq, SystemCoreClock, 		&ul_div, &ul_tcclks, SystemCoreClock);			// Put Timer into wavesel up RC mode with TIOA at 50% duty cycle	// Clear TIOA at CPC match and set at CPA match	tc_init(TC0, 0, ul_tcclks | TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC | TC_CMR_ACPC_CLEAR | TC_CMR_ACPA_SET);	uint16_t rcVal = (SystemCoreClock / ul_div) / freq;	tc_write_rc(TC0, 0, rcVal);	tc_write_ra(TC0, 0, rcVal / 2);  // 50% duty cycle		// Start the thing	tc_start(TC0, 0);		currFreq = freq;}
开发者ID:alanvgreen,项目名称:DirSpk1,代码行数:30,


示例9: lp_ticker_set_interrupt

void lp_ticker_set_interrupt(timestamp_t timestamp){    uint32_t cur_time;    uint32_t delta;    cur_time = lp_ticker_read();    delta = timestamp - cur_time;    uint16_t interruptat=0;    if(delta > OVERFLOW_16bit_VALUE) {        lp_ticker_interrupt_counter= (delta/OVERFLOW_16bit_VALUE) -1;        lp_ticker_interrupt_offset=delta%OVERFLOW_16bit_VALUE;        interruptat=OVERFLOW_16bit_VALUE;    } else {        lp_ticker_interrupt_counter=0;        lp_ticker_interrupt_offset=0;        interruptat=delta;    }    NVIC_DisableIRQ(TICKER_COUNTER_IRQn2);    tc_write_rc(TICKER_COUNTER_lp, TICKER_COUNTER_CHANNEL2, (uint32_t)interruptat);    NVIC_ClearPendingIRQ(TICKER_COUNTER_IRQn2);    NVIC_SetPriority(TICKER_COUNTER_IRQn2, 0);    NVIC_EnableIRQ(TICKER_COUNTER_IRQn2);    tc_enable_interrupt(TICKER_COUNTER_lp, TICKER_COUNTER_CHANNEL2, TC_IDR_CPCS );    tc_start(TICKER_COUNTER_lp, TICKER_COUNTER_CHANNEL2);}
开发者ID:Archcady,项目名称:mbed-os,代码行数:31,


示例10: config_uart

void config_uart(void){		/* configura pinos */	gpio_configure_group(PINS_UART0_PIO, PINS_UART0, PINS_UART0_FLAGS);		/* ativa clock */	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);		/* Configura
C++ tcase_add_checked_fixture函数代码示例
C++ tc_start函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。