audioamp4 2.0.0.0
audioamp4.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 AUDIOAMP4_H
36#define AUDIOAMP4_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 AUDIOAMP4_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.s0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
67 cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
68 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
69 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
70 cfg.s2 = MIKROBUS( mikrobus, MIKROBUS_INT )
77#define AUDIOAMP4_RETVAL uint8_t
78
79#define AUDIOAMP4_OK 0x00
80#define AUDIOAMP4_SHTDWN_STATE_ERR 0x01
81#define AUDIOAMP4_VOL_CHANN_ERR 0x02
88#define AUDIOAMP4_VOLUME_CHANN_0 0x00
89#define AUDIOAMP4_VOLUME_CHANN_1 0x01
90#define AUDIOAMP4_VOLUME_CHANN_2 0x02
91#define AUDIOAMP4_VOLUME_CHANN_3 0x03
92#define AUDIOAMP4_VOLUME_CHANN_4 0x04
93#define AUDIOAMP4_VOLUME_CHANN_5 0x05
94#define AUDIOAMP4_VOLUME_CHANN_6 0x06
95#define AUDIOAMP4_VOLUME_CHANN_7 0x07
102#define AUDIOAMP4_SHUTDOWN_ON 0x01
103#define AUDIOAMP4_SHUTDOWN_OFF 0x00
106 // End group macro
107// --------------------------------------------------------------- PUBLIC TYPES
116typedef struct
117{
118 // Output pins
119
120 digital_out_t s0;
121 digital_out_t s1;
122 digital_out_t en;
123 digital_out_t pwm;
124 digital_out_t s2;
125
127
131typedef struct
132{
133 // Additional gpio pins
134
135 pin_name_t s0;
136 pin_name_t s1;
137 pin_name_t en;
138 pin_name_t pwm;
139 pin_name_t s2;
140
142
143// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
144
150#ifdef __cplusplus
151extern "C"{
152#endif
153
163
172
187
188
200
212
213
214#ifdef __cplusplus
215}
216#endif
217#endif // _AUDIOAMP4_H_
218
219 // End public_function group
221
222// ------------------------------------------------------------------------- END
#define AUDIOAMP4_RETVAL
Definition audioamp4.h:77
AUDIOAMP4_RETVAL audioamp4_set_channel(audioamp4_t *ctx, uint8_t channel)
Set channel function function.
AUDIOAMP4_RETVAL audioamp4_init(audioamp4_t *ctx, audioamp4_cfg_t *cfg)
Initialization function.
void audioamp4_default_cfg(audioamp4_t *ctx)
Click Default Configuration function.
void audioamp4_cfg_setup(audioamp4_cfg_t *cfg)
Config Object Initialization function.
AUDIOAMP4_RETVAL audioamp4_shutdown(audioamp4_t *ctx, uint8_t state)
Set channel function function.
Click configuration structure definition.
Definition audioamp4.h:132
pin_name_t s2
Definition audioamp4.h:139
pin_name_t s0
Definition audioamp4.h:135
pin_name_t s1
Definition audioamp4.h:136
pin_name_t en
Definition audioamp4.h:137
pin_name_t pwm
Definition audioamp4.h:138
Click ctx object definition.
Definition audioamp4.h:117
digital_out_t s2
Definition audioamp4.h:124
digital_out_t pwm
Definition audioamp4.h:123
digital_out_t en
Definition audioamp4.h:122
digital_out_t s1
Definition audioamp4.h:121
digital_out_t s0
Definition audioamp4.h:120