audioamp9  2.1.0.0
audioamp9.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 AUDIOAMP9_H
29 #define AUDIOAMP9_H
30 
31 #ifdef __cplusplus
32 extern "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 #include "drv_digital_in.h"
51 
62 #define AUDIOAMP9_GAIN_LEVEL1 0x01
63 #define AUDIOAMP9_GAIN_LEVEL2 0x02
64 #define AUDIOAMP9_GAIN_LEVEL3 0x03
65 #define AUDIOAMP9_GAIN_LEVEL4 0x04
66  // audioamp9_set
68 
83 #define AUDIOAMP9_MAP_MIKROBUS( cfg, mikrobus ) \
84  cfg.mut = MIKROBUS( mikrobus, MIKROBUS_AN ); \
85  cfg.shd = MIKROBUS( mikrobus, MIKROBUS_RST ); \
86  cfg.g0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
87  cfg.g1 = MIKROBUS( mikrobus, MIKROBUS_INT )
88  // audioamp9_map // audioamp9
91 
96 typedef struct
97 {
98  digital_out_t mut;
99  digital_out_t shd;
100  digital_out_t g0;
101  digital_out_t g1;
103 } audioamp9_t;
104 
109 typedef struct
110 {
111  pin_name_t mut;
112  pin_name_t shd;
113  pin_name_t g0;
114  pin_name_t g1;
117 
122 typedef enum
123 {
125  AUDIOAMP9_ERROR = -1
126 
128 
145 
160 
172 
183 
194 
205 
216 
227 
238 
249 
260 
273 err_t audioamp9_set_gain_level ( audioamp9_t *ctx, uint8_t gain_level );
274 
275 #ifdef __cplusplus
276 }
277 #endif
278 #endif // AUDIOAMP9_H
279  // audioamp9
281 
282 // ------------------------------------------------------------------------ END
audioamp9_shutdown_on
void audioamp9_shutdown_on(audioamp9_t *ctx)
AudioAmp 9 shutdown on function.
audioamp9_set_gain_level
err_t audioamp9_set_gain_level(audioamp9_t *ctx, uint8_t gain_level)
AudioAmp 9 set gain function.
audioamp9_shutdown_off
void audioamp9_shutdown_off(audioamp9_t *ctx)
AudioAmp 9 shutdown off function.
audioamp9_default_cfg
void audioamp9_default_cfg(audioamp9_t *ctx)
AudioAmp 9 default configuration function.
audioamp9_mute_off
void audioamp9_mute_off(audioamp9_t *ctx)
AudioAmp 9 mute off function.
audioamp9_t::shd
digital_out_t shd
Definition: audioamp9.h:99
audioamp9_set_gain2
void audioamp9_set_gain2(audioamp9_t *ctx)
AudioAmp 9 set gain level 2 function.
audioamp9_t::g0
digital_out_t g0
Definition: audioamp9.h:100
AUDIOAMP9_ERROR
@ AUDIOAMP9_ERROR
Definition: audioamp9.h:125
audioamp9_init
err_t audioamp9_init(audioamp9_t *ctx, audioamp9_cfg_t *cfg)
AudioAmp 9 initialization function.
audioamp9_set_gain4
void audioamp9_set_gain4(audioamp9_t *ctx)
AudioAmp 9 set gain level 4 function.
audioamp9_cfg_t
AudioAmp 9 Click configuration object.
Definition: audioamp9.h:110
audioamp9_set_gain3
void audioamp9_set_gain3(audioamp9_t *ctx)
AudioAmp 9 set gain level 3 function.
audioamp9_cfg_t::g1
pin_name_t g1
Definition: audioamp9.h:114
audioamp9_t::g1
digital_out_t g1
Definition: audioamp9.h:101
audioamp9_cfg_t::g0
pin_name_t g0
Definition: audioamp9.h:113
audioamp9_t
AudioAmp 9 Click context object.
Definition: audioamp9.h:97
AUDIOAMP9_OK
@ AUDIOAMP9_OK
Definition: audioamp9.h:124
audioamp9_return_value_t
audioamp9_return_value_t
AudioAmp 9 Click return value data.
Definition: audioamp9.h:123
audioamp9_mute_on
void audioamp9_mute_on(audioamp9_t *ctx)
AudioAmp 9 mute on function.
audioamp9_cfg_t::mut
pin_name_t mut
Definition: audioamp9.h:111
audioamp9_set_gain1
void audioamp9_set_gain1(audioamp9_t *ctx)
AudioAmp 9 set gain level 1 function.
audioamp9_cfg_t::shd
pin_name_t shd
Definition: audioamp9.h:112
audioamp9_t::mut
digital_out_t mut
Definition: audioamp9.h:98
audioamp9_cfg_setup
void audioamp9_cfg_setup(audioamp9_cfg_t *cfg)
AudioAmp 9 configuration object setup function.