Subversion Repositories HomeAutomation

Rev

Rev 925 | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. #ifndef DTMFDECODE_H_
  2. #define DTMFDECODE_H_
  3.  
  4. /*-----------------------------------------------------------------------------
  5.  * Includes
  6.  *---------------------------------------------------------------------------*/
  7. #include <avr/pgmspace.h>
  8. #include <math.h>
  9. #include <inttypes.h>
  10. #include <avr/interrupt.h>
  11. #include <avr/io.h>
  12.  
  13. /*-----------------------------------------------------------------------------
  14.  * Defines
  15.  *---------------------------------------------------------------------------*/
  16. #define SAMPLING_RATE       8000
  17. #define MAX_BINS            8           //nr of frequencies to calculate
  18. #define GOERTZEL_N          92          //nr of samples to collect
  19.  
  20. #define COEFFSPREC          1024        //precision for fixed-point values in coefficients
  21. #define COEFFSPRECSHIFT     10
  22. #define SAMPLEPREC          512         //precision for fixed-point values in calculations with samples
  23. #define SAMPLEPRECSHIFT     9
  24.  
  25. #define UPPERSILENCELIMIT   132         //limits for when a dc-signal is treated like silence
  26. #define LOWERSILENCELIMIT   122
  27.  
  28. #define BUFFER_SIZE         GOERTZEL_N
  29.  
  30. #define TONE_BUFFER_SIZE    8
  31.  
  32. #define RSPAUSE             0
  33. #define RSRECEIVING         1
  34.  
  35. #define CLK_PER_SAMPLE      (F_CPU/SAMPLING_RATE)
  36. #define CLK_RELOAD          (uint16_t)(0xffff-CLK_PER_SAMPLE+1)
  37. //#define CLK_RELOAD            (uint16_t)(0xffff-35000+1)
  38.  
  39. /*-----------------------------------------------------------------------------
  40.  * Public Function Prototypes
  41.  *---------------------------------------------------------------------------*/
  42. uint8_t DTMFIN_Init(void);
  43. uint8_t DTMFIN_GetData(uint8_t* returntone);
  44.  
  45. #endif /*DTMFDECODE_H_*/
  46.