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.
sinwave Class Reference
sinwave sine wave class More...
#include <sinwave.h>
Inherits wave.
Public Member Functions | |
| sinwave (float v, int f, int d=50, int p=0) | |
| constructor | |
| ~sinwave (void) | |
| destructor | |
| virtual void | duty (int newvalue) |
| mutator for duty (ignored for sin) | |
| virtual int | duty (void) |
| inspector for duty always returns 50 | |
| virtual int | value (void) |
| inspector for the value at _pos | |
| void | volt (float newvalue) |
| mutator for _amp but in float voltage | |
| float | volt (void) |
| inspector for _amp but in float voltage | |
| void | amp (int newvalue) |
| mutator for _amp in int value | |
| int | amp (void) |
| inspector for _amp | |
| void | cycle (int newvalue) |
| mutator for _cycle | |
| int | cycle (void) |
| inspector for _cycle | |
| void | phase (int newvalue) |
| mutator for _phase | |
| int | phase (void) |
| inspector for _phase | |
| void | freq (int newvalue) |
| mutator for _cycle but in frequency (Hz) | |
| int | freq (void) |
| inspector for _cycle but in frequency (Hz) | |
| void | pos (int newvalue) |
| mutator for _pos current positon in _cycle | |
| int | pos (void) |
| insepector for _pos | |
| virtual void | update (void) |
| update internal value consistancy | |
| virtual void | advance (int s=1) |
| advance position to be accessed through value() | |
| virtual const char * | name (void) |
| inspector to return class name | |
Protected Member Functions | |
| int | phase2pos (int p) |
| utility function to convert phase to position | |
| int | pos2phase (int p) |
| utility function to convert position to phase | |
Detailed Description
sinwave sine wave class
Definition at line 47 of file sinwave.h.
Constructor & Destructor Documentation
| sinwave | ( | float | v, |
| int | f, | ||
| int | d = 50, |
||
| int | p = 0 |
||
| ) |
constructor
sinwave class Copyright (c) 2014, 2015 Motoo Tanaka @ Design Methodology Lab
- Parameters:
-
float v amplitude in voltage (0.0 ~ 3.28V for FRDM-KL25Z) int f frequency in Hz (1 ~ 10000Hz) int d duty, ignored for sinwave int p phase in degree (0 ~ 359 degree)
- Returns:
- sinwave class instance
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition at line 15 of file sinwave.cpp.
| ~sinwave | ( | void | ) |
destructor
Definition at line 20 of file sinwave.cpp.
Member Function Documentation
| void advance | ( | int | s = 1 ) |
[virtual, inherited] |
| void amp | ( | int | newvalue ) | [inherited] |
| int amp | ( | void | ) | [inherited] |
| void cycle | ( | int | newvalue ) | [inherited] |
| int cycle | ( | void | ) | [inherited] |
| int duty | ( | void | ) | [virtual] |
inspector for duty always returns 50
Reimplemented from wave.
Definition at line 27 of file sinwave.cpp.
| void duty | ( | int | newvalue ) | [virtual] |
mutator for duty (ignored for sin)
Reimplemented from wave.
Definition at line 22 of file sinwave.cpp.
| void freq | ( | int | newvalue ) | [inherited] |
| int freq | ( | void | ) | [inherited] |
| const char * name | ( | void | ) | [virtual, inherited] |
| void phase | ( | int | newvalue ) | [inherited] |
| int phase | ( | void | ) | [inherited] |
| int phase2pos | ( | int | p ) | [protected, inherited] |
| void pos | ( | int | newvalue ) | [inherited] |
| int pos | ( | void | ) | [inherited] |
| int pos2phase | ( | int | p ) | [protected, inherited] |
| void update | ( | void | ) | [virtual, inherited] |
| int value | ( | void | ) | [virtual] |
inspector for the value at _pos
- Returns:
- int value at current position
Reimplemented from wave.
Definition at line 32 of file sinwave.cpp.
| void volt | ( | float | newvalue ) | [inherited] |
Generated on Wed Jul 13 2022 01:58:56 by
1.7.2