예제 #1
0
파일: main.c 프로젝트: MbedTinkerer/OpenIR
//--------------------------------------------------------------------------------
//
//  Main program loop.
//
void main()
{
    __disable_interrupt();
    _pulseDataAddress = (char *) EEPROM_PULSE_DATA;
    _numberOfPulses = *_pulseDataAddress++;
    SetupPorts();
    SetupUART();
    SetupTimer2();
    SetupTimer1();
    __enable_interrupt();
    while (1)
    {
        __wait_for_interrupt();
    }
}
예제 #2
0
파일: port.c 프로젝트: HclX/freertos
	static void prvSleep( TickType_t xExpectedIdleTime )
	{
		/* Allow the application to define some pre-sleep processing. */
		configPRE_SLEEP_PROCESSING( xExpectedIdleTime );

		/* xExpectedIdleTime being set to 0 by configPRE_SLEEP_PROCESSING()
		means the application defined code has already executed the WAIT
		instruction. */
		if( xExpectedIdleTime > 0 )
		{
			__wait_for_interrupt();
		}

		/* Allow the application to define some post sleep processing. */
		configPOST_SLEEP_PROCESSING( xExpectedIdleTime );
	}
예제 #3
0
파일: delay.c 프로젝트: dimka-rs/stm8-iar
void Delayus(unsigned int usec){
  CLK_PCKENR1 = CLK_PCKENR1 | (1 << 5); //bit 5 - timer2 clock
  TIM2_CR1_bit.OPM = 1; //one pulse mode
  //TIM2_CR1_bit.URS = 1; //only hw causes UEV
  TIM2_IER_bit.CC1IE = 1; //enable interrupt on compare 1
  TIM2_CCR1H = usec/256; //load high byte
  TIM2_CCR1L = usec%256; //load low byte
  TIM2_CNTRH = 0; // reset counter
  TIM2_CNTRL = 0; // reset counter
  TIM2_SR1_bit.CC2IF = 0; //clear CC2 interrupt flag
  TIM2_PSCR = 0x04; // Divide by 2^4 to get 1MHz clock
  TIM2_EGR_bit.UG = 1; //generate UEV to update actual prescaler
  ITC_SPR4 = ITC_SPR4 | 0x30; //IRQ14 Vector14 is TIM2 cc int priority   ///???
  TIM2_CR1_bit.CEN = 1; //start timer
  __enable_interrupt();
  __wait_for_interrupt();
}