39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define BUZZ3_DEF_FREQ 500
79#define BUZZ3_NOTE_C2 65
80#define BUZZ3_NOTE_Db2 69
81#define BUZZ3_NOTE_D2 73
82#define BUZZ3_NOTE_Eb2 78
83#define BUZZ3_NOTE_E2 82
84#define BUZZ3_NOTE_F2 87
85#define BUZZ3_NOTE_Gb2 93
86#define BUZZ3_NOTE_G2 98
87#define BUZZ3_NOTE_Ab2 104
88#define BUZZ3_NOTE_A2 110
89#define BUZZ3_NOTE_Bb2 117
90#define BUZZ3_NOTE_B2 123
91#define BUZZ3_NOTE_C3 131
92#define BUZZ3_NOTE_Db3 139
93#define BUZZ3_NOTE_D3 147
94#define BUZZ3_NOTE_Eb3 156
95#define BUZZ3_NOTE_E3 165
96#define BUZZ3_NOTE_F3 175
97#define BUZZ3_NOTE_Gb3 185
98#define BUZZ3_NOTE_G3 196
99#define BUZZ3_NOTE_Ab3 208
100#define BUZZ3_NOTE_A3 220
101#define BUZZ3_NOTE_AS3 233
102#define BUZZ3_NOTE_B3 247
103#define BUZZ3_NOTE_C4 262
104#define BUZZ3_NOTE_Db4 277
105#define BUZZ3_NOTE_D4 294
106#define BUZZ3_NOTE_Eb4 311
107#define BUZZ3_NOTE_E4 330
108#define BUZZ3_NOTE_F4 349
109#define BUZZ3_NOTE_Gb4 370
110#define BUZZ3_NOTE_G4 392
111#define BUZZ3_NOTE_Ab4 415
112#define BUZZ3_NOTE_A4 440
113#define BUZZ3_NOTE_Bb4 466
114#define BUZZ3_NOTE_B4 494
115#define BUZZ3_NOTE_C5 523
116#define BUZZ3_NOTE_Db5 554
117#define BUZZ3_NOTE_D5 587
118#define BUZZ3_NOTE_Eb5 622
119#define BUZZ3_NOTE_E5 659
120#define BUZZ3_NOTE_F5 698
121#define BUZZ3_NOTE_Gb5 740
122#define BUZZ3_NOTE_G5 784
123#define BUZZ3_NOTE_Ab5 831
124#define BUZZ3_NOTE_A5 880
125#define BUZZ3_NOTE_Bb5 932
126#define BUZZ3_NOTE_B5 988
127#define BUZZ3_NOTE_C6 1047
128#define BUZZ3_NOTE_Db6 1109
129#define BUZZ3_NOTE_D6 1175
130#define BUZZ3_NOTE_Eb6 1245
131#define BUZZ3_NOTE_E6 1319
132#define BUZZ3_NOTE_F6 1397
133#define BUZZ3_NOTE_Gb6 1480
134#define BUZZ3_NOTE_G6 1568
135#define BUZZ3_NOTE_Ab6 1661
136#define BUZZ3_NOTE_A6 1760
137#define BUZZ3_NOTE_Bb6 1865
138#define BUZZ3_NOTE_B6 1976
139#define BUZZ3_NOTE_C7 2093
140#define BUZZ3_NOTE_Db7 2217
141#define BUZZ3_NOTE_D7 2349
142#define BUZZ3_NOTE_Eb7 2489
143#define BUZZ3_NOTE_E7 2637
144#define BUZZ3_NOTE_F7 2794
145#define BUZZ3_NOTE_Gb7 2960
146#define BUZZ3_NOTE_G7 3136
147#define BUZZ3_NOTE_Ab7 3322
148#define BUZZ3_NOTE_A7 3520
149#define BUZZ3_NOTE_Bb7 3729
150#define BUZZ3_NOTE_B7 3951
151#define BUZZ3_NOTE_C8 4186
152#define BUZZ3_NOTE_Db8 4435
153#define BUZZ3_NOTE_D8 4699
154#define BUZZ3_NOTE_Eb8 4978
160#define BUZZ3_OP_MODE_GAIN_x0 0x00
161#define BUZZ3_OP_MODE_GAIN_x1 0x01
162#define BUZZ3_OP_MODE_GAIN_x2 0x02
163#define BUZZ3_OP_MODE_GAIN_x3 0x03
181#define BUZZ3_MAP_MIKROBUS( cfg, mikrobus ) \
182 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
183 cfg.en1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
184 cfg.en2 = MIKROBUS( mikrobus, MIKROBUS_RST )
buzz3_return_value_t
Buzz 3 Click return value data.
Definition buzz3.h:235
@ BUZZ3_ERROR
Definition buzz3.h:237
@ BUZZ3_OK
Definition buzz3.h:236
err_t buzz3_default_cfg(buzz3_t *ctx)
Buzz 3 default configuration function.
err_t buzz3_pwm_start(buzz3_t *ctx)
Buzz 3 start PWM module.
err_t buzz3_set_gain_operating_mode(buzz3_t *ctx, uint8_t op_mode)
Buzz 3 set gain operating mode function.
err_t buzz3_init(buzz3_t *ctx, buzz3_cfg_t *cfg)
Buzz 3 initialization function.
void buzz3_play_sound(buzz3_t *ctx, uint16_t freq, uint16_t duration)
Buzz 3 play sound function.
void buzz3_cfg_setup(buzz3_cfg_t *cfg)
Buzz 3 configuration object setup function.
err_t buzz3_pwm_stop(buzz3_t *ctx)
Buzz 3 stop PWM module.
err_t buzz3_set_duty_cycle(buzz3_t *ctx, float duty_cycle)
Buzz 3 sets PWM duty cycle.
Buzz 3 Click configuration object.
Definition buzz3.h:217
pin_name_t en2
Definition buzz3.h:223
pin_name_t en1
Definition buzz3.h:222
uint32_t dev_pwm_freq
Definition buzz3.h:226
pin_name_t pwm
Definition buzz3.h:219
Buzz 3 Click driver selector.
Definition buzz3.h:199
digital_out_t en2
Definition buzz3.h:202
digital_out_t en1
Definition buzz3.h:201
uint32_t pwm_freq
Definition buzz3.h:208
pwm_t pwm
Definition buzz3.h:205