utility.c

来自「The AVRcam source files were built using」· C语言 代码 · 共 49 行

C
49
字号
/***********************************************************
    Module Name: Utility.c
    Module Date: 04/13/2004
    Module Auth: John Orlando 
    Copyright (c) 2004 John Orlando  All Rights Reserved 

    Description: This module provides a basic set of
    general purpose utilities that can be used by any
    module needing them.
    ***********************************************************/

/*	Includes */
#include "CommonDefs.h"

/*  Local Variables */

/* 	Local Structures and Typedefs */

/*  Extern Variables */

/*  Definitions */

/***********************************************************
    Function Name: Utility_delay
    Function Description: This function provides a busy-wait
    delay for a specified number of milliseconds.
    Inputs:  numMs - the number of milliseconds to delay
    Outputs: none
    NOTES: The delay_loop_1 and delay_loop_2 functions found
    in avr/delay.h provide accurate 3 and 4 cycle delay loops
    if needed...this isn't really a millisecond, so DON'T
    depend on it for exact timing...
    ***********************************************************/
void Utility_delay(unsigned short numMs)
{
    volatile unsigned short i=0,j=0;
#ifndef SIMULATION
    for (i=0; i<numMs; i++)
    {
        for (j=0; j<1000; j++)
        {
            asm volatile("nop"::);
        }
    }
#endif
}


⌨️ 快捷键说明

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