dsp 2.0.0.0
dsp.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 DSP_H
29#define DSP_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50
66#define DSP_SET_EFFECT_MEDIUM 0x00
67#define DSP_SET_EFFECT_CHAMBR7B 0x01
68#define DSP_SET_EFFECT_ROOM3B 0x02
69#define DSP_SET_EFFECT_CHAMBER2 0x03
70#define DSP_SET_EFFECT_REVERS3B 0x04
71#define DSP_SET_EFFECT_GATED4B 0x05
72#define DSP_SET_EFFECT_ROOM2A 0x06
73#define DSP_SET_EFFECT_SPRING3B 0x07
74#define DSP_SET_EFFECT_PHASER1 0x08
75#define DSP_SET_EFFECT_FLANGER2 0x09
76#define DSP_SET_EFFECT_DELAY7 0x0A
77#define DSP_SET_EFFECT_CHORUS4 0x0B
78#define DSP_SET_EFFECT_EARLREF4 0x0C
79#define DSP_SET_EFFECT_AMB4 0x0D
80#define DSP_SET_EFFECT_DELAY3 0x0E
81#define DSP_SET_EFFECT_DELAY1 0x0F
82
83 // effects
84
94#define DSP_SET_PIN_STATE_LOW 0x00
95#define DSP_SET_PIN_STATE_HIGH 0x01
96
97 // pin_state
98
108#define dsp_retval_t uint8_t
109
110#define DSP_OK 0x00
111#define DSP_ERROR 0xFF
112
113 // dsp_retval_t
114
115
130#define DSP_MAP_MIKROBUS( cfg, mikrobus ) \
131 cfg.p0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
132 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
133 cfg.p1 = MIKROBUS( mikrobus, MIKROBUS_CS ); \
134 cfg.p3 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
135 cfg.p2 = MIKROBUS( mikrobus, MIKROBUS_INT )
136
137 // dsp_map
138 // dsp
139
144typedef struct
145{
146 digital_out_t p0;
147 digital_out_t rst;
148 digital_out_t p1;
149 digital_out_t p3;
150 digital_out_t p2;
152} dsp_t;
153
158typedef struct
159{
160 pin_name_t p0;
161 pin_name_t rst;
162 pin_name_t p1;
163 pin_name_t p3;
164 pin_name_t p2;
166} dsp_cfg_t;
167
184
199err_t dsp_init ( dsp_t *ctx, dsp_cfg_t *cfg );
200
211void dsp_default_cfg ( dsp_t *ctx );
212
225void dsp_pin_set_p0 ( dsp_t *ctx, uint8_t pin_state );
226
239void dsp_pin_set_p1 ( dsp_t *ctx, uint8_t pin_state );
240
253void dsp_pin_set_p2 ( dsp_t *ctx, uint8_t pin_state );
254
267void dsp_pin_set_p3 ( dsp_t *ctx, uint8_t pin_state );
268
278void dsp_power_on ( dsp_t *ctx );
279
289void dsp_reset ( dsp_t *ctx );
290
318dsp_retval_t dsp_set_effect ( dsp_t *ctx, uint8_t effects );
319
320#ifdef __cplusplus
321}
322#endif
323#endif // DSP_H
324
325 // dsp
326
327// ------------------------------------------------------------------------ END
#define dsp_retval_t
DSP error code settings.
Definition dsp.h:108
err_t dsp_init(dsp_t *ctx, dsp_cfg_t *cfg)
DSP initialization function.
void dsp_power_on(dsp_t *ctx)
DSP power on the device function.
void dsp_pin_set_p0(dsp_t *ctx, uint8_t pin_state)
DSP P0 pin setting function.
void dsp_reset(dsp_t *ctx)
DSP reset the device function.
void dsp_pin_set_p3(dsp_t *ctx, uint8_t pin_state)
DSP P3 pin setting function.
dsp_retval_t dsp_set_effect(dsp_t *ctx, uint8_t effects)
DSP reverb and multi-effects setting function.
void dsp_cfg_setup(dsp_cfg_t *cfg)
DSP configuration object setup function.
void dsp_pin_set_p2(dsp_t *ctx, uint8_t pin_state)
DSP P2 pin setting function.
void dsp_default_cfg(dsp_t *ctx)
DSP default configuration function.
void dsp_pin_set_p1(dsp_t *ctx, uint8_t pin_state)
DSP P1 pin setting function.
DSP Click configuration object.
Definition dsp.h:159
pin_name_t p3
Definition dsp.h:163
pin_name_t p1
Definition dsp.h:162
pin_name_t p0
Definition dsp.h:160
pin_name_t p2
Definition dsp.h:164
pin_name_t rst
Definition dsp.h:161
DSP Click context object.
Definition dsp.h:145
digital_out_t p1
Definition dsp.h:148
digital_out_t p0
Definition dsp.h:146
digital_out_t p2
Definition dsp.h:150
digital_out_t rst
Definition dsp.h:147
digital_out_t p3
Definition dsp.h:149