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.
sawwave.h
00001 /** sawwave class 00002 * Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab 00003 * 00004 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00005 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00006 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00007 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00008 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00009 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00010 * THE SOFTWARE. 00011 */ 00012 00013 /** 00014 * It was after I had written this class when I noticed that 00015 * triwave with duty=100 is actually sawwave. 00016 * So besically this class is not necessary, but for the time being 00017 * it's here anyway. 00018 */ 00019 00020 #ifndef _SAW_WAVE_H_ 00021 #define _SAW_WAVE_H_ included 00022 #include "wave.h" 00023 00024 /** sawwave class 00025 */ 00026 class sawwave : public wave { 00027 public: 00028 00029 /** constructor 00030 * 00031 * @param float v amplitude in voltage (0.0 ~ 3.28V for FRDM-KL25Z) 00032 * @param int f frequency in Hz (1 ~ 10000Hz) 00033 * @param int d duty, ignored for sawwave 00034 * @param int p phase in degree (0 ~ 359 degree) 00035 * @returns sawwave class instance 00036 */ 00037 sawwave(float v, int f, int d = 50, int p = 0) ; 00038 00039 /** destructor 00040 */ 00041 ~sawwave(void) ; 00042 00043 /** mutator for duty (ignored for sawwave) 00044 */ 00045 virtual void duty(int newvalue) ; 00046 00047 /** inspector for duty always returns 100 */ 00048 virtual int duty(void) ; 00049 00050 /** inspector for the value at _pos 00051 * 00052 * @returns int value at current position 00053 */ 00054 virtual int value(void) ; // return current value 00055 00056 protected: 00057 00058 private: 00059 } ; 00060 00061 #endif /* _SAW_WAVE_H_ */
Generated on Wed Jul 13 2022 01:58:56 by
1.7.2