Subversion Repositories HomeAutomation

Rev

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

  1. /**
  2.  * @defgroup mt8870 Mitel DTMF-receiver Library
  3.  * @code #include <drivers/DTMF/mt8870/mt8870.h> @endcode
  4.  *
  5.  * @brief Driver for MT8870 DTMF receiver
  6.  *
  7.  * Driver handle complete CallerID. Init and call start.
  8.  * When the poll function return MT8870_Ret_Finished
  9.  * data can be found in buffer set with the start function.
  10.  * The length pointer supplied with function Poll is used to
  11.  * find out the length of data.
  12.  *
  13.  * @author  Anders Runeson
  14.  * @date    2007-08-24
  15.  */
  16.  
  17. /**@{*/
  18.  
  19. #ifndef MT8870_H_
  20. #define MT8870_H_
  21.  
  22. /*-----------------------------------------------------------------------------
  23.  * Defines
  24.  *---------------------------------------------------------------------------*/
  25.  
  26. /* Should be defined in user config.inc */
  27. #if 0
  28. /*
  29.  * Signals connected from MT8870 is
  30.  * StD, Q1, Q2, Q3 och Q4
  31.  */
  32. #define MT_StD_PIN      PIND
  33. #define MT_StD_DDR      DDRD
  34. #define MT_StD_BIT      PD2
  35.  
  36. #define MT_Q1_PIN       PINC
  37. #define MT_Q1_DDR       DDRC
  38. #define MT_Q1_BIT       PC0
  39.  
  40. #define MT_Q2_PIN       PINC
  41. #define MT_Q2_DDR       DDRC
  42. #define MT_Q2_BIT       PC1
  43.  
  44. #define MT_Q3_PIN       PINC
  45. #define MT_Q3_DDR       DDRC
  46. #define MT_Q3_BIT       PC2
  47.  
  48. #define MT_Q4_PIN       PINC
  49. #define MT_Q4_DDR       DDRC
  50. #define MT_Q4_BIT       PC3
  51.  
  52. /* Time to elapse to know when number sequence is over */
  53. #define DIAL_TIMEOUT    1800
  54.  
  55. /* Maximum number of tones to store for the number */
  56. #define MAX_TONES       16
  57.  
  58. #endif
  59.  
  60. /**
  61.  * @brief Return values.
  62.  */
  63. typedef enum {
  64.     MT8870_Ret_Not_Finished,    /**< No complete number yet. */
  65.     MT8870_Ret_Finished,        /**< Data is available. */
  66.     MT8870_Ret_Overflow,        /**< Buffer was overflown. */
  67. } MT8870_Ret_t;
  68.  
  69. /*-----------------------------------------------------------------------------
  70.  * Public Function Prototypes
  71.  *---------------------------------------------------------------------------*/
  72. /**
  73.  * @brief Initialize MT8870 CallerID receiver
  74.  */
  75. void DTMFin_Init(void);
  76.  
  77. /**
  78.  * @brief Poll driver for status
  79.  *
  80.  * Function returns MT8870_Ret_Finished if a complete
  81.  * number is stored in buffer supplied with the Start
  82.  * function.
  83.  */
  84. MT8870_Ret_t DTMFin_Poll(uint8_t *len);
  85.  
  86. /**
  87.  * @brief Start the CallerID  
  88.  */
  89. void DTMFin_Start(uint8_t *buffer);
  90.  
  91. /*-----------------------------------------------------------------------------
  92.  * Private Function Prototypes
  93.  *---------------------------------------------------------------------------*/
  94. void DTMFin_timer_callback(uint8_t timer);
  95.  
  96. /**@}*/
  97. #endif /*MT8870_H_*/
  98.