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 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
48 #define AUDIOAMP9_GAIN_LEVEL1 0x01
49 #define AUDIOAMP9_GAIN_LEVEL2 0x02
50 #define AUDIOAMP9_GAIN_LEVEL3 0x03
51 #define AUDIOAMP9_GAIN_LEVEL4 0x04
52  // audioamp9_set
54 
69 #define AUDIOAMP9_MAP_MIKROBUS( cfg, mikrobus ) \
70  cfg.mut = MIKROBUS( mikrobus, MIKROBUS_AN ); \
71  cfg.shd = MIKROBUS( mikrobus, MIKROBUS_RST ); \
72  cfg.g0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
73  cfg.g1 = MIKROBUS( mikrobus, MIKROBUS_INT )
74  // audioamp9_map // audioamp9
77 
82 typedef struct
83 {
84  digital_out_t mut;
85  digital_out_t shd;
86  digital_out_t g0;
87  digital_out_t g1;
89 } audioamp9_t;
90 
95 typedef struct
96 {
97  pin_name_t mut;
98  pin_name_t shd;
99  pin_name_t g0;
100  pin_name_t g1;
103 
108 typedef enum
109 {
111  AUDIOAMP9_ERROR = -1
112 
114 
131 
146 
158 
169 
180 
191 
202 
213 
224 
235 
246 
259 err_t audioamp9_set_gain_level ( audioamp9_t *ctx, uint8_t gain_level );
260 
261 #ifdef __cplusplus
262 }
263 #endif
264 #endif // AUDIOAMP9_H
265  // audioamp9
267 
268 // ------------------------------------------------------------------------ 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:85
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:86
AUDIOAMP9_ERROR
@ AUDIOAMP9_ERROR
Definition: audioamp9.h:111
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:96
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:100
audioamp9_t::g1
digital_out_t g1
Definition: audioamp9.h:87
audioamp9_cfg_t::g0
pin_name_t g0
Definition: audioamp9.h:99
audioamp9_t
AudioAmp 9 Click context object.
Definition: audioamp9.h:83
AUDIOAMP9_OK
@ AUDIOAMP9_OK
Definition: audioamp9.h:110
audioamp9_return_value_t
audioamp9_return_value_t
AudioAmp 9 Click return value data.
Definition: audioamp9.h:109
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:97
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:98
audioamp9_t::mut
digital_out_t mut
Definition: audioamp9.h:84
audioamp9_cfg_setup
void audioamp9_cfg_setup(audioamp9_cfg_t *cfg)
AudioAmp 9 configuration object setup function.