File size: 1,098 Bytes
d1be154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef OT_TIMER_CLOCK_HPP_
#define OT_TIMER_CLOCK_HPP_

#include <ot/timer/pin.hpp>

namespace ot {

// Class: Clock
class Clock {

  friend class Timer;

  public:

    Clock(const std::string&, float);
    Clock(const std::string&, Pin&, float);
    Clock(const std::string&, float, std::array<float, MAX_TRAN>);
    Clock(const std::string&, Pin&, float, std::array<float, MAX_TRAN>);

    inline const std::string& name() const;
    inline const std::string& comment() const;

    inline float period() const;
    inline float waveform(Tran) const;

  private:

    std::string _name;

    Pin* _source {nullptr};

    float _period {.0f};

    std::array<float, MAX_TRAN> _waveform;

    void _scale_time(float);
};

// Function: name
inline const std::string& Clock::name() const {
  return _name;
}

// Function: period
inline float Clock::period() const {
  return _period;
}

// Function: waveform
inline float Clock::waveform(Tran rf) const {
  return _waveform[rf];
}

    
};  // end of namespace ot ------------------------------------------------------------------------

#endif