headphoneamp  2.0.0.0
headphoneamp.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 HEADPHONEAMP_H
29 #define HEADPHONEAMP_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
38 
39 
55 #define HEADPHONEAMP_SOUND_VOLUME_NEG_33_dB 0
56 #define HEADPHONEAMP_SOUND_VOLUME_NEG_30_dB 1
57 #define HEADPHONEAMP_SOUND_VOLUME_NEG_27_dB 2
58 #define HEADPHONEAMP_SOUND_VOLUME_NEG_24_dB 3
59 #define HEADPHONEAMP_SOUND_VOLUME_NEG_21_dB 4
60 #define HEADPHONEAMP_SOUND_VOLUME_NEG_18_dB 5
61 #define HEADPHONEAMP_SOUND_VOLUME_NEG_15_dB 6
62 #define HEADPHONEAMP_SOUND_VOLUME_NEG_12_dB 7
63 #define HEADPHONEAMP_SOUND_VOLUME_NEG_9_dB 8
64 #define HEADPHONEAMP_SOUND_VOLUME_NEG_6_dB 9
65 #define HEADPHONEAMP_SOUND_VOLUME_NEG_3_dB 10
66 #define HEADPHONEAMP_SOUND_VOLUME_NEG_0_dB 11
67 #define HEADPHONEAMP_SOUND_VOLUME_POS_3_dB 12
68 #define HEADPHONEAMP_SOUND_VOLUME_POS_6_dB 13
69 #define HEADPHONEAMP_SOUND_VOLUME_POS_9_dB 14
70 #define HEADPHONEAMP_SOUND_VOLUME_POS_12_dB 15
71  // headphoneamp_set
73 
88 #define HEADPHONEAMP_MAP_MIKROBUS( cfg, mikrobus ) \
89  cfg.shdn = MIKROBUS( mikrobus, MIKROBUS_RST ); \
90  cfg.clk = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
91  cfg.ud = MIKROBUS( mikrobus, MIKROBUS_INT )
92  // headphoneamp_map // headphoneamp
95 
100 typedef struct
101 {
102  digital_out_t shdn;
103  digital_out_t clk;
104  digital_out_t ud;
107 
112 typedef struct
113 {
114  pin_name_t shdn;
115  pin_name_t clk;
116  pin_name_t ud;
119 
124 typedef enum
125 {
127  HEADPHONEAMP_ERROR = -1
128 
130 
147 
163 
178 
194 
209 
225 
241 
257 err_t headphoneamp_set_sound_volume ( headphoneamp_t *ctx, uint8_t sound_volume );
258 
259 #ifdef __cplusplus
260 }
261 #endif
262 #endif // HEADPHONEAMP_H
263  // headphoneamp
265 
266 // ------------------------------------------------------------------------ END
headphoneamp_set_sound_volume
err_t headphoneamp_set_sound_volume(headphoneamp_t *ctx, uint8_t sound_volume)
Headphone AMP set sound volume function.
headphoneamp_cfg_t
Headphone AMP Click configuration object.
Definition: headphoneamp.h:111
headphoneamp_volume_up
err_t headphoneamp_volume_up(headphoneamp_t *ctx)
Headphone AMP set sound volume up function.
HEADPHONEAMP_ERROR
Definition: headphoneamp.h:126
headphoneamp_init
err_t headphoneamp_init(headphoneamp_t *ctx, headphoneamp_cfg_t *cfg)
Headphone AMP initialization function.
HEADPHONEAMP_OK
Definition: headphoneamp.h:125
headphoneamp_default_cfg
err_t headphoneamp_default_cfg(headphoneamp_t *ctx)
Headphone AMP default configuration function.
headphoneamp_return_value_t
headphoneamp_return_value_t
Headphone AMP Click return value data.
Definition: headphoneamp.h:123
headphoneamp_power_up
err_t headphoneamp_power_up(headphoneamp_t *ctx)
Headphone AMP power up function.
headphoneamp_volume_down
err_t headphoneamp_volume_down(headphoneamp_t *ctx)
Headphone AMP set sound volume down function.
headphoneamp_shutdown
err_t headphoneamp_shutdown(headphoneamp_t *ctx)
Headphone AMP shutdown function.
headphoneamp_cfg_setup
void headphoneamp_cfg_setup(headphoneamp_cfg_t *cfg)
Headphone AMP configuration object setup function.
headphoneamp_t
Headphone AMP Click context object.
Definition: headphoneamp.h:99