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.
PulseGenerator Class Reference
A class which generate us-order Pulse wave. More...
#include <PulseGenerator.h>
Public Member Functions | |
| PulseGenerator () | |
| Default constructor. | |
| int8_t | setWaveform (const uint16_t arg_pulseWidth, const uint16_t arg_pulseFreq) |
| Function to set pulse width and culc period from given frequency. | |
| void | startPulseWave () |
| Function to start/resume generating Pulse wave. | |
| void | stopPulseWave () |
| Function to stop/pose generating pulse wave. | |
| bool | getState () |
| Function to refer whther the pulse wave is H xor L. | |
Detailed Description
A class which generate us-order Pulse wave.
This generates continual pulses which can be used for such as clock for another continual pulses having same pulse width and frequency and another pulse hight.
start________|--|________|--|________|--|________|--|_____...stop
Definition at line 23 of file PulseGenerator.h.
Constructor & Destructor Documentation
| PulseGenerator | ( | ) |
Default constructor.
As default, the parameters of pulse form are set as followng.
- pulse width = 200 [us]
- pulse period = 5000 [us] (refering to freq = 200 [Hz])
Definition at line 9 of file PulseGenerator.cpp.
Member Function Documentation
| bool getState | ( | ) |
Function to refer whther the pulse wave is H xor L.
- Return values:
-
(bool) H between pulse rising and then falling (bool) L between pulse falling and then rising
Definition at line 82 of file PulseGenerator.h.
| int8_t setWaveform | ( | const uint16_t | arg_pulseWidth, |
| const uint16_t | arg_pulseFreq | ||
| ) |
Function to set pulse width and culc period from given frequency.
This function set a value m_clockduration, m_rt, and m_ft. The clock is culcurated from pulse width and period (= 1/frequency) using Eucledean Algorithm.
- Parameters:
-
arg_pulseWidth required in [us] arg_pulseFreq required in [Hz] bigger than 15 Hz
Definition at line 19 of file PulseGenerator.cpp.
| void startPulseWave | ( | ) |
Function to start/resume generating Pulse wave.
This function culculates a base clock freq (e.g. pulse periodand) and a pulse rising/falling timing in the clock with which to generate pulse wave. And then exe TICKER.attach().
Definition at line 55 of file PulseGenerator.cpp.
| void stopPulseWave | ( | ) |
Function to stop/pose generating pulse wave.
This function exe TICKER.detach().
Definition at line 63 of file PulseGenerator.cpp.
Generated on Tue Jul 12 2022 22:17:32 by
1.7.2