heartbeat.c

来自「IT projecotr reference design.」· C语言 代码 · 共 52 行

C
52
字号
/****************************************************************************/
/*             TEXAS INSTRUMENTS PROPRIETARY INFORMATION                    */
/*                                                                          */
/*  (c) Copyright, Texas Instruments Incorporated, 2006.                    */
/*      All Rights Reserved.                                                */
/*                                                                          */
/*  Property of Texas Instruments Incorporated. Restricted Rights -         */
/*  Use, duplication, or disclosure is subject to restrictions set          */
/*  forth in TI's program license agreement and associated documentation.   */
/****************************************************************************/

/****************************************************************************/
/* heartbeat.c                                                              */
/*                                                                          */
/* System heartbeat indicator.                                              */
/****************************************************************************/

#include "common.h"
#include "gpio.h"

#include "iox.h"
#include "gpioFunction.h"
#include "heartbeat.h"

static uint16 counter;                      /* LSB defines indicator on/off */



/****************************************************************************/
/* Periodic polling callback function.                                      */
/****************************************************************************/

int16 heartbeat_poll( uint16 tick )
{
    iox_pinSet( HEARTBEAT_LED, (BOOL)( ++counter & 1 ));

    return HEARTBEAT_PERIOD / RTOS_MS_PER_TICK;
}



/****************************************************************************/
/* Module reset function.                                                   */
/****************************************************************************/

EXEC_CC_ENUM heartbeat_init( void )
{
    iox_cfgSet( IOX_PINCFG( HEARTBEAT_LED, IOX_OUT, IOX_FALSE ));
        
    return EXEC_CC_PASS;
}

⌨️ 快捷键说明

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