![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Drive a speaker using PWM
Dependencies: mbed
Dependents: PwmSpeaker-Example
Tone.h@0:b7dd35e61bb1, 2015-11-12 (annotated)
- Committer:
- asmellby
- Date:
- Thu Nov 12 21:04:11 2015 +0000
- Revision:
- 0:b7dd35e61bb1
Initial commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asmellby | 0:b7dd35e61bb1 | 1 | /* $Id: Tone.h 113 2010-06-16 20:16:29Z bhagman@roguerobotics.com $ |
asmellby | 0:b7dd35e61bb1 | 2 | |
asmellby | 0:b7dd35e61bb1 | 3 | A Tone Generator Library |
asmellby | 0:b7dd35e61bb1 | 4 | |
asmellby | 0:b7dd35e61bb1 | 5 | Written by Brett Hagman |
asmellby | 0:b7dd35e61bb1 | 6 | http://www.roguerobotics.com/ |
asmellby | 0:b7dd35e61bb1 | 7 | bhagman@roguerobotics.com |
asmellby | 0:b7dd35e61bb1 | 8 | |
asmellby | 0:b7dd35e61bb1 | 9 | This library is free software: you can redistribute it and/or modify |
asmellby | 0:b7dd35e61bb1 | 10 | it under the terms of the GNU General Public License as published by |
asmellby | 0:b7dd35e61bb1 | 11 | the Free Software Foundation, either version 3 of the License, or |
asmellby | 0:b7dd35e61bb1 | 12 | (at your option) any later version. |
asmellby | 0:b7dd35e61bb1 | 13 | |
asmellby | 0:b7dd35e61bb1 | 14 | This library is distributed in the hope that it will be useful, |
asmellby | 0:b7dd35e61bb1 | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
asmellby | 0:b7dd35e61bb1 | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
asmellby | 0:b7dd35e61bb1 | 17 | GNU General Public License for more details. |
asmellby | 0:b7dd35e61bb1 | 18 | |
asmellby | 0:b7dd35e61bb1 | 19 | You should have received a copy of the GNU General Public License |
asmellby | 0:b7dd35e61bb1 | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
asmellby | 0:b7dd35e61bb1 | 21 | |
asmellby | 0:b7dd35e61bb1 | 22 | *************************************************/ |
asmellby | 0:b7dd35e61bb1 | 23 | |
asmellby | 0:b7dd35e61bb1 | 24 | #ifndef _Tone_h |
asmellby | 0:b7dd35e61bb1 | 25 | #define _Tone_h |
asmellby | 0:b7dd35e61bb1 | 26 | |
asmellby | 0:b7dd35e61bb1 | 27 | #include <stdint.h> |
asmellby | 0:b7dd35e61bb1 | 28 | |
asmellby | 0:b7dd35e61bb1 | 29 | /************************************************* |
asmellby | 0:b7dd35e61bb1 | 30 | * Public Constants |
asmellby | 0:b7dd35e61bb1 | 31 | *************************************************/ |
asmellby | 0:b7dd35e61bb1 | 32 | |
asmellby | 0:b7dd35e61bb1 | 33 | #define NOTE_B0 31 |
asmellby | 0:b7dd35e61bb1 | 34 | #define NOTE_C1 33 |
asmellby | 0:b7dd35e61bb1 | 35 | #define NOTE_CS1 35 |
asmellby | 0:b7dd35e61bb1 | 36 | #define NOTE_D1 37 |
asmellby | 0:b7dd35e61bb1 | 37 | #define NOTE_DS1 39 |
asmellby | 0:b7dd35e61bb1 | 38 | #define NOTE_E1 41 |
asmellby | 0:b7dd35e61bb1 | 39 | #define NOTE_F1 44 |
asmellby | 0:b7dd35e61bb1 | 40 | #define NOTE_FS1 46 |
asmellby | 0:b7dd35e61bb1 | 41 | #define NOTE_G1 49 |
asmellby | 0:b7dd35e61bb1 | 42 | #define NOTE_GS1 52 |
asmellby | 0:b7dd35e61bb1 | 43 | #define NOTE_A1 55 |
asmellby | 0:b7dd35e61bb1 | 44 | #define NOTE_AS1 58 |
asmellby | 0:b7dd35e61bb1 | 45 | #define NOTE_B1 62 |
asmellby | 0:b7dd35e61bb1 | 46 | #define NOTE_C2 65 |
asmellby | 0:b7dd35e61bb1 | 47 | #define NOTE_CS2 69 |
asmellby | 0:b7dd35e61bb1 | 48 | #define NOTE_D2 73 |
asmellby | 0:b7dd35e61bb1 | 49 | #define NOTE_DS2 78 |
asmellby | 0:b7dd35e61bb1 | 50 | #define NOTE_E2 82 |
asmellby | 0:b7dd35e61bb1 | 51 | #define NOTE_F2 87 |
asmellby | 0:b7dd35e61bb1 | 52 | #define NOTE_FS2 93 |
asmellby | 0:b7dd35e61bb1 | 53 | #define NOTE_G2 98 |
asmellby | 0:b7dd35e61bb1 | 54 | #define NOTE_GS2 104 |
asmellby | 0:b7dd35e61bb1 | 55 | #define NOTE_A2 110 |
asmellby | 0:b7dd35e61bb1 | 56 | #define NOTE_AS2 117 |
asmellby | 0:b7dd35e61bb1 | 57 | #define NOTE_B2 123 |
asmellby | 0:b7dd35e61bb1 | 58 | #define NOTE_C3 131 |
asmellby | 0:b7dd35e61bb1 | 59 | #define NOTE_CS3 139 |
asmellby | 0:b7dd35e61bb1 | 60 | #define NOTE_D3 147 |
asmellby | 0:b7dd35e61bb1 | 61 | #define NOTE_DS3 156 |
asmellby | 0:b7dd35e61bb1 | 62 | #define NOTE_E3 165 |
asmellby | 0:b7dd35e61bb1 | 63 | #define NOTE_F3 175 |
asmellby | 0:b7dd35e61bb1 | 64 | #define NOTE_FS3 185 |
asmellby | 0:b7dd35e61bb1 | 65 | #define NOTE_G3 196 |
asmellby | 0:b7dd35e61bb1 | 66 | #define NOTE_GS3 208 |
asmellby | 0:b7dd35e61bb1 | 67 | #define NOTE_A3 220 |
asmellby | 0:b7dd35e61bb1 | 68 | #define NOTE_AS3 233 |
asmellby | 0:b7dd35e61bb1 | 69 | #define NOTE_B3 247 |
asmellby | 0:b7dd35e61bb1 | 70 | #define NOTE_C4 262 |
asmellby | 0:b7dd35e61bb1 | 71 | #define NOTE_CS4 277 |
asmellby | 0:b7dd35e61bb1 | 72 | #define NOTE_D4 294 |
asmellby | 0:b7dd35e61bb1 | 73 | #define NOTE_DS4 311 |
asmellby | 0:b7dd35e61bb1 | 74 | #define NOTE_E4 330 |
asmellby | 0:b7dd35e61bb1 | 75 | #define NOTE_F4 349 |
asmellby | 0:b7dd35e61bb1 | 76 | #define NOTE_FS4 370 |
asmellby | 0:b7dd35e61bb1 | 77 | #define NOTE_G4 392 |
asmellby | 0:b7dd35e61bb1 | 78 | #define NOTE_GS4 415 |
asmellby | 0:b7dd35e61bb1 | 79 | #define NOTE_A4 440 |
asmellby | 0:b7dd35e61bb1 | 80 | #define NOTE_AS4 466 |
asmellby | 0:b7dd35e61bb1 | 81 | #define NOTE_B4 494 |
asmellby | 0:b7dd35e61bb1 | 82 | #define NOTE_C5 523 |
asmellby | 0:b7dd35e61bb1 | 83 | #define NOTE_CS5 554 |
asmellby | 0:b7dd35e61bb1 | 84 | #define NOTE_D5 587 |
asmellby | 0:b7dd35e61bb1 | 85 | #define NOTE_DS5 622 |
asmellby | 0:b7dd35e61bb1 | 86 | #define NOTE_E5 659 |
asmellby | 0:b7dd35e61bb1 | 87 | #define NOTE_F5 698 |
asmellby | 0:b7dd35e61bb1 | 88 | #define NOTE_FS5 740 |
asmellby | 0:b7dd35e61bb1 | 89 | #define NOTE_G5 784 |
asmellby | 0:b7dd35e61bb1 | 90 | #define NOTE_GS5 831 |
asmellby | 0:b7dd35e61bb1 | 91 | #define NOTE_A5 880 |
asmellby | 0:b7dd35e61bb1 | 92 | #define NOTE_AS5 932 |
asmellby | 0:b7dd35e61bb1 | 93 | #define NOTE_B5 988 |
asmellby | 0:b7dd35e61bb1 | 94 | #define NOTE_C6 1047 |
asmellby | 0:b7dd35e61bb1 | 95 | #define NOTE_CS6 1109 |
asmellby | 0:b7dd35e61bb1 | 96 | #define NOTE_D6 1175 |
asmellby | 0:b7dd35e61bb1 | 97 | #define NOTE_DS6 1245 |
asmellby | 0:b7dd35e61bb1 | 98 | #define NOTE_E6 1319 |
asmellby | 0:b7dd35e61bb1 | 99 | #define NOTE_F6 1397 |
asmellby | 0:b7dd35e61bb1 | 100 | #define NOTE_FS6 1480 |
asmellby | 0:b7dd35e61bb1 | 101 | #define NOTE_G6 1568 |
asmellby | 0:b7dd35e61bb1 | 102 | #define NOTE_GS6 1661 |
asmellby | 0:b7dd35e61bb1 | 103 | #define NOTE_A6 1760 |
asmellby | 0:b7dd35e61bb1 | 104 | #define NOTE_AS6 1865 |
asmellby | 0:b7dd35e61bb1 | 105 | #define NOTE_B6 1976 |
asmellby | 0:b7dd35e61bb1 | 106 | #define NOTE_C7 2093 |
asmellby | 0:b7dd35e61bb1 | 107 | #define NOTE_CS7 2217 |
asmellby | 0:b7dd35e61bb1 | 108 | #define NOTE_D7 2349 |
asmellby | 0:b7dd35e61bb1 | 109 | #define NOTE_DS7 2489 |
asmellby | 0:b7dd35e61bb1 | 110 | #define NOTE_E7 2637 |
asmellby | 0:b7dd35e61bb1 | 111 | #define NOTE_F7 2794 |
asmellby | 0:b7dd35e61bb1 | 112 | #define NOTE_FS7 2960 |
asmellby | 0:b7dd35e61bb1 | 113 | #define NOTE_G7 3136 |
asmellby | 0:b7dd35e61bb1 | 114 | #define NOTE_GS7 3322 |
asmellby | 0:b7dd35e61bb1 | 115 | #define NOTE_A7 3520 |
asmellby | 0:b7dd35e61bb1 | 116 | #define NOTE_AS7 3729 |
asmellby | 0:b7dd35e61bb1 | 117 | #define NOTE_B7 3951 |
asmellby | 0:b7dd35e61bb1 | 118 | #define NOTE_C8 4186 |
asmellby | 0:b7dd35e61bb1 | 119 | #define NOTE_CS8 4435 |
asmellby | 0:b7dd35e61bb1 | 120 | #define NOTE_D8 4699 |
asmellby | 0:b7dd35e61bb1 | 121 | #define NOTE_DS8 4978 |
asmellby | 0:b7dd35e61bb1 | 122 | |
asmellby | 0:b7dd35e61bb1 | 123 | #endif |