Diagram: Timing¶
Timing diagrams render digital waveforms side-by-side, perfect for busses, SPI, I2C, and memory timing.
Minimal example¶
import engrapha_notes as en
import engrapha_diagrams as ed
td = ed.TimingDiagram(
width=400, height=150, caption="Fig 13: SPI Timing"
)
# 50% duty-cycle clock
td.clock("CLK", period=20.0, cycles=6)
# Custom signal: (time, level)
td.signal(
"MISO",
transitions=[(0, 0), (10, 1), (30, 0), (50, 1), (70, 0)]
)
en.add(td.as_flowable())
Clock parameters¶
Signal transitions¶
td.signal(
"CS",
transitions=[
(0, 1), # start high
(5, 0), # pull low (select)
(85, 1), # return high (deselect)
],
)
Transition time values should be non-decreasing. Levels must be 0 or 1.
Grid¶
Grid is enabled by default. Disable it:
Height¶
The canvas grows automatically as signals are stacked. Each signal occupies ~36 points with an 8-point gap.
Colors¶
The active theme maps:
signal_high_color— high waveform colorsignal_low_color— low waveform colortime_tick_color— grid/tick colourtime_axis_color— axis and ruler coloursignal_label_color— label text