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
38#include "drv_digital_out.h"
39#include "drv_digital_in.h"
40
41// -------------------------------------------------------------- PUBLIC MACROS
51#define AUDIOAMP4_MAP_MIKROBUS( cfg, mikrobus ) \
52 cfg.s0 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
53 cfg.s1 = MIKROBUS( mikrobus, MIKROBUS_RST ); \
54 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
55 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56 cfg.s2 = MIKROBUS( mikrobus, MIKROBUS_INT )
63#define AUDIOAMP4_RETVAL uint8_t
64
65#define AUDIOAMP4_OK 0x00
66#define AUDIOAMP4_SHTDWN_STATE_ERR 0x01
67#define AUDIOAMP4_VOL_CHANN_ERR 0x02
74#define AUDIOAMP4_VOLUME_CHANN_0 0x00
75#define AUDIOAMP4_VOLUME_CHANN_1 0x01
76#define AUDIOAMP4_VOLUME_CHANN_2 0x02
77#define AUDIOAMP4_VOLUME_CHANN_3 0x03
78#define AUDIOAMP4_VOLUME_CHANN_4 0x04
79#define AUDIOAMP4_VOLUME_CHANN_5 0x05
80#define AUDIOAMP4_VOLUME_CHANN_6 0x06
81#define AUDIOAMP4_VOLUME_CHANN_7 0x07
88#define AUDIOAMP4_SHUTDOWN_ON 0x01
89#define AUDIOAMP4_SHUTDOWN_OFF 0x00 // End group macro
93// --------------------------------------------------------------- PUBLIC TYPES
102typedef struct
103{
104 // Output pins
105
106 digital_out_t s0;
107 digital_out_t s1;
108 digital_out_t en;
109 digital_out_t pwm;
110 digital_out_t s2;
111
113
117typedef struct
118{
119 // Additional gpio pins
120
121 pin_name_t s0;
122 pin_name_t s1;
123 pin_name_t en;
124 pin_name_t pwm;
125 pin_name_t s2;
126
128
129// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
130
136#ifdef __cplusplus
137extern "C"{
138#endif
139
149
158
173
174
186
198
199
200#ifdef __cplusplus
201}
202#endif
203#endif // _AUDIOAMP4_H_
204 // End public_function group
207
208// ------------------------------------------------------------------------- END
#define AUDIOAMP4_RETVAL
Definition: audioamp4.h:63
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:118
pin_name_t s2
Definition: audioamp4.h:125
pin_name_t s0
Definition: audioamp4.h:121
pin_name_t s1
Definition: audioamp4.h:122
pin_name_t en
Definition: audioamp4.h:123
pin_name_t pwm
Definition: audioamp4.h:124
Click ctx object definition.
Definition: audioamp4.h:103
digital_out_t s2
Definition: audioamp4.h:110
digital_out_t pwm
Definition: audioamp4.h:109
digital_out_t en
Definition: audioamp4.h:108
digital_out_t s1
Definition: audioamp4.h:107
digital_out_t s0
Definition: audioamp4.h:106