Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Seeed_Grove_Recorder_Example
ISD1820P.cpp
00001 #include "ISD1820P.h" 00002 00003 ISD1820P::ISD1820P(PinName recordPin, PinName playPin) 00004 : maxSoundTime(defaultMaxSoundTime), record(recordPin, 0), play(playPin, 0) { 00005 // Empty 00006 } 00007 00008 void ISD1820P::stopRecording() { 00009 record = 0; 00010 } 00011 00012 void ISD1820P::startRecording(float time) { 00013 if (!record) { 00014 if (time > maxSoundTime) { 00015 time = maxSoundTime; 00016 } 00017 00018 record = 1; 00019 recordTimeout.attach(this, &ISD1820P::stopRecording, time); 00020 } 00021 } 00022 00023 void ISD1820P::startRecordingMaxTime() { 00024 startRecording(maxSoundTime); 00025 } 00026 00027 void ISD1820P::stopPlaying() { 00028 play = 0; 00029 } 00030 00031 void ISD1820P::startPlaying(float time) { 00032 if (!play && !record) { 00033 if (time > maxSoundTime) { 00034 time = maxSoundTime; 00035 } 00036 00037 play = 1; 00038 playTimeout.attach(this, &ISD1820P::stopPlaying, time); 00039 } 00040 } 00041 00042 void ISD1820P::startPlayingMaxTime() { 00043 startPlaying(maxSoundTime); 00044 } 00045
Generated on Wed Jul 13 2022 00:04:16 by
1.7.2
Grove Recorder