Subversion Repositories HomeAutomation

Rev

Rev 869 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 869 Rev 884
Line 2... Line 2...
2
 * @defgroup mt8870 Mitel MT8870 DTMF-receiver Library
2
 * @defgroup mt8870 Mitel MT8870 DTMF-receiver Library
3
 * @code #include <drivers/DTMF/mt8870/mt8870.h> @endcode
3
 * @code #include <drivers/DTMF/mt8870/mt8870.h> @endcode
4
 *
4
 *
5
 * @brief Driver for MT8870 DTMF receiver
5
 * @brief Driver for MT8870 DTMF receiver
6
 *
6
 *
7
 * Driver handle complete CallerID. Init and call start.
7
 * Driver handle only reception of dtmf codes.
8
 * When the poll function return MT8870_Ret_Finished
8
 * When the pop function return DTMF_Ret_Data_avail
9
 * data can be found in buffer set with the start function.
9
 * data can be found in the buffer.
10
 * The length pointer supplied with function Poll is used to
10
 * The length pointer supplied with function Pop is used to
11
 * find out the length of data.
11
 * find out the length of data.
12
 *
12
 *
13
 * @author  Anders Runeson
13
 * @author  Anders Runeson
14
 * @date    2007-08-24
14
 * @date    2007-08-24
15
 */
15
 */
Line 17... Line 17...
17
/**@{*/
17
/**@{*/
18
 
18
 
19
#ifndef MT8870_H_
19
#ifndef MT8870_H_
20
#define MT8870_H_
20
#define MT8870_H_
21
 
21
 
-
 
22
#include <drivers/DTMF/dtmf.h>
22
/*-----------------------------------------------------------------------------
23
/*-----------------------------------------------------------------------------
23
 * Defines
24
 * Defines
24
 *---------------------------------------------------------------------------*/
25
 *---------------------------------------------------------------------------*/
25
 
26
 
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
 
27
 
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
 
28
 
69
/*-----------------------------------------------------------------------------
29
/*-----------------------------------------------------------------------------
70
 * Public Function Prototypes
30
 * Public Function Prototypes
71
 *---------------------------------------------------------------------------*/
31
 *---------------------------------------------------------------------------*/
72
/**
32
/**
73
 * @brief Initialize MT8870 CallerID receiver
33
 * @brief Initialize MT8870 CallerID receiver
74
 */
34
 */
75
void DTMFin_Init(void);
35
void mt8870_Init(void);
76
 
36
 
77
/**
37
/**
78
 * @brief Poll driver for status
38
 * @brief Poll driver for status
79
 *
39
 *
80
 * Function returns MT8870_Ret_Finished if a complete
40
 * Function returns MT8870_Ret_Finished if a complete
81
 * number is stored in buffer supplied with the Start
41
 * number is stored in buffer supplied with the Start
82
 * function.
42
 * function.
83
 */
43
 */
84
MT8870_Ret_t DTMFin_Poll(uint8_t *len);
44
DTMF_Ret_t mt8870_Pop(uint8_t *buffer, 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
 
45
 
96
/**@}*/
46
/**@}*/
97
#endif /*MT8870_H_*/
47
#endif /*MT8870_H_*/