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

📄 terminal_led.c

📁 在ATEML公司EB40/40a/42/63/55开发板上运行的uCOS-II v2.0
💻 C
字号:
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : led_blink.c
//* Object              : Led Blinking for the AT91EB40, use PIO in input and
//*                       output
//*
//* 1.0 00/00/00 JCZ    : Creation
//*----------------------------------------------------------------------------

#ifdef SEMIHOSTING
#include <stdio.h>
#endif

#include    "parts/r40807/lib_r40807.h"
#include    "eb40.h"

//*----------------------------------------------------------------------------
//* Function Name       : delay
//* Object              : Wait
//* Input Parameters    : none
//* Output Parameters   : none
//* Functions called    : at91_pio_read
//*----------------------------------------------------------------------------
void delay ( void )
{
    u_int    i ;

    //* loop delay
    for ( i = 0 ;(i < 5000);i++ ) ;

    //* loop delay when SW4 is released
    for ( i = 0 ;
          (i < 10000) &&  (( at91_pio_read ( &PIO_DESC) & SW4_MASK ) != SW4_MASK );
          i++ ) ;
/*
    //* while SW3 is push wait
    while ( ( at91_pio_read ( &PIO_DESC) & SW3_MASK ) == SW3_MASK );

    //* while SW5 is push wait
    while ( ( at91_pio_read ( &PIO_DESC) & SW5_MASK ) == SW5_MASK );
*/
}

//*----------------------------------------------------------------------------
//* Function Name       : led
//* Object              : the led blink
//* Input Parameters    : none
//* Output Parameters   : TRUE
//* Functions called    : at91_pio_open, at91_pio_write, delay
//*----------------------------------------------------------------------------
int led( void )
//* Begin
{
    u_int   loop_count = 0 ;

    //* define led at PIO output
    at91_pio_open ( &PIO_DESC, LED_MASK, PIO_OUTPUT );

    //* define switch at PIO input
    //at91_pio_open ( &PIO_DESC, SW_MASK, PIO_INPUT );

        
        at91_pio_write ( &PIO_DESC, LED1, LED_ON );
        delay () ;
        at91_pio_write ( &PIO_DESC, LED1, LED_OFF );
        
        at91_pio_write ( &PIO_DESC, LED2, LED_ON );
        delay () ;
        at91_pio_write ( &PIO_DESC, LED2, LED_OFF );
        
        at91_pio_write ( &PIO_DESC, LED3, LED_ON );
        delay () ;
        at91_pio_write ( &PIO_DESC, LED3, LED_OFF );


#ifdef SEMIHOSTING
       printf ( "Loop %d\n", loop_count ) ;
#endif
        loop_count ++ ;

   return(TRUE);
//* End
}

⌨️ 快捷键说明

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