C51 COMPILER V9.52.0.0   ESC_BEEP                                                          08/21/2018 12:02:28 PAGE 1   


C51 COMPILER V9.52.0.0, COMPILATION OF MODULE ESC_BEEP
OBJECT MODULE PLACED IN .\obj\ESC_Beep.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE User\Source\ESC_Beep.c LARGE OMF2 WARNINGLEVEL(0) OPTIMIZE(SIZE) BROWSE NOA
                    -REGS INCDIR(.\Library\Include;.\User\Include) DEBUG PRINT(.\obj\ESC_Beep.lst) TABS(2) OBJECT(.\obj\ESC_Beep.obj)

line level    source

   1          
   2          /************************ (C) COPYRIGHT 2015 FT *******************************
   3          * File Name          : 
   4          * Author             : Application Team  Tom.wang 
   5          * Version            : V2.0.0
   6          * Date               : 06/15/2015
   7          * Description        : 
   8          ********************************************************************************
   9          /*******************************************************************************
  10          * All Rights Reserved
  11          *******************************************************************************/
  12          
  13          /* Includes ------------------------------------------------------------------*/
  14          #include <FU6812_MCU.h>
  15          #include <sys_conf.h>
  16          #include <ESC_PPM.h>
  17          #include <ESC_Beep.h>
  18          /* Private typedef -----------------------------------------------------------*/
  19          /* Private define ------------------------------------------------------------*/
  20          /* Private macro -------------------------------------------------------------*/
  21          /* Private variables ---------------------------------------------------------*/
  22          uc8 BeepNote[7] = {229,204,182,171,153,136,121}; //
  23          Beep_TypeDef xdata Beep;
  24          /* Private function prototypes -----------------------------------------------*/
  25          extern void gDelayus(u16 timer);
  26          extern void gDelayms(u16 timer);
  27          
  28          void BeepRequestFun(u8 mold);
  29          void Beepperform(void);
  30          void BeepResponse(void);
  31          /* Private functions ---------------------------------------------------------*/
  32          
  33          void BeepTone(u8 tBeepNote,u8 tPhase,float tvolume,u16 time)
  34          {
  35   1        #if(BEEPSCAN_EN)  
                u16 i;
                EA = 0;
              
                tBeepNote = BeepNote[tBeepNote]*tvolume*BEEP_VOL;
                for(i=0; i< time;i++)
                {
                  //if(tPhase == 1)
                  {
                    DRV_CMR = PWM_UHVL_ON;
                    gDelayus(tBeepNote);
                    DRV_CMR = PWMOUT_OFF;
                    gDelayus(tBeepNote*3);
                    DRV_CMR = PWM_VHUL_ON;
                    gDelayus(tBeepNote);
                    DRV_CMR = PWMOUT_OFF;
                    gDelayus(tBeepNote*3);
                  }
              //    if(tPhase == 2)
              //    {
C51 COMPILER V9.52.0.0   ESC_BEEP                                                          08/21/2018 12:02:28 PAGE 2   

              //      PWM_VHWL_ON;
              //      gDelayus(tBeepNote);
              //      PWMOUT_OFF;
              //      gDelayus(tBeepNote*3);
              //      PWM_WHVL_ON;
              //      gDelayus(tBeepNote);
              //      PWMOUT_OFF;
              //      gDelayus(tBeepNote*3);    
              //    } 
              //    if(tPhase == 3)
              //    {
              //      PWM_UHWL_ON;
              //      gDelayus(tBeepNote);
              //      PWMOUT_OFF;
              //      gDelayus(tBeepNote*3);
              //      PWM_WHUL_ON;
              //      gDelayus(tBeepNote);
              //      PWMOUT_OFF;
              //      gDelayus(tBeepNote*3);    
              //    }
                }
                EA = 1;
                #endif
  78   1      }
  79          
  80          void Beepperform(void)
  81          {
  82   1        #if(BEEPSCAN_EN)    
                u8 i;
              
                for(i=1; i<= 3;i++)
                {
                  BeepTone(i,1,0.4,500);
                  EA = 0;
                  gDelayms(30);
                  EA = 1;
                }
              
                EA = 0;
                gDelayms(320);
                EA = 1;
                Beep.BeepType = BeepDone;
                #endif
  98   1      }
  99          
 100          void BeepResponse(void)
 101          {
 102   1        #if(BEEPSCAN_EN)
                if(Beep.BeepRequest == 0x7F)
                {
                  switch(Beep.BeepType)
                  {
                    case PWMINinit:
                      Beepperform();
                      Beep.BeepRequest = 0xFF;
                      break;       
                    case PWMINAline:
                      BeepTone(1,1,0.3,1000);
                      EA = 0;
                      gDelayms(80);
                      EA = 1;
                      BeepTone(1,1,0.3,1000);
C51 COMPILER V9.52.0.0   ESC_BEEP                                                          08/21/2018 12:02:28 PAGE 3   

                      PWMINCtl.FlagPWMAline = 0xFF;
                      Beep.BeepRequest = 0xFF;
                    break;
                    case PWMINReady:
                      BeepTone(1,1,0.3,1500);
                      Beep.BeepRequest = 0xFF;
                      PWMINCtl.FlagPwmIn = 0xFF;
                    break;
                    case PWMINError:
                      BeepTone(1,1,0.2,1000);
                      EA = 0;
                      gDelayms(40);
                      EA = 1;      
                      BeepTone(1,1,0.2,1000);
                      EA = 0;
                      gDelayms(328);
                      EA = 1;
                    break;
                    case BeepDone:
                      Beep.BeepRequest = 0xFF;
                      break;      
                    default:
                      Beep.BeepRequest = 0xFF;
                      break;
                  }
                }
                Beep.BeepRequest = 0xFF;
                #endif
 145   1      }
 146          
 147          
 148          void BeepRequestFun(u8 mold)
 149          { 
 150   1        #if(BEEPSCAN_EN)  
                if(Beep.BeepRequest == 0xFF)
                {
                  Beep.BeepRequest = 0x7F;
                  Beep.BeepType = mold;
                  if(Beep.BeepType == PWMINAline)
                  {
                    PWMINCtl.FlagPWMAline = 0x7F;
                  }
                }
                #endif
 161   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     17    ----
   CONSTANT SIZE    =      7    ----
   XDATA SIZE       =      2       9
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
