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

📄 led.c

📁 HAL硬件抽象层源码
💻 C
字号:
/***************************************************************************
 * Copyright ? Intel Corporation, March 18th 1998.  All rights reserved.
 * Copyright ? ARM Limited 1998.  All rights reserved.
 ***************************************************************************/
/******************************************************************************

	$Id: led.c,v 1.7 1999/08/13 07:45:41 mwelsh Exp $

******************************************************************************/

#include "uhal.h"

#ifdef SEMIHOSTED
extern void print_header( void);
extern void print_end (void);
#endif

char * test_name = "Heap Storage Tests\n";
char * test_ver = "Program Version 1.0\n";

int main (int argc, int *argv[])
{
  unsigned int     count, max, on ;
  unsigned int     wait, i, j ;

  count = uHALr_InitLEDs() ;
  max = (1 << count) ;

  // init the library
  uHALr_LibraryInit() ;

#ifdef SEMIHOSTED
  print_header();
  uHALr_printf("\nCheck target for flashing LEDs\n");
#endif

  while(1) {
    for (i = 0 ; i < max ; i++ ) {
      /* which LEDs are on? */
      on = (max - 1) & i ;

      for (j = 0; j < count ; j++) 
	uHALr_WriteLED(j+1,
		     (on & (1 << j) ? 1 : 0)) ;

      /* wait a while */
      for (wait = 0 ; wait < 100000 ; wait++)
	;
    }
  }
  return (OK);
}

⌨️ 快捷键说明

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