dtmfgenerator  2.0.0.0
dtmfgenerator.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef DTMFGENERATOR_H
29 #define DTMFGENERATOR_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
57 #define DTMFGENERATOR_OUT_TONE_0 0x00
58 #define DTMFGENERATOR_OUT_TONE_1 0x01
59 #define DTMFGENERATOR_OUT_TONE_2 0x02
60 #define DTMFGENERATOR_OUT_TONE_3 0x03
61 #define DTMFGENERATOR_OUT_TONE_4 0x04
62 #define DTMFGENERATOR_OUT_TONE_5 0x05
63 #define DTMFGENERATOR_OUT_TONE_6 0x06
64 #define DTMFGENERATOR_OUT_TONE_7 0x07
65 #define DTMFGENERATOR_OUT_TONE_8 0x08
66 #define DTMFGENERATOR_OUT_TONE_9 0x09
67 #define DTMFGENERATOR_OUT_TONE_A 0x0A
68 #define DTMFGENERATOR_OUT_TONE_B 0x0B
69 #define DTMFGENERATOR_OUT_TONE_C 0x0C
70 #define DTMFGENERATOR_OUT_TONE_D 0x0D
71 #define DTMFGENERATOR_OUT_TONE_ASTERISK 0x0E
72 #define DTMFGENERATOR_OUT_TONE_HASH 0x0F
73 #define DTMFGENERATOR_OUT_TONE_STOP 0x10
74 
75 #define DTMFGENERATOR_GPIO_PIN_STATE_LOW 0x00
76 #define DTMFGENERATOR_GPIO_PIN_STATE_HIGH 0x01
77  // dtmfgenerator_set
78 
93 #define DTMFGENERATOR_MAP_MIKROBUS( cfg, mikrobus ) \
94  cfg.dat = MIKROBUS( mikrobus, MIKROBUS_RST ); \
95  cfg.ce = MIKROBUS( mikrobus, MIKROBUS_CS ); \
96  cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM )
97  // dtmfgenerator_map // dtmfgenerator
100 
105 typedef struct
106 {
107  digital_out_t dat;
108  digital_out_t ce;
109  digital_out_t clk;
112 
117 typedef struct
118 {
119  pin_name_t dat;
120  pin_name_t ce;
121  pin_name_t clk;
124 
129 typedef enum
130 {
133 
135 
152 
168 
177 void dtmfgenerator_set_dat ( dtmfgenerator_t *ctx, uint8_t pin_state );
178 
187 void dtmfgenerator_set_ce ( dtmfgenerator_t *ctx, uint8_t pin_state );
188 
197 void dtmfgenerator_set_clk ( dtmfgenerator_t *ctx, uint8_t pin_state );
198 
207 
218 void dtmfgenerator_transmit_out_tone ( dtmfgenerator_t *ctx, uint8_t out_tone, uint16_t delay_m_s );
219 
220 #ifdef __cplusplus
221 }
222 #endif
223 #endif // DTMFGENERATOR_H
224  // dtmfgenerator
226 
227 // ------------------------------------------------------------------------ END
dtmfgenerator_cfg_t
DTMF Generator Click configuration object.
Definition: dtmfgenerator.h:116
dtmfgenerator_set_dat
void dtmfgenerator_set_dat(dtmfgenerator_t *ctx, uint8_t pin_state)
Set DATA ( RST ) pin state function.
dtmfgenerator_t
DTMF Generator Click context object.
Definition: dtmfgenerator.h:104
DTMFGENERATOR_ERROR
Definition: dtmfgenerator.h:131
dtmfgenerator_set_clk
void dtmfgenerator_set_clk(dtmfgenerator_t *ctx, uint8_t pin_state)
Set CLK ( PWM ) pin state function.
dtmfgenerator_transmit_out_tone
void dtmfgenerator_transmit_out_tone(dtmfgenerator_t *ctx, uint8_t out_tone, uint16_t delay_m_s)
Transmit output tone function.
dtmfgenerator_set_ce
void dtmfgenerator_set_ce(dtmfgenerator_t *ctx, uint8_t pin_state)
Set CE ( CS ) pin state function.
dtmfgenerator_init
err_t dtmfgenerator_init(dtmfgenerator_t *ctx, dtmfgenerator_cfg_t *cfg)
DTMF Generator initialization function.
dtmfgenerator_power_on
void dtmfgenerator_power_on(dtmfgenerator_t *ctx)
Power ON function.
dtmfgenerator_cfg_setup
void dtmfgenerator_cfg_setup(dtmfgenerator_cfg_t *cfg)
DTMF Generator configuration object setup function.
dtmfgenerator_return_value_t
dtmfgenerator_return_value_t
DTMF Generator Click return value data.
Definition: dtmfgenerator.h:128
DTMFGENERATOR_OK
Definition: dtmfgenerator.h:130