dtmfdecoder 2.0.0.0
dtmfdecoder.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 DTMFDECODER_H
29#define DTMFDECODER_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
35#include "drv_digital_out.h"
36#include "drv_digital_in.h"
37#include "drv_i2c_master.h"
38
55#define DTMFDECODER_CMD_BYTE_INPUT 0x00
56#define DTMFDECODER_CMD_BYTE_OUTPUT 0x01
57#define DTMFDECODER_CMD_BYTE_POL_INV 0x02
58#define DTMFDECODER_CMD_BYTE_CONFIG 0x03
59 // dtmfdecoder_cmd
61
77#define DTMFDECODER_SET_DEV_ADDR 0x41
78 // dtmfdecoder_set
80
95#define DTMFDECODER_MAP_MIKROBUS( cfg, mikrobus ) \
96 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
97 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
98 cfg.pwd = MIKROBUS( mikrobus, MIKROBUS_CS ); \
99 cfg.inh = MIKROBUS( mikrobus, MIKROBUS_RST ); \
100 cfg.std = MIKROBUS( mikrobus, MIKROBUS_INT )
101 // dtmfdecoder_map // dtmfdecoder
104
109typedef struct
110{
111 // Output pins
112
113 digital_out_t pwd;
114 digital_out_t inh;
116 // Input pins
117
118 digital_in_t std;
120 // Modules
121
122 i2c_master_t i2c;
124 // I2C slave address
125
129
134typedef struct
135{
136 pin_name_t scl;
137 pin_name_t sda;
139 pin_name_t pwd;
140 pin_name_t inh;
141 pin_name_t std;
143 uint32_t i2c_speed;
144 uint8_t i2c_address;
147
152typedef enum
153{
156
158
177
195
209
227err_t dtmfdecoder_generic_write ( dtmfdecoder_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len );
228
246err_t dtmfdecoder_generic_read ( dtmfdecoder_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len );
247
259
271
283
295
308
322
323#ifdef __cplusplus
324}
325#endif
326#endif // DTMFDECODER_H
327 // dtmfdecoder
329
330// ------------------------------------------------------------------------ END
dtmfdecoder_return_value_t
DTMF Decoder Click return value data.
Definition: dtmfdecoder.h:153
@ DTMFDECODER_OK
Definition: dtmfdecoder.h:154
@ DTMFDECODER_ERROR
Definition: dtmfdecoder.h:155
void dtmfdecoder_inhibit_on(dtmfdecoder_t *ctx)
DTMF Decoder inhibit on function.
uint8_t dtmfdecoder_tone_read(dtmfdecoder_t *ctx)
DTMF Decoder read tone function.
err_t dtmfdecoder_init(dtmfdecoder_t *ctx, dtmfdecoder_cfg_t *cfg)
DTMF Decoder initialization function.
void dtmfdecoder_inhibit_off(dtmfdecoder_t *ctx)
DTMF Decoder inhibit off function.
err_t dtmfdecoder_generic_read(dtmfdecoder_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
DTMF Decoder I2C reading function.
void dtmfdecoder_powerdown_off(dtmfdecoder_t *ctx)
DTMF Decoder power down off function.
void dtmfdecoder_cfg_setup(dtmfdecoder_cfg_t *cfg)
DTMF Decoder configuration object setup function.
void dtmfdecoder_powerdown_on(dtmfdecoder_t *ctx)
DTMF Decoder power down on function.
err_t dtmfdecoder_generic_write(dtmfdecoder_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
DTMF Decoder I2C writing function.
uint8_t dtmfdecoder_delayed_steering_check(dtmfdecoder_t *ctx)
DTMF Decoder check delayed steering function.
void dtmfdecoder_default_cfg(dtmfdecoder_t *ctx)
DTMF Decoder default configuration function.
DTMF Decoder Click configuration object.
Definition: dtmfdecoder.h:135
pin_name_t inh
Definition: dtmfdecoder.h:140
pin_name_t std
Definition: dtmfdecoder.h:141
uint32_t i2c_speed
Definition: dtmfdecoder.h:143
pin_name_t pwd
Definition: dtmfdecoder.h:139
pin_name_t scl
Definition: dtmfdecoder.h:136
pin_name_t sda
Definition: dtmfdecoder.h:137
uint8_t i2c_address
Definition: dtmfdecoder.h:144
DTMF Decoder Click context object.
Definition: dtmfdecoder.h:110
digital_out_t pwd
Definition: dtmfdecoder.h:113
digital_out_t inh
Definition: dtmfdecoder.h:114
i2c_master_t i2c
Definition: dtmfdecoder.h:122
uint8_t slave_address
Definition: dtmfdecoder.h:126
digital_in_t std
Definition: dtmfdecoder.h:118