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
42#ifdef PREINIT_SUPPORTED
43#include "preinit.h"
44#endif
45
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
48 #include "delays.h"
49 #endif
50#endif
51
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54
55// -------------------------------------------------------------- PUBLIC MACROS
65#define AUDIOAMP5_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.mds= MIKROBUS( mikrobus, MIKROBUS_RST ); \
67 cfg.en= MIKROBUS( mikrobus, MIKROBUS_CS ); \
68 cfg.gs= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
69
75#define AUDIOAMP5_RETVAL uint8_t
76
77#define AUDIOAMP5_OK 0x00
78#define AUDIOAMP5_INIT_ERROR 0xFF
85#define AUDIOAMP5_SHDWN_MUTE_OUTPUTS 0x00
86#define AUDIOAMP5_PWRUP_UNMUTE_OUTPUTS 0x01
93#define AUDIOAMP5_BD_MODE 0x00
94#define AUDIOAMP5_1SPW_MODE 0x01
101#define AUDIOAMP5_GAIN_20DB 0x00
102#define AUDIOAMP5_GAIN_26DB 0x01
104 // End group macro
105// --------------------------------------------------------------- PUBLIC TYPES
114typedef struct
115{
116 // Output pins
117
118 digital_out_t mds;
119 digital_out_t en;
120 digital_out_t gs;
121
123
127typedef struct
128{
129 // Additional gpio pins
130
131 pin_name_t mds;
132 pin_name_t en;
133 pin_name_t gs;
134
136
137 // End types group
138// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
139
145#ifdef __cplusplus
146extern "C"{
147#endif
148
158
167
176
190void audioamp5_set_device_state ( audioamp5_t *ctx, uint8_t state );
191
200void audioamp5_mode_select ( audioamp5_t *ctx, uint8_t state );
201
210void audioamp5_gain_select ( audioamp5_t *ctx, uint8_t state );
211
220
221#ifdef __cplusplus
222}
223#endif
224#endif // _AUDIOAMP5_H_
225
226 // End public_function group
228
229// ------------------------------------------------------------------------- END
#define AUDIOAMP5_RETVAL
Definition audioamp5.h:75
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:128
pin_name_t gs
Definition audioamp5.h:133
pin_name_t en
Definition audioamp5.h:132
pin_name_t mds
Definition audioamp5.h:131
Click ctx object definition.
Definition audioamp5.h:115
digital_out_t gs
Definition audioamp5.h:120
digital_out_t mds
Definition audioamp5.h:118
digital_out_t en
Definition audioamp5.h:119