audioamp5 2.0.0.0
audioamp5.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 AUDIOAMP5_H
36#define AUDIOAMP5_H
37
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define AUDIOAMP5_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.mds= MIKROBUS( mikrobus, MIKROBUS_RST ); \
53 cfg.en= MIKROBUS( mikrobus, MIKROBUS_CS ); \
54 cfg.gs= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
55
61#define AUDIOAMP5_RETVAL uint8_t
62
63#define AUDIOAMP5_OK 0x00
64#define AUDIOAMP5_INIT_ERROR 0xFF
71#define AUDIOAMP5_SHDWN_MUTE_OUTPUTS 0x00
72#define AUDIOAMP5_PWRUP_UNMUTE_OUTPUTS 0x01
79#define AUDIOAMP5_BD_MODE 0x00
80#define AUDIOAMP5_1SPW_MODE 0x01
87#define AUDIOAMP5_GAIN_20DB 0x00
88#define AUDIOAMP5_GAIN_26DB 0x01 // End group macro
91// --------------------------------------------------------------- PUBLIC TYPES
100typedef struct
101{
102 // Output pins
103
104 digital_out_t mds;
105 digital_out_t en;
106 digital_out_t gs;
107
109
113typedef struct
114{
115 // Additional gpio pins
116
117 pin_name_t mds;
118 pin_name_t en;
119 pin_name_t gs;
120
122 // End types group
124// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
125
131#ifdef __cplusplus
132extern "C"{
133#endif
134
144
153
162
176void audioamp5_set_device_state ( audioamp5_t *ctx, uint8_t state );
177
186void audioamp5_mode_select ( audioamp5_t *ctx, uint8_t state );
187
196void audioamp5_gain_select ( audioamp5_t *ctx, uint8_t state );
197
206
207#ifdef __cplusplus
208}
209#endif
210#endif // _AUDIOAMP5_H_
211 // End public_function group
214
215// ------------------------------------------------------------------------- END
#define AUDIOAMP5_RETVAL
Definition: audioamp5.h:61
void audioamp5_default_cfg(audioamp5_t *ctx)
Click Default Configuration function.
void audioamp5_config_update(audioamp5_t *ctx)
Configuration Update function.
void audioamp5_cfg_setup(audioamp5_cfg_t *cfg)
Config Object Initialization function.
AUDIOAMP5_RETVAL audioamp5_init(audioamp5_t *ctx, audioamp5_cfg_t *cfg)
Initialization function.
void audioamp5_set_device_state(audioamp5_t *ctx, uint8_t state)
Default Configuration function.
void audioamp5_gain_select(audioamp5_t *ctx, uint8_t state)
Gain Selection function.
void audioamp5_mode_select(audioamp5_t *ctx, uint8_t state)
Mode Selection function.
Click configuration structure definition.
Definition: audioamp5.h:114
pin_name_t gs
Definition: audioamp5.h:119
pin_name_t en
Definition: audioamp5.h:118
pin_name_t mds
Definition: audioamp5.h:117
Click ctx object definition.
Definition: audioamp5.h:101
digital_out_t gs
Definition: audioamp5.h:106
digital_out_t mds
Definition: audioamp5.h:104
digital_out_t en
Definition: audioamp5.h:105