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 "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 
58 #define AUDIOAMP9_GAIN_LEVEL1 0x01
59 #define AUDIOAMP9_GAIN_LEVEL2 0x02
60 #define AUDIOAMP9_GAIN_LEVEL3 0x03
61 #define AUDIOAMP9_GAIN_LEVEL4 0x04
62  // audioamp9_set
64 
79 #define AUDIOAMP9_MAP_MIKROBUS( cfg, mikrobus ) \
80  cfg.mut = MIKROBUS( mikrobus, MIKROBUS_AN ); \
81  cfg.shd = MIKROBUS( mikrobus, MIKROBUS_RST ); \
82  cfg.g0 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
83  cfg.g1 = MIKROBUS( mikrobus, MIKROBUS_INT )
84  // audioamp9_map // audioamp9
87 
92 typedef struct
93 {
94  digital_out_t mut;
95  digital_out_t shd;
96  digital_out_t g0;
97  digital_out_t g1;
99 } audioamp9_t;
100 
105 typedef struct
106 {
107  pin_name_t mut;
108  pin_name_t shd;
109  pin_name_t g0;
110  pin_name_t g1;
113 
118 typedef enum
119 {
121  AUDIOAMP9_ERROR = -1
122 
124 
141 
156 
168 
179 
190 
201 
212 
223 
234 
245 
256 
269 err_t audioamp9_set_gain_level ( audioamp9_t *ctx, uint8_t gain_level );
270 
271 #ifdef __cplusplus
272 }
273 #endif
274 #endif // AUDIOAMP9_H
275  // audioamp9
277 
278 // ------------------------------------------------------------------------ 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:95
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:96
AUDIOAMP9_ERROR
@ AUDIOAMP9_ERROR
Definition: audioamp9.h:121
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:106
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:110
audioamp9_t::g1
digital_out_t g1
Definition: audioamp9.h:97
audioamp9_cfg_t::g0
pin_name_t g0
Definition: audioamp9.h:109
audioamp9_t
AudioAmp 9 Click context object.
Definition: audioamp9.h:93
AUDIOAMP9_OK
@ AUDIOAMP9_OK
Definition: audioamp9.h:120
audioamp9_return_value_t
audioamp9_return_value_t
AudioAmp 9 Click return value data.
Definition: audioamp9.h:119
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:107
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:108
audioamp9_t::mut
digital_out_t mut
Definition: audioamp9.h:94
audioamp9_cfg_setup
void audioamp9_cfg_setup(audioamp9_cfg_t *cfg)
AudioAmp 9 configuration object setup function.