19 if (signalEdge && !status && newStatus) {
29 listener->
signal(*
this, time);
48 listener->
signal(*
this, time);
60 return ((time - referenceTime) % totalDur) < hiDur;
83 auto a = (
begin < referenceTime)
85 : (
begin - referenceTime) / totalDur;
86 auto b = (
end - referenceTime) / totalDur;
96 if (signalEdge != wanted) {
100 EmuTime tmp(referenceTime);
114void ClockPin::unschedule()
119void ClockPin::schedule(EmuTime::param time)
121 assert(signalEdge && periodic && listener);
125void ClockPin::executeUntil(EmuTime::param time)
127 assert(signalEdge && periodic && listener);
130 schedule(time + totalDur);
135template<
typename Archive>
138 ar.template serializeBase<Schedulable>(*
this);
139 ar.serialize(
"totalDur", totalDur,
141 "referenceTime", referenceTime,
142 "periodic", periodic,
144 "signalEdge", signalEdge);
virtual void signal(ClockPin &pin, EmuTime::param time)=0
virtual void signalPosEdge(ClockPin &pin, EmuTime::param time)=0
ClockPin(Scheduler &scheduler, ClockPinListener *listener=nullptr)
unsigned getTicksBetween(EmuTime::param begin, EmuTime::param end) const
void generateEdgeSignals(bool wanted, EmuTime::param time)
void setState(bool status, EmuTime::param time)
void serialize(Archive &ar, unsigned version)
bool getState(EmuTime::param time) const
EmuDuration::param getHighDuration() const
void setPeriodicState(EmuDuration::param total, EmuDuration::param hi, EmuTime::param time)
EmuDuration::param getTotalDuration() const
static constexpr EmuDuration zero()
Every class that wants to get scheduled at some point must inherit from this class.
void setSyncPoint(EmuTime::param timestamp)
This file implemented 3 utility functions:
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
constexpr auto begin(const zstring_view &x)
constexpr auto end(const zstring_view &x)