Sensor Watch 0.0.2
A board replacement for the classic Casio F-91W wristwatch, powered by a Microchip SAM L22 microcontroller.
Loading...
Searching...
No Matches
watch_buzzer.h
1/*
2 * MIT License
3 *
4 * Copyright (c) 2020 Joey Castillo
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#ifndef _WATCH_BUZZER_H_INCLUDED
25#define _WATCH_BUZZER_H_INCLUDED
27
28#include "watch.h"
29
34
37
42void watch_set_buzzer_period(uint32_t period);
43
49
55
59
61typedef enum BuzzerNote {
151
158void watch_buzzer_play_note(BuzzerNote note, uint16_t duration_ms);
159
161extern const uint16_t NotePeriods[108];
162
176void watch_buzzer_play_sequence(int8_t *note_sequence, void (*callback_on_end)(void));
177
181
182#ifndef __EMSCRIPTEN__
183void TC3_Handler(void);
184#endif
185
187#endif
void watch_buzzer_play_note(BuzzerNote note, uint16_t duration_ms)
Plays the given note for a set duration.
BuzzerNote
87 notes for use with watch_buzzer_play_note
Definition watch_buzzer.h:61
void watch_disable_buzzer(void)
Disables the TCC peripheral that drives the buzzer.
void watch_set_buzzer_on(void)
Turns the buzzer output on. It will emit a continuous sound at the given frequency.
void watch_buzzer_play_sequence(int8_t *note_sequence, void(*callback_on_end)(void))
Plays the given sequence of notes in a non-blocking way.
void watch_buzzer_abort_sequence(void)
Aborts a playing sequence.
const uint16_t NotePeriods[108]
An array of periods for all the notes on a piano, corresponding to the names in BuzzerNote.
Definition watch_private_buzzer.h:29
void watch_set_buzzer_period(uint32_t period)
Sets the period of the buzzer.
void watch_set_buzzer_off(void)
Turns the buzzer output off.
void watch_enable_buzzer(void)
Enables the TCC peripheral, which drives the buzzer.
@ BUZZER_NOTE_F8
5587.65 Hz
Definition watch_buzzer.h:142
@ BUZZER_NOTE_D6SHARP_E6FLAT
1244.51 Hz
Definition watch_buzzer.h:116
@ BUZZER_NOTE_B5
987.77 Hz
Definition watch_buzzer.h:112
@ BUZZER_NOTE_F3SHARP_G3FLAT
185.00 Hz
Definition watch_buzzer.h:83
@ BUZZER_NOTE_C8
4186.01 Hz
Definition watch_buzzer.h:137
@ BUZZER_NOTE_B8
7902.13 Hz
Definition watch_buzzer.h:148
@ BUZZER_NOTE_E3
164.81 Hz
Definition watch_buzzer.h:81
@ BUZZER_NOTE_D6
1174.66 Hz
Definition watch_buzzer.h:115
@ BUZZER_NOTE_B1
61.74 Hz
Definition watch_buzzer.h:64
@ BUZZER_NOTE_G4
392.00 Hz
Definition watch_buzzer.h:96
@ BUZZER_NOTE_B7
3951.07 Hz
Definition watch_buzzer.h:136
@ BUZZER_NOTE_C7SHARP_D7FLAT
2217.46 Hz
Definition watch_buzzer.h:126
@ BUZZER_NOTE_G3SHARP_A3FLAT
207.65 Hz
Definition watch_buzzer.h:85
@ BUZZER_NOTE_C6
1046.50 Hz
Definition watch_buzzer.h:113
@ BUZZER_NOTE_E6
1318.51 Hz
Definition watch_buzzer.h:117
@ BUZZER_NOTE_D7SHARP_E7FLAT
2489.02 Hz
Definition watch_buzzer.h:128
@ BUZZER_NOTE_E7
2637.02 Hz
Definition watch_buzzer.h:129
@ BUZZER_NOTE_E4
329.63 Hz
Definition watch_buzzer.h:93
@ BUZZER_NOTE_B6
1975.53 Hz
Definition watch_buzzer.h:124
@ BUZZER_NOTE_REST
no sound
Definition watch_buzzer.h:149
@ BUZZER_NOTE_D8SHARP_E8FLAT
4978.03 Hz
Definition watch_buzzer.h:140
@ BUZZER_NOTE_D4SHARP_E4FLAT
311.13 Hz
Definition watch_buzzer.h:92
@ BUZZER_NOTE_C2
65.41 Hz
Definition watch_buzzer.h:65
@ BUZZER_NOTE_B2
123.47 Hz
Definition watch_buzzer.h:76
@ BUZZER_NOTE_F5
698.46 Hz
Definition watch_buzzer.h:106
@ BUZZER_NOTE_C2SHARP_D2FLAT
69.30 Hz
Definition watch_buzzer.h:66
@ BUZZER_NOTE_C4SHARP_D4FLAT
277.18 Hz
Definition watch_buzzer.h:90
@ BUZZER_NOTE_A6SHARP_B6FLAT
1864.66 Hz
Definition watch_buzzer.h:123
@ BUZZER_NOTE_G6
1567.98 Hz
Definition watch_buzzer.h:120
@ BUZZER_NOTE_A5SHARP_B5FLAT
932.33 Hz
Definition watch_buzzer.h:111
@ BUZZER_NOTE_G8
6271.93 Hz
Definition watch_buzzer.h:144
@ BUZZER_NOTE_D4
293.66 Hz
Definition watch_buzzer.h:91
@ BUZZER_NOTE_G5SHARP_A5FLAT
830.61 Hz
Definition watch_buzzer.h:109
@ BUZZER_NOTE_A3SHARP_B3FLAT
233.08 Hz
Definition watch_buzzer.h:87
@ BUZZER_NOTE_G7
3135.96 Hz
Definition watch_buzzer.h:132
@ BUZZER_NOTE_D5SHARP_E5FLAT
622.25 Hz
Definition watch_buzzer.h:104
@ BUZZER_NOTE_D3
146.83 Hz
Definition watch_buzzer.h:79
@ BUZZER_NOTE_G4SHARP_A4FLAT
415.30 Hz
Definition watch_buzzer.h:97
@ BUZZER_NOTE_A1SHARP_B1FLAT
58.27 Hz
Definition watch_buzzer.h:63
@ BUZZER_NOTE_D5
587.33 Hz
Definition watch_buzzer.h:103
@ BUZZER_NOTE_A2SHARP_B2FLAT
116.54 Hz
Definition watch_buzzer.h:75
@ BUZZER_NOTE_A4
440.00 Hz
Definition watch_buzzer.h:98
@ BUZZER_NOTE_D7
2349.32 Hz
Definition watch_buzzer.h:127
@ BUZZER_NOTE_F5SHARP_G5FLAT
739.99 Hz
Definition watch_buzzer.h:107
@ BUZZER_NOTE_C6SHARP_D6FLAT
1108.73 Hz
Definition watch_buzzer.h:114
@ BUZZER_NOTE_A7SHARP_B7FLAT
3729.31 Hz
Definition watch_buzzer.h:135
@ BUZZER_NOTE_F7
2793.83 Hz
Definition watch_buzzer.h:130
@ BUZZER_NOTE_A3
220.00 Hz
Definition watch_buzzer.h:86
@ BUZZER_NOTE_F6SHARP_G6FLAT
1479.98 Hz
Definition watch_buzzer.h:119
@ BUZZER_NOTE_B4
493.88 Hz
Definition watch_buzzer.h:100
@ BUZZER_NOTE_A5
880.00 Hz
Definition watch_buzzer.h:110
@ BUZZER_NOTE_C5SHARP_D5FLAT
554.37 Hz
Definition watch_buzzer.h:102
@ BUZZER_NOTE_A4SHARP_B4FLAT
466.16 Hz
Definition watch_buzzer.h:99
@ BUZZER_NOTE_C7
2093.00 Hz
Definition watch_buzzer.h:125
@ BUZZER_NOTE_F6
1396.91 Hz
Definition watch_buzzer.h:118
@ BUZZER_NOTE_C4
261.63 Hz
Definition watch_buzzer.h:89
@ BUZZER_NOTE_F2
87.31 Hz
Definition watch_buzzer.h:70
@ BUZZER_NOTE_G2SHARP_A2FLAT
103.83 Hz
Definition watch_buzzer.h:73
@ BUZZER_NOTE_A8
7040.00 Hz
Definition watch_buzzer.h:146
@ BUZZER_NOTE_A2
110.00 Hz
Definition watch_buzzer.h:74
@ BUZZER_NOTE_F4SHARP_G4FLAT
369.99 Hz
Definition watch_buzzer.h:95
@ BUZZER_NOTE_E2
82.41 Hz
Definition watch_buzzer.h:69
@ BUZZER_NOTE_G3
196.00 Hz
Definition watch_buzzer.h:84
@ BUZZER_NOTE_F2SHARP_G2FLAT
92.50 Hz
Definition watch_buzzer.h:71
@ BUZZER_NOTE_E5
659.25 Hz
Definition watch_buzzer.h:105
@ BUZZER_NOTE_D2SHARP_E2FLAT
77.78 Hz
Definition watch_buzzer.h:68
@ BUZZER_NOTE_C3SHARP_D3FLAT
138.59 Hz
Definition watch_buzzer.h:78
@ BUZZER_NOTE_C8SHARP_D8FLAT
4434.92 Hz
Definition watch_buzzer.h:138
@ BUZZER_NOTE_E8
5274.04 Hz
Definition watch_buzzer.h:141
@ BUZZER_NOTE_C3
130.81 Hz
Definition watch_buzzer.h:77
@ BUZZER_NOTE_D2
73.42 Hz
Definition watch_buzzer.h:67
@ BUZZER_NOTE_D8
4698.63 Hz
Definition watch_buzzer.h:139
@ BUZZER_NOTE_A6
1760.00 Hz
Definition watch_buzzer.h:122
@ BUZZER_NOTE_F8SHARP_G8FLAT
5919.91 Hz
Definition watch_buzzer.h:143
@ BUZZER_NOTE_F4
349.23 Hz
Definition watch_buzzer.h:94
@ BUZZER_NOTE_A8SHARP_B8FLAT
7458.62 Hz
Definition watch_buzzer.h:147
@ BUZZER_NOTE_A7
3520.00 Hz
Definition watch_buzzer.h:134
@ BUZZER_NOTE_G5
783.99 Hz
Definition watch_buzzer.h:108
@ BUZZER_NOTE_C5
523.25 Hz
Definition watch_buzzer.h:101
@ BUZZER_NOTE_G2
98.00 Hz
Definition watch_buzzer.h:72
@ BUZZER_NOTE_B3
246.94 Hz
Definition watch_buzzer.h:88
@ BUZZER_NOTE_D3SHARP_E3FLAT
155.56 Hz
Definition watch_buzzer.h:80
@ BUZZER_NOTE_F3
174.61 Hz
Definition watch_buzzer.h:82
@ BUZZER_NOTE_G8SHARP_A8FLAT
6644.88 Hz
Definition watch_buzzer.h:145
@ BUZZER_NOTE_F7SHARP_G7FLAT
2959.96 Hz
Definition watch_buzzer.h:131
@ BUZZER_NOTE_G7SHARP_A7FLAT
3322.44 Hz
Definition watch_buzzer.h:133
@ BUZZER_NOTE_A1
55.00 Hz
Definition watch_buzzer.h:62
@ BUZZER_NOTE_G6SHARP_A6FLAT
1661.22 Hz
Definition watch_buzzer.h:121