audioamp6 2.0.0.0
audioamp6.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 AUDIOAMP6_H
36#define AUDIOAMP6_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
54// -------------------------------------------------------------- PUBLIC MACROS
64#define AUDIOAMP6_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.mds= MIKROBUS( mikrobus, MIKROBUS_RST ); \
66 cfg.en= MIKROBUS( mikrobus, MIKROBUS_CS ); \
67 cfg.gs= MIKROBUS( mikrobus, MIKROBUS_PWM );
74#define AUDIOAMP6_RETVAL uint8_t
75
76#define AUDIOAMP6_OK 0x00
77#define AUDIOAMP6_INIT_ERROR 0xFF
84#define AUDIOAMP6_GAIN_20dB 0x00
85#define AUDIOAMP6_GAIN_26dB 0x01
92#define AUDIOAMP6_OUTPUT_ENABLE 0x01
93#define AUDIOAMP6_OUTPUT_DISABLE 0x00
100#define AUDIOAMP6_MODE_BD 0x00
101#define AUDIOAMP6_MODE_1SPW 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
139// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
140
146#ifdef __cplusplus
147extern "C"{
148#endif
149
159
168
179void audioamp6_set_mode( audioamp6_t *ctx, uint8_t mode );
180
187void audioamp6_set_output( audioamp6_t *ctx, uint8_t out );
188
195void audioamp6_set_gain( audioamp6_t *ctx, uint8_t gain );
196
197#ifdef __cplusplus
198}
199#endif
200#endif // _AUDIOAMP6_H_
201
202 // End public_function group
204
205// ------------------------------------------------------------------------- END
#define AUDIOAMP6_RETVAL
Definition audioamp6.h:74
void audioamp6_cfg_setup(audioamp6_cfg_t *cfg)
Config Object Initialization function.
void audioamp6_set_output(audioamp6_t *ctx, uint8_t out)
Enable or Disable output.
void audioamp6_set_gain(audioamp6_t *ctx, uint8_t gain)
Sets Gain.
AUDIOAMP6_RETVAL audioamp6_init(audioamp6_t *ctx, audioamp6_cfg_t *cfg)
Initialization function.
void audioamp6_set_mode(audioamp6_t *ctx, uint8_t mode)
Sets mode.
Click configuration structure definition.
Definition audioamp6.h:128
pin_name_t gs
Definition audioamp6.h:133
pin_name_t en
Definition audioamp6.h:132
pin_name_t mds
Definition audioamp6.h:131
Click ctx object definition.
Definition audioamp6.h:115
digital_out_t gs
Definition audioamp6.h:120
digital_out_t mds
Definition audioamp6.h:118
digital_out_t en
Definition audioamp6.h:119