This makes Amplitude Modulated Pulse Train, which can be regarded as the discretized wave of the signal. Pulse Train can be defined by frequency and duty cycle, which can be temporarily changed, referring to PWM.

Dependents:   Interference_Simple

Revision:
4:7d5afb2e3b79
Parent:
1:19c3a52c80c3
Child:
7:5eae3f90d161
--- a/PulseTrain.cpp	Mon Jan 06 20:26:53 2020 +0000
+++ b/PulseTrain.cpp	Mon Jan 06 21:04:42 2020 +0000
@@ -9,7 +9,7 @@
     m_freq(velidateRange<uint32_t>(arg_freq, 1, FREQ_MAX)),
     m_duty(velidateRange<float>(arg_duty, 0.0, 1.0))
 {
-    m_period_us = 1000000 / m_freq + (1000000 % m_freq > m_freq /2 ? 1 : 0);
+    m_period_us = 1000000 / m_freq + (1000000 % m_freq > m_freq / 2 ? 1 : 0);
     init();
     m_callback_asClock = doNothing;
     m_callback_asPulseEdge = doNothing;
@@ -29,7 +29,7 @@
 void PulseTrain::setFrequency(uint32_t const arg_freq)
 {
     m_freq = velidateRange<uint32_t>(arg_freq, 1, FREQ_MAX);
-    m_period_us = 1000000 / m_freq + (1000000 % m_freq > m_freq /2 ? 1 : 0);
+    m_period_us = 1000000 / m_freq + (1000000 % m_freq > m_freq / 2 ? 1 : 0);
     init();
 }
 
@@ -97,8 +97,7 @@
     return m_duty;
 }
 
-uint32_t
-PulseTrain::getPeriod_us()
+uint32_t PulseTrain::getPeriod_us()
 {
     return m_period_us;
 }