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.cpp
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 #include "sawwave.h" 00014 00015 sawwave::sawwave(float v, int f, int d, int p) : wave(v, f, d, p) 00016 { 00017 _name = "saw" ; 00018 } 00019 00020 sawwave::~sawwave(void) { } 00021 00022 void sawwave::duty(int newvalue) 00023 { 00024 _duty = newvalue ; 00025 } 00026 00027 int sawwave::duty(void) 00028 { 00029 return( 100 ) ; 00030 } 00031 00032 int sawwave::value(void) 00033 { 00034 int result = 0 ; 00035 if (_cycle != 0) { 00036 result = _amp * _pos / _cycle ; 00037 } 00038 return( result ) ; 00039 }
Generated on Wed Jul 13 2022 01:58:56 by
1.7.2