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 PIEZODRIVER_DEF_FREQ 5000
79#define PIEZODRIVER_NOTE_C2 65
80#define PIEZODRIVER_NOTE_DB2 69
81#define PIEZODRIVER_NOTE_D2 73
82#define PIEZODRIVER_NOTE_EB2 78
83#define PIEZODRIVER_NOTE_E2 82
84#define PIEZODRIVER_NOTE_F2 87
85#define PIEZODRIVER_NOTE_GB2 93
86#define PIEZODRIVER_NOTE_G2 98
87#define PIEZODRIVER_NOTE_AB2 104
88#define PIEZODRIVER_NOTE_A2 110
89#define PIEZODRIVER_NOTE_BB2 117
90#define PIEZODRIVER_NOTE_B2 123
91#define PIEZODRIVER_NOTE_C3 131
92#define PIEZODRIVER_NOTE_DB3 139
93#define PIEZODRIVER_NOTE_D3 147
94#define PIEZODRIVER_NOTE_EB3 156
95#define PIEZODRIVER_NOTE_E3 165
96#define PIEZODRIVER_NOTE_F3 175
97#define PIEZODRIVER_NOTE_GB3 185
98#define PIEZODRIVER_NOTE_G3 196
99#define PIEZODRIVER_NOTE_AB3 208
100#define PIEZODRIVER_NOTE_A3 220
101#define PIEZODRIVER_NOTE_AS3 233
102#define PIEZODRIVER_NOTE_B3 247
103#define PIEZODRIVER_NOTE_C4 262
104#define PIEZODRIVER_NOTE_DB4 277
105#define PIEZODRIVER_NOTE_D4 294
106#define PIEZODRIVER_NOTE_EB4 311
107#define PIEZODRIVER_NOTE_E4 330
108#define PIEZODRIVER_NOTE_F4 349
109#define PIEZODRIVER_NOTE_GB4 370
110#define PIEZODRIVER_NOTE_G4 392
111#define PIEZODRIVER_NOTE_AB4 415
112#define PIEZODRIVER_NOTE_A4 440
113#define PIEZODRIVER_NOTE_BB4 466
114#define PIEZODRIVER_NOTE_B4 494
115#define PIEZODRIVER_NOTE_C5 523
116#define PIEZODRIVER_NOTE_DB5 554
117#define PIEZODRIVER_NOTE_D5 587
118#define PIEZODRIVER_NOTE_EB5 622
119#define PIEZODRIVER_NOTE_E5 659
120#define PIEZODRIVER_NOTE_F5 698
121#define PIEZODRIVER_NOTE_GB5 740
122#define PIEZODRIVER_NOTE_G5 784
123#define PIEZODRIVER_NOTE_AB5 831
124#define PIEZODRIVER_NOTE_A5 880
125#define PIEZODRIVER_NOTE_BB5 932
126#define PIEZODRIVER_NOTE_B5 988
127#define PIEZODRIVER_NOTE_C6 1047
128#define PIEZODRIVER_NOTE_DB6 1109
129#define PIEZODRIVER_NOTE_D6 1175
130#define PIEZODRIVER_NOTE_EB6 1245
131#define PIEZODRIVER_NOTE_E6 1319
132#define PIEZODRIVER_NOTE_F6 1397
133#define PIEZODRIVER_NOTE_GB6 1480
134#define PIEZODRIVER_NOTE_G6 1568
135#define PIEZODRIVER_NOTE_AB6 1661
136#define PIEZODRIVER_NOTE_A6 1760
137#define PIEZODRIVER_NOTE_BB6 1865
138#define PIEZODRIVER_NOTE_B6 1976
139#define PIEZODRIVER_NOTE_C7 2093
140#define PIEZODRIVER_NOTE_DB7 2217
141#define PIEZODRIVER_NOTE_D7 2349
142#define PIEZODRIVER_NOTE_EB7 2489
143#define PIEZODRIVER_NOTE_E7 2637
144#define PIEZODRIVER_NOTE_F7 2794
145#define PIEZODRIVER_NOTE_GB7 2960
146#define PIEZODRIVER_NOTE_G7 3136
147#define PIEZODRIVER_NOTE_AB7 3322
148#define PIEZODRIVER_NOTE_A7 3520
149#define PIEZODRIVER_NOTE_BB7 3729
150#define PIEZODRIVER_NOTE_B7 3951
151#define PIEZODRIVER_NOTE_C8 4186
152#define PIEZODRIVER_NOTE_DB8 4435
153#define PIEZODRIVER_NOTE_D8 4699
154#define PIEZODRIVER_NOTE_EB8 4978
172#define PIEZODRIVER_MAP_MIKROBUS( cfg, mikrobus ) \
173 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM );
err_t piezodriver_pwm_stop(piezodriver_t *ctx)
Piezo Driver stop PWM module.
err_t piezodriver_init(piezodriver_t *ctx, piezodriver_cfg_t *cfg)
Piezo Driver initialization function.
void piezodriver_cfg_setup(piezodriver_cfg_t *cfg)
Piezo Driver configuration object setup function.
void piezodriver_play_sound(piezodriver_t *ctx, uint16_t freq, uint8_t level, uint16_t duration)
Piezo Driver play sound function.
err_t piezodriver_default_cfg(piezodriver_t *ctx)
Piezo Driver default configuration function.
err_t piezodriver_set_duty_cycle(piezodriver_t *ctx, float duty_cycle)
Piezo Driver sets PWM duty cycle.
err_t piezodriver_pwm_start(piezodriver_t *ctx)
Piezo Driver start PWM module.
piezodriver_return_value_t
Piezo Driver Click return value data.
Definition piezodriver.h:211
@ PIEZODRIVER_ERROR
Definition piezodriver.h:213
@ PIEZODRIVER_OK
Definition piezodriver.h:212
Piezo Driver Click configuration object.
Definition piezodriver.h:197
uint32_t dev_pwm_freq
Definition piezodriver.h:202
pin_name_t pwm
Definition piezodriver.h:199
Piezo Driver Click context object.
Definition piezodriver.h:183
uint32_t pwm_freq
Definition piezodriver.h:188
pwm_t pwm
Definition piezodriver.h:185