Čeština / English
Login

SVN Repository / Prohlížení

Aktuální adresář: FITkit / trunk / apps / demo / led / mcu /

main.c

   1  /*******************************************************************************
   2     user_main: main for LED diode test
   3     Copyright (C) 2009 Brno University of Technology,
   4                        Faculty of Information Technology
   5  
   6     LICENSE TERMS
   7  
   8     Redistribution and use in source and binary forms, with or without
   9     modification, are permitted provided that the following conditions
  10     are met:
  11     1. Redistributions of source code must retain the above copyright
  12        notice, this list of conditions and the following disclaimer.
  13     2. Redistributions in binary form must reproduce the above copyright
  14        notice, this list of conditions and the following disclaimer in
  15        the documentation and/or other materials provided with the
  16        distribution.
  17     3. All advertising materials mentioning features or use of this software
  18        or firmware must display the following acknowledgement:
  19  
  20          This product includes software developed by the University of
  21          Technology, Faculty of Information Technology, Brno and its
  22          contributors.
  23  
  24     4. Neither the name of the Company nor the names of its contributors
  25        may be used to endorse or promote products derived from this
  26        software without specific prior written permission.
  27  
  28     This software or firmware is provided ``as is'', and any express or implied
  29     warranties, including, but not limited to, the implied warranties of
  30     merchantability and fitness for a particular purpose are disclaimed.
  31     In no event shall the company or contributors be liable for any
  32     direct, indirect, incidental, special, exemplary, or consequential
  33     damages (including, but not limited to, procurement of substitute
  34     goods or services; loss of use, data, or profits; or business
  35     interruption) however caused and on any theory of liability, whether
  36     in contract, strict liability, or tort (including negligence or
  37     otherwise) arising in any way out of the use of this software, even
  38     if advised of the possibility of such damage.
  39  
  40     $Id$
  41  
  42  
  43  *******************************************************************************/
  44  
  45  #include <fitkitlib.h>
  46  
  47  unsigned int iter; //globalni promenna
  48  
  49  /*******************************************************************************
  50   * Vypis uzivatelske napovedy (funkce se vola pri vykonavani prikazu "help")
  51  *******************************************************************************/
  52  void print_user_help(void)
  53  {
  54  
  55     term_send_str("  LED counter:"); //Vypis retezce na terminal
  56     term_send_num(iter);             //Vypis poctu iteraci
  57     term_send_crlf();                //Prechod na novy radek
  58  }
  59  
  60  /*******************************************************************************
  61   * Dekodovani uzivatelskych prikazu a jejich vykonavani
  62  *******************************************************************************/
  63  unsigned char decode_user_cmd(char *cmd_ucase, char *cmd)
  64  {
  65     return (CMD_UNKNOWN);
  66  }
  67  
  68  /*******************************************************************************
  69   * Inicializace periferii/komponent po naprogramovani FPGA
  70  *******************************************************************************/
  71  void fpga_initialized() {}
  72  
  73  /*******************************************************************************
  74   * Hlavni funkce
  75  *******************************************************************************/
  76  int main(void)
  77  {
  78     short counter = 0;
  79     iter = 0;
  80  
  81     initialize_hardware();
  82  
  83     set_led_d6(1);  //rozsvitit LED D6
  84     set_led_d5(1);  //rozsvitit LED D5
  85  
  86     while (1)
  87     {
  88  
  89        delay_ms(1);  //zpozdeni 1ms
  90  
  91        counter++;
  92        if (counter == 500)
  93        {
  94           flip_led_d6(); //invertovat LED
  95  
  96           iter++;
  97           counter = 0;
  98        }
  99  
 100        terminal_idle();  // obsluha terminalu
 101     }
 102  
 103  }
 104  
 105  
Zobrazeno: 595836x Naposledy: 22.1.2022 09:25:47