⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 realtime.c

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 C
字号:
//  This file is part of MANTIS OS, Operating System//  See http://mantis.cs.colorado.edu/////  Copyright (C) 2003,2004,2005 University of Colorado, Boulder////  This program is free software; you can redistribute it and/or//  modify it under the terms of the mos license (see file LICENSE)#include "mos.h"#include "msched.h"#include "led.h"#ifndef SCONS#include "config.h"#endif/** @brief Local Variables for measuring time elapsed * */static uint32_t realtime_count;static uint16_t skew_adjust;void real_timer_clear(){   realtime_count=0;   TCNT2 = 0;}void real_timer_init(void){   skew_adjust=1;   uint8_t int_handle;   int_handle = mos_disable_ints();   TCCR2 &= ~((1 << WGM20));   TCCR2 |= (1 << WGM21);//Clear timer after interrupt   TCCR2 |= (1 << CS21) | (1 << CS20);   OCR2   = 114;          //fire an interrupt every ms   TIFR  |= (1 << OCF2);  //clear flag   TIMSK |= (1 << OCIE2); //turn on interrupt   real_timer_clear();   mos_enable_ints(int_handle);}inline uint32_t* real_timer_get_ticks(){   return &realtime_count;}SIGNAL(SIG_OUTPUT_COMPARE2){/*   realtime_count++;   if((skew_adjust++ % 160) == 0){      realtime_count++;      skew_adjust = 1;   }*/}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -