audioamp2 2.0.0.0
audioamp2.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
33// ----------------------------------------------------------------------------
34
35#ifndef AUDIOAMP2_H
36#define AUDIOAMP2_H
37
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define AUDIOAMP2_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.gn0= MIKROBUS( mikrobus, MIKROBUS_AN ); \
53 cfg.gn1= MIKROBUS( mikrobus, MIKROBUS_RST ); \
54 cfg.stb= MIKROBUS( mikrobus, MIKROBUS_CS ); \
55 cfg.mute= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56 cfg.dia= MIKROBUS( mikrobus, MIKROBUS_INT );
63#define AUDIOAMP2_RETVAL uint8_t
64
65#define AUDIOAMP2_OK 0x00
66#define AUDIOAMP2_INIT_ERROR 0xFF
73#define AUDIOAMP2_STANDBY_MODE 0x00
74#define AUDIOAMP2_MUTE_MODE 0x01
75#define AUDIOAMP2_PLAY_MODE 0x02
82#define AUDIOAMP2_20DB_GAIN 0x00
83#define AUDIOAMP2_26DB_GAIN 0x01
84#define AUDIOAMP2_30DB_GAIN 0x02
85#define AUDIOAMP2_32DB_GAIN 0x03 // End group macro
89// --------------------------------------------------------------- PUBLIC TYPES
98typedef struct
99{
100 // Output pins
101
102 digital_out_t gn0;
103 digital_out_t gn1;
104 digital_out_t stb;
105 digital_out_t mute;
106
107 // Input pins
108
109 digital_in_t dia;
110
112
116typedef struct
117{
118 // Additional gpio pins
119
120 pin_name_t gn0;
121 pin_name_t gn1;
122 pin_name_t stb;
123 pin_name_t mute;
124 pin_name_t dia;
125
127 // End types group
129// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
130
136#ifdef __cplusplus
137extern "C"{
138#endif
139
149
159
170uint8_t audioamp2_set_mode ( audioamp2_t *ctx, uint8_t sel_mode );
171
182uint8_t audioamp2_set_gain ( audioamp2_t *ctx, uint8_t sel_gain );
183
194
195#ifdef __cplusplus
196}
197#endif
198#endif // _AUDIOAMP2_H_
199 // End public_function group
202
203// ------------------------------------------------------------------------- END
#define AUDIOAMP2_RETVAL
Definition: audioamp2.h:63
uint8_t audioamp2_set_mode(audioamp2_t *ctx, uint8_t sel_mode)
Mode Set function.
void audioamp2_cfg_setup(audioamp2_cfg_t *cfg)
Config Object Initialization function.
uint8_t audioamp2_set_gain(audioamp2_t *ctx, uint8_t sel_gain)
Gain Set function.
uint8_t audioamp2_check_diagnostic(audioamp2_t *ctx)
Diagnostic Check function.
AUDIOAMP2_RETVAL audioamp2_init(audioamp2_t *ctx, audioamp2_cfg_t *cfg)
Initialization function.
Click configuration structure definition.
Definition: audioamp2.h:117
pin_name_t dia
Definition: audioamp2.h:124
pin_name_t gn0
Definition: audioamp2.h:120
pin_name_t gn1
Definition: audioamp2.h:121
pin_name_t mute
Definition: audioamp2.h:123
pin_name_t stb
Definition: audioamp2.h:122
Click ctx object definition.
Definition: audioamp2.h:99
digital_out_t stb
Definition: audioamp2.h:104
digital_out_t mute
Definition: audioamp2.h:105
digital_out_t gn1
Definition: audioamp2.h:103
digital_in_t dia
Definition: audioamp2.h:109
digital_out_t gn0
Definition: audioamp2.h:102