当前位置: 首页>>代码示例>>C++>>正文


C++ Timer::EnableInterrupts方法代码示例

本文整理汇总了C++中Timer::EnableInterrupts方法的典型用法代码示例。如果您正苦于以下问题:C++ Timer::EnableInterrupts方法的具体用法?C++ Timer::EnableInterrupts怎么用?C++ Timer::EnableInterrupts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Timer的用法示例。


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

示例1: buzzer_init

void buzzer_init()
{
	BUZZER_TIMER_PWR_ON;
	BUZZER_VOL_DAC_PWR_ON;

	DacInit(BUZZER_VOL_DAC);
	DacSetReference(dac_avcc);

	//buzzer
	buzzer_timer.Init(BUZZER_TIMER, timer_div1024);
	buzzer_timer.SetMode(timer_pwm);
	buzzer_timer.EnableOutputs(timer_A);
	buzzer_timer.EnableInterrupts(timer_overflow);

	buzzer_set_vol(0);
}
开发者ID:leachim1,项目名称:SkyDrop,代码行数:16,代码来源:buzzer.cpp

示例2: task_timer_setup

void task_timer_setup(bool full_speed)
{
	TASK_TIMER_PWR_ON;

	if (full_speed)
		task_timer.Init(TASK_TIMER, timer_div256);
	else
		task_timer.Init(TASK_TIMER, timer_div4);

	task_timer.Stop();
	task_timer.EnableInterrupts(timer_overflow);
	task_timer.SetValue(0);
	task_timer.SetTop(63999); //125 == 1ms
	task_timer_high = 0;

	task_timer.Start();

}
开发者ID:pculka,项目名称:SkyDrop,代码行数:18,代码来源:tasks.cpp

示例3: fc_init


//.........这里部分代码省略.........
        eeprom_busy_wait();
        eeprom_update_byte(&config_ro.hw_revision, hw_revision);
        eeprom_busy_wait();

        mems_power_init();
        io_init();
        mems_power_on();
        assert(mems_i2c_init());
    }
    else
    {
        if (hw_revision == HW_REW_UNKNOWN)
        {
            hw_revision = HW_REW_1506;
            eeprom_busy_wait();
            eeprom_update_byte(&config_ro.hw_revision, hw_revision);
            eeprom_busy_wait();

            mems_power_init();
            io_init();
            mems_power_on();
            mems_i2c_init();
        }
    }


    if (!mems_i2c_init())
    {
        DEBUG("I2C error!\nUnable to init flight computer!\n");
        return;
    }

    //Barometer
    ms5611.Init(&mems_i2c, MS5611_ADDRESS_CSB_LO);

    //Magnetometer + Accelerometer
    lsm303d_settings lsm_cfg;

    lsm_cfg.enabled = true;
    lsm_cfg.accOdr = lsm_acc_1600Hz;
    lsm_cfg.accScale = lsm_acc_16g;

    lsm_cfg.magOdr = lsm_mag_100Hz;
    lsm_cfg.magScale = lsm_mag_4g;
    lsm_cfg.magHiRes = true;

    lsm_cfg.tempEnable = false;

    //Acceleration calculation init
    accel_calc_init();
    //Magnetic field calculation init
    mag_calc_init();

    //Gyro
    l3gd20_settings l3g_cfg;
    l3g_cfg.enabled = true;
    l3g_cfg.bw = l3g_50Hz;
    l3g_cfg.odr = l3g_760Hz;
    l3g_cfg.scale = l3g_2000dps;

    //SHT21
    sht21_settings sht_cfg;
    sht_cfg.rh_enabled = true;
    sht_cfg.temp_enabled = true;

    //XXX: do self-test?
    lsm303d.Init(&mems_i2c, lsm_cfg);
    lsm303d.Start();

    l3gd20.Init(&mems_i2c, l3g_cfg);
    l3gd20.Start();

    sht21.Init(&mems_i2c, sht_cfg);

    //Measurement timer
    FC_MEAS_TIMER_PWR_ON;

    fc_meas_timer.Init(FC_MEAS_TIMER, timer_div1024);
    fc_meas_timer.SetInterruptPriority(MEDIUM);
    fc_meas_timer.EnableInterrupts(timer_overflow | timer_compareA | timer_compareB | timer_compareC);

    //tight timing!	      1 tick 0.032 ms
    //MS pressure conversion     9.040 ms
    //   temperature conversion  0.600 ms
    //MAG read 					 0.152 ms
    //ACC read					 1.600 ms
    //Gyro read					 1.000 ms
    fc_meas_timer.SetTop(313); // == 10ms
    fc_meas_timer.SetCompare(timer_A, 27); // == 0.78 ms
    fc_meas_timer.SetCompare(timer_B, 70); // == 2 ms
    fc_meas_timer.SetCompare(timer_C, 200); // == 6 ms

    ms5611.StartTemperature();
    lsm303d.StartReadMag(); //it takes 152us to transfer
    _delay_ms(1);

    fc_meas_timer.Start();

    DEBUG(" *** FC init done ***\n");
}
开发者ID:DD1984,项目名称:skydrop_stm32,代码行数:101,代码来源:fc.cpp

示例4: fc_init

void fc_init()
{
	DEBUG(" *** Flight computer init ***\n");

	//load configuration
	cfg_load();

	//start values
	eeprom_busy_wait();
	active_page = eeprom_read_byte(&config.gui.last_page);

	fc.epoch_flight_start = 0;
	fc.autostart_state = false;

	fc.temp_step = 0;


	//init calculators
	vario_init();
	audio_init();

	gps_init();
	if (fc.use_gps)
		gps_start();

	bt_init();
//	if (fc.use_flage & ENABLE_BT)
//		bt_module_init();

	//VCC to baro, acc/mag gyro
	MEMS_POWER_ON;

	GpioSetDirection(IO0, OUTPUT);
	GpioWrite(IO0, HIGH);

	//init and test i2c
	if (!mems_i2c_init())
	{
		DEBUG("ERROR I2C\n");
		led_set(0xFF, 0, 0);
	}


	//Barometer
	ms5611.Init(&mems_i2c, MS5611_ADDRESS_CSB_LO);


	//Magnetometer + Accelerometer
	lsm303d_settings lsm_cfg;

	lsm_cfg.enabled = true;
	lsm_cfg.accOdr = lsm_acc_1600Hz;
	lsm_cfg.accScale = lsm_acc_16g;

	lsm_cfg.magOdr = lsm_mag_100Hz;
	lsm_cfg.magScale = lsm_mag_4g;
	lsm_cfg.magHiRes = true;

	lsm_cfg.tempEnable = false;

	//Gyro
	l3gd20_settings l3g_cfg;
	l3g_cfg.enabled = true;
	l3g_cfg.bw = l3g_50Hz;
	l3g_cfg.odr = l3g_760Hz;
	l3g_cfg.scale = l3g_2000dps;

	sht21_settings sht_cfg;
	sht_cfg.rh_enabled = true;
	sht_cfg.temp_enabled = true;

	//XXX: do self-test?
	lsm303d.Init(&mems_i2c, lsm_cfg);
	lsm303d.Start();

	l3gd20.Init(&mems_i2c, l3g_cfg);
	l3gd20.Start();

	sht21.Init(&mems_i2c, sht_cfg);

	//Measurement timer
	FC_MEAS_TIMER_PWR_ON;

	fc_meas_timer.Init(FC_MEAS_TIMER, timer_div256); //125 == 1ms
	fc_meas_timer.SetInterruptPriority(MEDIUM);
	fc_meas_timer.EnableInterrupts(timer_overflow | timer_compareA | timer_compareB | timer_compareC);
	fc_meas_timer.SetTop(125 * 10); // == 10ms
	fc_meas_timer.SetCompare(timer_A, 100); // == 0.64ms
	fc_meas_timer.SetCompare(timer_B, 430); // == 2.7ms
	fc_meas_timer.SetCompare(timer_C, 555); // == 3.7ms
	fc_meas_timer.Start();

	DEBUG(" *** FC init done ***\n");

}
开发者ID:dumitru41,项目名称:SkyDrop,代码行数:95,代码来源:fc.cpp

示例5: audio_init

void audio_init()
{
    AUDIO_TIMER_PWR_ON;
    audio_timer.Init(AUDIO_TIMER, timer_div1024);
    audio_timer.EnableInterrupts(timer_overflow);
}
开发者ID:leachim1,项目名称:SkyDrop,代码行数:6,代码来源:audio.cpp


注:本文中的Timer::EnableInterrupts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。